eslint.config.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. export default [
  2. {
  3. ignores: [
  4. 'dist/**',
  5. 'third_party/**',
  6. ]
  7. },
  8. {
  9. languageOptions: {
  10. globals: {
  11. atob: 'readonly',
  12. BigInt: 'readonly',
  13. console: 'readonly',
  14. global: 'readonly',
  15. process: 'readonly',
  16. self: 'readonly',
  17. TextDecoder: 'readonly',
  18. TextEncoder: 'readonly',
  19. window: 'readonly',
  20. },
  21. sourceType: 'module'
  22. },
  23. rules: {
  24. 'accessor-pairs': 'error',
  25. 'array-bracket-spacing': 'error',
  26. 'array-callback-return': 'error',
  27. // 'arrow-body-style': 'error',
  28. 'arrow-parens': 'error',
  29. 'block-scoped-var': 'error',
  30. 'brace-style': 'error',
  31. // 'camelcase': 'error',
  32. // 'capitalized-comments': 'error',
  33. // 'class-methods-use-this': 'error',
  34. // 'complexity': 'error',
  35. 'computed-property-spacing': 'error',
  36. 'consistent-return': 'error',
  37. 'consistent-this': 'error',
  38. 'constructor-super': 'error',
  39. 'curly': 'error',
  40. 'default-case': 'error',
  41. 'default-case-last': 'error',
  42. 'default-param-last': 'error',
  43. 'dot-notation': 'error',
  44. 'eqeqeq': 'error',
  45. 'for-direction': 'error',
  46. 'func-name-matching': 'error',
  47. // 'func-names': 'error',
  48. 'func-style': 'error',
  49. 'getter-return': 'error',
  50. 'grouped-accessor-pairs': 'error',
  51. 'guard-for-in': 'error',
  52. 'id-denylist': 'error',
  53. // 'id-length': 'error',
  54. 'id-match': 'error',
  55. 'indent': ['error', 4, { 'SwitchCase': 1 }],
  56. 'init-declarations': 'error',
  57. 'keyword-spacing': 'error',
  58. // 'line-comment-position': 'error',
  59. // 'logical-assignment-operators': 'error',
  60. // 'max-classes-per-file': 'error',
  61. // 'max-depth': 'error',
  62. // 'max-lines': 'error',
  63. // 'max-lines-per-function': 'error',
  64. 'max-nested-callbacks': 'error',
  65. // 'max-params': 'error',
  66. // 'max-statements': 'error',
  67. // 'multiline-comment-style': 'error',
  68. // 'new-cap': 'error',
  69. 'no-alert': 'error',
  70. 'no-array-constructor': 'error',
  71. 'no-async-promise-executor': 'error',
  72. 'no-await-in-loop': 'error',
  73. // 'no-bitwise': 'error',
  74. 'no-caller': 'error',
  75. 'no-case-declarations': 'error',
  76. 'no-class-assign': 'error',
  77. 'no-compare-neg-zero': 'error',
  78. 'no-cond-assign': 'error',
  79. 'no-console': 'error',
  80. 'no-const-assign': 'error',
  81. 'no-constant-binary-expression': 'error',
  82. 'no-constant-condition': 'error',
  83. 'no-constructor-return': 'error',
  84. // 'no-continue': 'error',
  85. 'no-control-regex': 'error',
  86. 'no-debugger': 'error',
  87. 'no-delete-var': 'error',
  88. 'no-div-regex': 'error',
  89. 'no-dupe-args': 'error',
  90. 'no-dupe-class-members': 'error',
  91. 'no-dupe-else-if': 'error',
  92. 'no-dupe-keys': 'error',
  93. 'no-duplicate-case': 'error',
  94. 'no-duplicate-imports': 'error',
  95. 'no-else-return': 'error',
  96. 'no-empty': 'error',
  97. 'no-empty-character-class': 'error',
  98. // 'no-empty-function': 'error',
  99. 'no-empty-pattern': 'error',
  100. 'no-empty-static-block': 'error',
  101. 'no-eq-null': 'error',
  102. 'no-eval': 'error',
  103. 'no-ex-assign': 'error',
  104. 'no-extend-native': 'error',
  105. 'no-extra-bind': 'error',
  106. 'no-extra-boolean-cast': 'error',
  107. 'no-extra-label': 'error',
  108. 'no-extra-semi': 'error',
  109. 'no-fallthrough': 'error',
  110. 'no-func-assign': 'error',
  111. 'no-global-assign': 'error',
  112. 'no-implicit-coercion': 'error',
  113. 'no-implicit-globals': 'error',
  114. 'no-implied-eval': 'error',
  115. 'no-import-assign': 'error',
  116. // 'no-inline-comments': 'error',
  117. 'no-inner-declarations': 'error',
  118. 'no-invalid-regexp': 'error',
  119. 'no-invalid-this': 'error',
  120. 'no-irregular-whitespace': 'error',
  121. 'no-iterator': 'error',
  122. 'no-label-var': 'error',
  123. 'no-labels': 'error',
  124. 'no-lone-blocks': 'error',
  125. 'no-lonely-if': 'error',
  126. 'no-loop-func': 'error',
  127. 'no-loss-of-precision': 'error',
  128. // 'no-magic-numbers': 'error',
  129. 'no-misleading-character-class': 'error',
  130. 'no-multi-assign': 'error',
  131. 'no-multi-str': 'error',
  132. 'no-multiple-empty-lines': ['error', { 'max': 1 }],
  133. 'no-negated-condition': 'error',
  134. 'no-nested-ternary': 'error',
  135. 'no-new': 'error',
  136. 'no-new-func': 'error',
  137. 'no-new-native-nonconstructor': 'error',
  138. 'no-new-wrappers': 'error',
  139. 'no-nonoctal-decimal-escape': 'error',
  140. 'no-obj-calls': 'error',
  141. 'no-object-constructor': 'error',
  142. 'no-octal': 'error',
  143. 'no-octal-escape': 'error',
  144. // 'no-param-reassign': 'error',
  145. // 'no-plusplus': 'error',
  146. 'no-promise-executor-return': 'error',
  147. 'no-proto': 'error',
  148. 'no-prototype-builtins': 'error',
  149. 'no-redeclare': 'error',
  150. 'no-regex-spaces': 'error',
  151. 'no-restricted-exports': 'error',
  152. 'no-restricted-globals': 'error',
  153. 'no-restricted-imports': 'error',
  154. 'no-restricted-properties': 'error',
  155. 'no-restricted-syntax': 'error',
  156. 'no-return-assign': 'error',
  157. 'no-script-url': 'error',
  158. 'no-self-assign': 'error',
  159. 'no-self-compare': 'error',
  160. 'no-sequences': 'error',
  161. 'no-setter-return': 'error',
  162. // 'no-shadow': 'error',
  163. 'no-shadow-restricted-names': 'error',
  164. 'no-sparse-arrays': 'error',
  165. 'no-template-curly-in-string': 'error',
  166. // 'no-ternary': 'error',
  167. 'no-this-before-super': 'error',
  168. 'no-throw-literal': 'error',
  169. 'no-trailing-spaces': 'error',
  170. 'no-undef': 'error',
  171. 'no-undef-init': 'error',
  172. // 'no-undefined': 'error',
  173. // 'no-underscore-dangle': 'error',
  174. 'no-unexpected-multiline': 'error',
  175. 'no-unmodified-loop-condition': 'error',
  176. // 'no-unneeded-ternary': 'error',
  177. 'no-unreachable': 'error',
  178. 'no-unreachable-loop': 'error',
  179. 'no-unsafe-finally': 'error',
  180. 'no-unsafe-negation': 'error',
  181. 'no-unsafe-optional-chaining': 'error',
  182. 'no-unused-expressions': 'error',
  183. 'no-unused-labels': 'error',
  184. 'no-unused-private-class-members': 'error',
  185. 'no-unused-vars': 'error',
  186. 'no-use-before-define': 'error',
  187. // 'no-useless-assignment': 'error',
  188. 'no-useless-backreference': 'error',
  189. 'no-useless-call': 'error',
  190. 'no-useless-catch': 'error',
  191. 'no-useless-computed-key': 'error',
  192. 'no-useless-concat': 'error',
  193. 'no-useless-constructor': 'error',
  194. 'no-useless-escape': 'error',
  195. 'no-useless-rename': 'error',
  196. 'no-useless-return': 'error',
  197. 'no-var': 'error',
  198. 'no-void': 'error',
  199. 'no-warning-comments': 'error',
  200. 'no-with': 'error',
  201. 'object-curly-spacing': ['error', 'always'],
  202. 'object-shorthand': 'error',
  203. // 'one-var': 'error',
  204. 'operator-assignment': 'error',
  205. 'prefer-arrow-callback': 'error',
  206. 'prefer-const': 'error',
  207. 'prefer-destructuring': ['error', { 'array': false }],
  208. // 'prefer-exponentiation-operator': 'error',
  209. // 'prefer-named-capture-group': 'error',
  210. 'prefer-numeric-literals': 'error',
  211. // 'prefer-object-has-own': 'error',
  212. 'prefer-object-spread': 'error',
  213. 'prefer-promise-reject-errors': 'error',
  214. 'prefer-regex-literals': 'error',
  215. 'prefer-rest-params': 'error',
  216. 'prefer-spread': 'error',
  217. 'prefer-template': 'error',
  218. 'radix': 'error',
  219. 'require-atomic-updates': 'error',
  220. // 'require-await': 'error',
  221. // 'require-unicode-regexp': 'error',
  222. 'require-yield': 'error',
  223. 'semi': ['error', 'always'],
  224. 'sort-imports': 'error',
  225. // 'sort-keys': 'error',
  226. 'sort-vars': 'error',
  227. 'space-before-blocks': 'error',
  228. 'space-in-parens': 'error',
  229. 'space-infix-ops': 'error',
  230. 'strict': 'error',
  231. 'symbol-description': 'error',
  232. 'template-curly-spacing': 'error',
  233. 'unicode-bom': 'error',
  234. 'use-isnan': 'error',
  235. 'valid-typeof': 'error',
  236. 'vars-on-top': 'error',
  237. 'yoda': 'error'
  238. }
  239. },
  240. {
  241. files: ['source/index.js'],
  242. languageOptions: {
  243. sourceType: 'script',
  244. ecmaVersion: 2015
  245. },
  246. rules: {
  247. 'no-var': 'off',
  248. 'prefer-arrow-callback': 'off',
  249. 'prefer-template': 'off',
  250. 'prefer-destructuring': 'off',
  251. 'vars-on-top': 'off',
  252. 'strict': 'off'
  253. }
  254. }
  255. ];