eslint.config.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. const globals = require('globals');
  2. const { globalIgnores } = require('eslint/config');
  3. module.exports = [globalIgnores(["./*.*js", "!./privatebin.js"]), {
  4. languageOptions: {
  5. globals: {
  6. ...globals.amd,
  7. ...globals.browser,
  8. ...globals.jquery,
  9. ...globals.node,
  10. ...globals.mocha,
  11. DOMPurify: "readonly",
  12. cleanup: "writable",
  13. describe: "readonly",
  14. jsc: "readonly",
  15. jsdom: "writable",
  16. kjua: "writable",
  17. WebCrypto: "writable",
  18. },
  19. // async & await are ECMAScript 2017 features, unicode character class escape are ECMAScript 2018 features
  20. ecmaVersion: 2018,
  21. sourceType: "commonjs",
  22. },
  23. rules: {
  24. "comma-dangle": ["error", "never"],
  25. "no-cond-assign": 2,
  26. "no-console": 0,
  27. "no-constant-condition": 2,
  28. "no-control-regex": 2,
  29. "no-debugger": 2,
  30. "no-dupe-args": 2,
  31. "no-dupe-keys": 2,
  32. "no-duplicate-case": 2,
  33. "no-empty": 2,
  34. "no-empty-character-class": 2,
  35. "no-ex-assign": 2,
  36. "no-extra-boolean-cast": 2,
  37. "no-extra-parens": 0,
  38. "no-extra-semi": 2,
  39. "no-func-assign": 2,
  40. "no-inner-declarations": ["error", "functions"],
  41. "no-invalid-regexp": 2,
  42. "no-irregular-whitespace": 2,
  43. "no-negated-in-lhs": 2,
  44. "no-obj-calls": 2,
  45. "no-regex-spaces": 2,
  46. "no-sparse-arrays": 2,
  47. "no-unexpected-multiline": 2,
  48. "no-unreachable": 2,
  49. "use-isnan": 2,
  50. "valid-jsdoc": 0,
  51. "valid-typeof": 2,
  52. // Best Practices
  53. "accessor-pairs": 2,
  54. "block-scoped-var": 0,
  55. complexity: ["error", 20],
  56. "consistent-return": 0,
  57. curly: 0,
  58. "default-case": 0,
  59. "dot-location": 0,
  60. "dot-notation": 0,
  61. eqeqeq: 2,
  62. "guard-for-in": 2,
  63. "no-alert": 0,
  64. "no-caller": 2,
  65. "no-case-declarations": 2,
  66. "no-div-regex": 2,
  67. "no-else-return": 0,
  68. "no-empty-pattern": 2,
  69. "no-eq-null": 2,
  70. "no-eval": 2,
  71. "no-extend-native": 2,
  72. "no-extra-bind": 2,
  73. "no-fallthrough": 2,
  74. "no-floating-decimal": 0,
  75. "no-implicit-coercion": 0,
  76. "no-implied-eval": 2,
  77. "no-invalid-this": 0,
  78. "no-iterator": 2,
  79. "no-labels": 0,
  80. "no-lone-blocks": 2,
  81. "no-loop-func": 2,
  82. "no-magic-number": 0,
  83. "no-multi-spaces": 0,
  84. "no-multi-str": 0,
  85. "no-native-reassign": 2,
  86. "no-new-func": 2,
  87. "no-new-wrappers": 2,
  88. "no-new": 2,
  89. "no-octal-escape": 2,
  90. "no-octal": 2,
  91. "no-proto": 2,
  92. "no-redeclare": 0,
  93. "no-return-assign": 2,
  94. "no-script-url": 2,
  95. "no-self-compare": 2,
  96. "no-sequences": 0,
  97. "no-throw-literal": 0,
  98. "no-unused-expressions": 2,
  99. "no-useless-call": 2,
  100. "no-useless-concat": 2,
  101. "no-void": 2,
  102. "no-warning-comments": 0,
  103. "no-with": 2,
  104. radix: 2,
  105. "vars-on-top": 0,
  106. "wrap-iife": 0,
  107. yoda: 0,
  108. // Strict
  109. strict: 2,
  110. // Variables
  111. "init-declarations": 0,
  112. "no-catch-shadow": 2,
  113. "no-delete-var": 2,
  114. "no-label-var": 2,
  115. "no-shadow-restricted-names": 2,
  116. "no-shadow": 0,
  117. "no-undef-init": 2,
  118. "no-undef": 0,
  119. "no-undefined": 0,
  120. "no-unused-vars": 0,
  121. "no-use-before-define": 0,
  122. // Node.js and CommonJS
  123. "callback-return": 2,
  124. "global-require": 2,
  125. "handle-callback-err": 2,
  126. "no-mixed-requires": 0,
  127. "no-new-require": 0,
  128. "no-path-concat": 2,
  129. "no-process-exit": 2,
  130. "no-restricted-modules": 0,
  131. "no-sync": 0,
  132. // Stylistic Issues
  133. "array-bracket-spacing": 0,
  134. "block-spacing": 0,
  135. "brace-style": 0,
  136. camelcase: 0,
  137. "comma-spacing": 0,
  138. "comma-style": 0,
  139. "computed-property-spacing": 0,
  140. "consistent-this": 0,
  141. "eol-last": 0,
  142. "func-names": 0,
  143. "func-style": 0,
  144. "id-length": 0,
  145. "id-match": 0,
  146. indent: 0,
  147. "jsx-quotes": 0,
  148. "key-spacing": 0,
  149. "linebreak-style": 0,
  150. "lines-around-comment": 0,
  151. "max-depth": 0,
  152. "max-len": 0,
  153. "max-nested-callbacks": 0,
  154. "max-params": 0,
  155. "max-statements": ["error", 60],
  156. "new-cap": 0,
  157. "new-parens": 0,
  158. "newline-after-var": 0,
  159. "no-array-constructor": 0,
  160. "no-bitwise": 0,
  161. "no-continue": 0,
  162. "no-inline-comments": 0,
  163. "no-lonely-if": 0,
  164. "no-mixed-spaces-and-tabs": 0,
  165. "no-multiple-empty-lines": 0,
  166. "no-negated-condition": 0,
  167. "no-nested-ternary": 0,
  168. "no-new-object": 0,
  169. "no-plusplus": 0,
  170. "no-restricted-syntax": 0,
  171. "no-spaced-func": 0,
  172. "no-ternary": 0,
  173. "no-trailing-spaces": 0,
  174. "no-underscore-dangle": 0,
  175. "no-unneeded-ternary": 0,
  176. "object-curly-spacing": 0,
  177. "one-var": 0,
  178. "operator-assignment": 0,
  179. "operator-linebreak": 0,
  180. "padded-blocks": 0,
  181. "quote-props": 0,
  182. quotes: ["error", "single"],
  183. "require-jsdoc": 0,
  184. "semi-spacing": 0,
  185. semi: 0,
  186. "sort-vars": 0,
  187. "space-after-keywords": 0,
  188. "space-before-blocks": 0,
  189. "space-before-function-paren": 0,
  190. "space-before-keywords": 0,
  191. "space-in-parens": 0,
  192. "space-infix-ops": 0,
  193. "space-return-throw-case": 0,
  194. "space-unary-ops": 0,
  195. "spaced-comment": 0,
  196. "wrap-regex": 0,
  197. // ECMAScript 6 (2015)
  198. "arrow-body-style": 0,
  199. "arrow-parens": 0,
  200. "arrow-spacing": 0,
  201. "constructor-super": 0,
  202. "generator-star-spacing": 0,
  203. "no-arrow-condition": 0,
  204. "no-class-assign": 0,
  205. "no-const-assign": 0,
  206. "no-dupe-class-members": 0,
  207. "no-this-before-super": 0,
  208. "no-var": 0,
  209. "object-shorthand": 0,
  210. "prefer-arrow-callback": 0,
  211. "prefer-const": 0,
  212. "prefer-reflect": 0,
  213. "prefer-spread": 0,
  214. "prefer-template": 0,
  215. "require-yield": 0,
  216. },
  217. }];