gitea源码

eslint.config.ts 43KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030
  1. import arrayFunc from 'eslint-plugin-array-func';
  2. import comments from '@eslint-community/eslint-plugin-eslint-comments';
  3. import github from 'eslint-plugin-github';
  4. import globals from 'globals';
  5. import importPlugin from 'eslint-plugin-import-x';
  6. import noUseExtendNative from 'eslint-plugin-no-use-extend-native';
  7. import playwright from 'eslint-plugin-playwright';
  8. import regexp from 'eslint-plugin-regexp';
  9. import sonarjs from 'eslint-plugin-sonarjs';
  10. import stylistic from '@stylistic/eslint-plugin';
  11. import typescriptParser from '@typescript-eslint/parser';
  12. import typescriptPlugin from 'typescript-eslint';
  13. import unicorn from 'eslint-plugin-unicorn';
  14. import vitest from '@vitest/eslint-plugin';
  15. import vue from 'eslint-plugin-vue';
  16. import vueScopedCss from 'eslint-plugin-vue-scoped-css';
  17. import wc from 'eslint-plugin-wc';
  18. import {defineConfig, globalIgnores} from 'eslint/config';
  19. const jsExts = ['js', 'mjs', 'cjs'] as const;
  20. const tsExts = ['ts', 'mts', 'cts'] as const;
  21. const restrictedSyntax = ['WithStatement', 'ForInStatement', 'LabeledStatement', 'SequenceExpression'];
  22. export default defineConfig([
  23. globalIgnores([
  24. 'web_src/js/vendor',
  25. 'web_src/fomantic',
  26. 'public/assets/js',
  27. ]),
  28. {
  29. files: [`**/*.{${[...jsExts, ...tsExts].join(',')}}`],
  30. ignores: ['dist/*'],
  31. languageOptions: {
  32. ecmaVersion: 'latest',
  33. sourceType: 'module',
  34. globals: {
  35. ...globals.browser,
  36. ...globals.node,
  37. },
  38. parser: typescriptParser,
  39. parserOptions: {
  40. sourceType: 'module',
  41. ecmaVersion: 'latest',
  42. ecmaFeatures: {
  43. impliedStrict: true,
  44. },
  45. project: true,
  46. },
  47. },
  48. linterOptions: {
  49. reportUnusedDisableDirectives: 2,
  50. },
  51. plugins: {
  52. '@eslint-community/eslint-comments': comments,
  53. // @ts-expect-error
  54. '@stylistic': stylistic,
  55. '@typescript-eslint': typescriptPlugin.plugin,
  56. 'array-func': arrayFunc,
  57. // @ts-expect-error -- https://github.com/un-ts/eslint-plugin-import-x/issues/203
  58. 'import-x': importPlugin,
  59. 'no-use-extend-native': noUseExtendNative,
  60. // @ts-expect-error
  61. regexp,
  62. // @ts-expect-error
  63. sonarjs,
  64. // @ts-expect-error
  65. unicorn,
  66. github,
  67. // @ts-expect-error
  68. wc,
  69. },
  70. settings: {
  71. 'import-x/extensions': [...jsExts, ...tsExts].map((ext) => `.${ext}`),
  72. 'import-x/parsers': {'@typescript-eslint/parser': [...jsExts, ...tsExts].map((ext) => `.${ext}`)},
  73. 'import-x/resolver': {'typescript': true},
  74. },
  75. rules: {
  76. '@eslint-community/eslint-comments/disable-enable-pair': [2],
  77. '@eslint-community/eslint-comments/no-aggregating-enable': [2],
  78. '@eslint-community/eslint-comments/no-duplicate-disable': [2],
  79. '@eslint-community/eslint-comments/no-restricted-disable': [0],
  80. '@eslint-community/eslint-comments/no-unlimited-disable': [2],
  81. '@eslint-community/eslint-comments/no-unused-disable': [2],
  82. '@eslint-community/eslint-comments/no-unused-enable': [2],
  83. '@eslint-community/eslint-comments/no-use': [0],
  84. '@eslint-community/eslint-comments/require-description': [0],
  85. '@stylistic/array-bracket-newline': [0],
  86. '@stylistic/array-bracket-spacing': [2, 'never'],
  87. '@stylistic/array-element-newline': [0],
  88. '@stylistic/arrow-parens': [2, 'always'],
  89. '@stylistic/arrow-spacing': [2, {before: true, after: true}],
  90. '@stylistic/block-spacing': [0],
  91. '@stylistic/brace-style': [2, '1tbs', {allowSingleLine: true}],
  92. '@stylistic/comma-dangle': [2, 'always-multiline'],
  93. '@stylistic/comma-spacing': [2, {before: false, after: true}],
  94. '@stylistic/comma-style': [2, 'last'],
  95. '@stylistic/computed-property-spacing': [2, 'never'],
  96. '@stylistic/dot-location': [2, 'property'],
  97. '@stylistic/eol-last': [2],
  98. '@stylistic/function-call-argument-newline': [0],
  99. '@stylistic/function-call-spacing': [2, 'never'],
  100. '@stylistic/function-paren-newline': [0],
  101. '@stylistic/generator-star-spacing': [0],
  102. '@stylistic/implicit-arrow-linebreak': [0],
  103. '@stylistic/indent': [2, 2, {ignoreComments: true, SwitchCase: 1}],
  104. '@stylistic/key-spacing': [2],
  105. '@stylistic/keyword-spacing': [2],
  106. '@stylistic/line-comment-position': [0],
  107. '@stylistic/linebreak-style': [2, 'unix'],
  108. '@stylistic/lines-around-comment': [0],
  109. '@stylistic/lines-between-class-members': [0],
  110. '@stylistic/max-len': [0],
  111. '@stylistic/max-statements-per-line': [0],
  112. '@stylistic/multiline-comment-style': [0],
  113. '@stylistic/multiline-ternary': [0],
  114. '@stylistic/new-parens': [2],
  115. '@stylistic/newline-per-chained-call': [0],
  116. '@stylistic/no-confusing-arrow': [0],
  117. '@stylistic/no-extra-parens': [0],
  118. '@stylistic/no-extra-semi': [2],
  119. '@stylistic/no-floating-decimal': [0],
  120. '@stylistic/no-mixed-operators': [0],
  121. '@stylistic/no-mixed-spaces-and-tabs': [2],
  122. '@stylistic/no-multi-spaces': [2, {ignoreEOLComments: true, exceptions: {Property: true}}],
  123. '@stylistic/no-multiple-empty-lines': [2, {max: 1, maxEOF: 0, maxBOF: 0}],
  124. '@stylistic/no-tabs': [2],
  125. '@stylistic/no-trailing-spaces': [2],
  126. '@stylistic/no-whitespace-before-property': [2],
  127. '@stylistic/nonblock-statement-body-position': [2],
  128. '@stylistic/object-curly-newline': [0],
  129. '@stylistic/object-curly-spacing': [2, 'never'],
  130. '@stylistic/object-property-newline': [0],
  131. '@stylistic/one-var-declaration-per-line': [0],
  132. '@stylistic/operator-linebreak': [2, 'after'],
  133. '@stylistic/padded-blocks': [2, 'never'],
  134. '@stylistic/padding-line-between-statements': [0],
  135. '@stylistic/quote-props': [0],
  136. '@stylistic/quotes': [2, 'single', {avoidEscape: true, allowTemplateLiterals: 'always'}],
  137. '@stylistic/rest-spread-spacing': [2, 'never'],
  138. '@stylistic/semi': [2, 'always', {omitLastInOneLineBlock: true}],
  139. '@stylistic/semi-spacing': [2, {before: false, after: true}],
  140. '@stylistic/semi-style': [2, 'last'],
  141. '@stylistic/space-before-blocks': [2, 'always'],
  142. '@stylistic/space-before-function-paren': [2, {anonymous: 'ignore', named: 'never', asyncArrow: 'always'}],
  143. '@stylistic/space-in-parens': [2, 'never'],
  144. '@stylistic/space-infix-ops': [2],
  145. '@stylistic/space-unary-ops': [2],
  146. '@stylistic/spaced-comment': [2, 'always'],
  147. '@stylistic/switch-colon-spacing': [2],
  148. '@stylistic/template-curly-spacing': [2, 'never'],
  149. '@stylistic/template-tag-spacing': [2, 'never'],
  150. '@stylistic/wrap-iife': [2, 'inside'],
  151. '@stylistic/wrap-regex': [0],
  152. '@stylistic/yield-star-spacing': [2, 'after'],
  153. '@typescript-eslint/adjacent-overload-signatures': [0],
  154. '@typescript-eslint/array-type': [0],
  155. '@typescript-eslint/await-thenable': [2],
  156. '@typescript-eslint/ban-ts-comment': [2, {'ts-expect-error': false, 'ts-ignore': true, 'ts-nocheck': false, 'ts-check': false}],
  157. '@typescript-eslint/ban-tslint-comment': [0],
  158. '@typescript-eslint/class-literal-property-style': [0],
  159. '@typescript-eslint/class-methods-use-this': [0],
  160. '@typescript-eslint/consistent-generic-constructors': [0],
  161. '@typescript-eslint/consistent-indexed-object-style': [0],
  162. '@typescript-eslint/consistent-return': [0],
  163. '@typescript-eslint/consistent-type-assertions': [2, {assertionStyle: 'as', objectLiteralTypeAssertions: 'allow'}],
  164. '@typescript-eslint/consistent-type-definitions': [2, 'type'],
  165. '@typescript-eslint/consistent-type-exports': [2, {fixMixedExportsWithInlineTypeSpecifier: false}],
  166. '@typescript-eslint/consistent-type-imports': [2, {prefer: 'type-imports', fixStyle: 'separate-type-imports', disallowTypeAnnotations: true}],
  167. '@typescript-eslint/default-param-last': [0],
  168. '@typescript-eslint/dot-notation': [0],
  169. '@typescript-eslint/explicit-function-return-type': [0],
  170. '@typescript-eslint/explicit-member-accessibility': [0],
  171. '@typescript-eslint/explicit-module-boundary-types': [0],
  172. '@typescript-eslint/init-declarations': [0],
  173. '@typescript-eslint/max-params': [0],
  174. '@typescript-eslint/member-ordering': [0],
  175. '@typescript-eslint/method-signature-style': [0],
  176. '@typescript-eslint/naming-convention': [0],
  177. '@typescript-eslint/no-array-constructor': [2],
  178. '@typescript-eslint/no-array-delete': [2],
  179. '@typescript-eslint/no-base-to-string': [0],
  180. '@typescript-eslint/no-confusing-non-null-assertion': [2],
  181. '@typescript-eslint/no-confusing-void-expression': [0],
  182. '@typescript-eslint/no-deprecated': [2],
  183. '@typescript-eslint/no-dupe-class-members': [0],
  184. '@typescript-eslint/no-duplicate-enum-values': [2],
  185. '@typescript-eslint/no-duplicate-type-constituents': [2, {ignoreUnions: true}],
  186. '@typescript-eslint/no-dynamic-delete': [0],
  187. '@typescript-eslint/no-empty-function': [0],
  188. '@typescript-eslint/no-empty-interface': [0],
  189. '@typescript-eslint/no-empty-object-type': [2],
  190. '@typescript-eslint/no-explicit-any': [0],
  191. '@typescript-eslint/no-extra-non-null-assertion': [2],
  192. '@typescript-eslint/no-extraneous-class': [0],
  193. '@typescript-eslint/no-floating-promises': [0],
  194. '@typescript-eslint/no-for-in-array': [2],
  195. '@typescript-eslint/no-implied-eval': [2],
  196. '@typescript-eslint/no-import-type-side-effects': [0], // dupe with consistent-type-imports
  197. '@typescript-eslint/no-inferrable-types': [0],
  198. '@typescript-eslint/no-invalid-this': [0],
  199. '@typescript-eslint/no-invalid-void-type': [0],
  200. '@typescript-eslint/no-loop-func': [0],
  201. '@typescript-eslint/no-loss-of-precision': [0],
  202. '@typescript-eslint/no-magic-numbers': [0],
  203. '@typescript-eslint/no-meaningless-void-operator': [0],
  204. '@typescript-eslint/no-misused-new': [2],
  205. '@typescript-eslint/no-misused-promises': [2, {checksVoidReturn: {attributes: false, arguments: false}}],
  206. '@typescript-eslint/no-mixed-enums': [0],
  207. '@typescript-eslint/no-namespace': [2],
  208. '@typescript-eslint/no-non-null-asserted-nullish-coalescing': [0],
  209. '@typescript-eslint/no-non-null-asserted-optional-chain': [2],
  210. '@typescript-eslint/no-non-null-assertion': [0],
  211. '@typescript-eslint/no-redeclare': [0],
  212. '@typescript-eslint/no-redundant-type-constituents': [2],
  213. '@typescript-eslint/no-require-imports': [2],
  214. '@typescript-eslint/no-restricted-imports': [0],
  215. '@typescript-eslint/no-restricted-types': [0],
  216. '@typescript-eslint/no-shadow': [0],
  217. '@typescript-eslint/no-this-alias': [0], // handled by unicorn/no-this-assignment
  218. '@typescript-eslint/no-unnecessary-boolean-literal-compare': [0],
  219. '@typescript-eslint/no-unnecessary-condition': [0],
  220. '@typescript-eslint/no-unnecessary-qualifier': [0],
  221. '@typescript-eslint/no-unnecessary-template-expression': [0],
  222. '@typescript-eslint/no-unnecessary-type-arguments': [0],
  223. '@typescript-eslint/no-unnecessary-type-assertion': [2],
  224. '@typescript-eslint/no-unnecessary-type-constraint': [2],
  225. '@typescript-eslint/no-unnecessary-type-conversion': [2],
  226. '@typescript-eslint/no-unsafe-argument': [0],
  227. '@typescript-eslint/no-unsafe-assignment': [0],
  228. '@typescript-eslint/no-unsafe-call': [0],
  229. '@typescript-eslint/no-unsafe-declaration-merging': [2],
  230. '@typescript-eslint/no-unsafe-enum-comparison': [2],
  231. '@typescript-eslint/no-unsafe-function-type': [2],
  232. '@typescript-eslint/no-unsafe-member-access': [0],
  233. '@typescript-eslint/no-unsafe-return': [0],
  234. '@typescript-eslint/no-unsafe-unary-minus': [2],
  235. '@typescript-eslint/no-unused-expressions': [0],
  236. '@typescript-eslint/no-unused-vars': [2, {vars: 'all', args: 'all', caughtErrors: 'all', ignoreRestSiblings: false, argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_', destructuredArrayIgnorePattern: '^_'}],
  237. '@typescript-eslint/no-use-before-define': [2, {functions: false, classes: true, variables: true, allowNamedExports: true, typedefs: false, enums: false, ignoreTypeReferences: true}],
  238. '@typescript-eslint/no-useless-constructor': [0],
  239. '@typescript-eslint/no-useless-empty-export': [0],
  240. '@typescript-eslint/no-wrapper-object-types': [2],
  241. '@typescript-eslint/non-nullable-type-assertion-style': [0],
  242. '@typescript-eslint/only-throw-error': [2],
  243. '@typescript-eslint/parameter-properties': [0],
  244. '@typescript-eslint/prefer-as-const': [2],
  245. '@typescript-eslint/prefer-destructuring': [0],
  246. '@typescript-eslint/prefer-enum-initializers': [0],
  247. '@typescript-eslint/prefer-find': [2],
  248. '@typescript-eslint/prefer-for-of': [2],
  249. '@typescript-eslint/prefer-function-type': [2],
  250. '@typescript-eslint/prefer-includes': [2],
  251. '@typescript-eslint/prefer-literal-enum-member': [0],
  252. '@typescript-eslint/prefer-namespace-keyword': [0],
  253. '@typescript-eslint/prefer-nullish-coalescing': [0],
  254. '@typescript-eslint/prefer-optional-chain': [2, {requireNullish: true}],
  255. '@typescript-eslint/prefer-promise-reject-errors': [0],
  256. '@typescript-eslint/prefer-readonly': [0],
  257. '@typescript-eslint/prefer-readonly-parameter-types': [0],
  258. '@typescript-eslint/prefer-reduce-type-parameter': [0],
  259. '@typescript-eslint/prefer-regexp-exec': [0],
  260. '@typescript-eslint/prefer-return-this-type': [0],
  261. '@typescript-eslint/prefer-string-starts-ends-with': [2, {allowSingleElementEquality: 'always'}],
  262. '@typescript-eslint/promise-function-async': [0],
  263. '@typescript-eslint/require-array-sort-compare': [0],
  264. '@typescript-eslint/require-await': [0],
  265. '@typescript-eslint/restrict-plus-operands': [2],
  266. '@typescript-eslint/restrict-template-expressions': [0],
  267. '@typescript-eslint/return-await': [0],
  268. '@typescript-eslint/strict-boolean-expressions': [0],
  269. '@typescript-eslint/switch-exhaustiveness-check': [0],
  270. '@typescript-eslint/triple-slash-reference': [2],
  271. '@typescript-eslint/typedef': [0],
  272. '@typescript-eslint/unbound-method': [0], // too many false-positives
  273. '@typescript-eslint/unified-signatures': [2],
  274. 'accessor-pairs': [2],
  275. 'array-callback-return': [2, {checkForEach: true}],
  276. 'array-func/avoid-reverse': [2],
  277. 'array-func/from-map': [2],
  278. 'array-func/no-unnecessary-this-arg': [2],
  279. 'array-func/prefer-array-from': [2],
  280. 'array-func/prefer-flat-map': [0], // handled by unicorn/prefer-array-flat-map
  281. 'array-func/prefer-flat': [0], // handled by unicorn/prefer-array-flat
  282. 'arrow-body-style': [0],
  283. 'block-scoped-var': [2],
  284. 'camelcase': [0],
  285. 'capitalized-comments': [0],
  286. 'class-methods-use-this': [0],
  287. 'complexity': [0],
  288. 'consistent-return': [0],
  289. 'consistent-this': [0],
  290. 'constructor-super': [2],
  291. 'curly': [0],
  292. 'default-case-last': [2],
  293. 'default-case': [0],
  294. 'default-param-last': [0],
  295. 'dot-notation': [0],
  296. 'eqeqeq': [2],
  297. 'for-direction': [2],
  298. 'func-name-matching': [2],
  299. 'func-names': [0],
  300. 'func-style': [0],
  301. 'getter-return': [2],
  302. 'github/a11y-aria-label-is-well-formatted': [0],
  303. 'github/a11y-no-title-attribute': [0],
  304. 'github/a11y-no-visually-hidden-interactive-element': [0],
  305. 'github/a11y-role-supports-aria-props': [0],
  306. 'github/a11y-svg-has-accessible-name': [0],
  307. 'github/array-foreach': [0],
  308. 'github/async-currenttarget': [2],
  309. 'github/async-preventdefault': [0], // https://github.com/github/eslint-plugin-github/issues/599
  310. 'github/authenticity-token': [0],
  311. 'github/get-attribute': [0],
  312. 'github/js-class-name': [0],
  313. 'github/no-blur': [0],
  314. 'github/no-d-none': [0],
  315. 'github/no-dataset': [2],
  316. 'github/no-dynamic-script-tag': [2],
  317. 'github/no-implicit-buggy-globals': [2],
  318. 'github/no-inner-html': [0],
  319. 'github/no-innerText': [2],
  320. 'github/no-then': [2],
  321. 'github/no-useless-passive': [2],
  322. 'github/prefer-observers': [2],
  323. 'github/require-passive-events': [2],
  324. 'github/unescaped-html-literal': [2],
  325. 'grouped-accessor-pairs': [2],
  326. 'guard-for-in': [0],
  327. 'id-blacklist': [0],
  328. 'id-length': [0],
  329. 'id-match': [0],
  330. 'import-x/consistent-type-specifier-style': [0],
  331. 'import-x/default': [0],
  332. 'import-x/dynamic-import-chunkname': [0],
  333. 'import-x/export': [2],
  334. 'import-x/exports-last': [0],
  335. 'import-x/extensions': [2, 'always', {ignorePackages: true}],
  336. 'import-x/first': [2],
  337. 'import-x/group-exports': [0],
  338. 'import-x/max-dependencies': [0],
  339. 'import-x/named': [2],
  340. 'import-x/namespace': [0],
  341. 'import-x/newline-after-import': [0],
  342. 'import-x/no-absolute-path': [0],
  343. 'import-x/no-amd': [2],
  344. 'import-x/no-anonymous-default-export': [0],
  345. 'import-x/no-commonjs': [2],
  346. 'import-x/no-cycle': [2, {ignoreExternal: true, maxDepth: 1}],
  347. 'import-x/no-default-export': [0],
  348. 'import-x/no-deprecated': [0],
  349. 'import-x/no-dynamic-require': [0],
  350. 'import-x/no-empty-named-blocks': [2],
  351. 'import-x/no-extraneous-dependencies': [2],
  352. 'import-x/no-import-module-exports': [0],
  353. 'import-x/no-internal-modules': [0],
  354. 'import-x/no-mutable-exports': [0],
  355. 'import-x/no-named-as-default-member': [0],
  356. 'import-x/no-named-as-default': [0],
  357. 'import-x/no-named-default': [0],
  358. 'import-x/no-named-export': [0],
  359. 'import-x/no-namespace': [0],
  360. 'import-x/no-nodejs-modules': [0],
  361. 'import-x/no-relative-packages': [0],
  362. 'import-x/no-relative-parent-imports': [0],
  363. 'import-x/no-restricted-paths': [0],
  364. 'import-x/no-self-import': [2],
  365. 'import-x/no-unassigned-import': [0],
  366. 'import-x/no-unresolved': [2, {commonjs: true, ignore: ['\\?.+$']}],
  367. // 'import-x/no-unused-modules': [2, {unusedExports: true}], // not compatible with eslint 9
  368. 'import-x/no-useless-path-segments': [2, {commonjs: true}],
  369. 'import-x/no-webpack-loader-syntax': [2],
  370. 'import-x/order': [0],
  371. 'import-x/prefer-default-export': [0],
  372. 'import-x/unambiguous': [0],
  373. 'init-declarations': [0],
  374. 'line-comment-position': [0],
  375. 'logical-assignment-operators': [0],
  376. 'max-classes-per-file': [0],
  377. 'max-depth': [0],
  378. 'max-lines-per-function': [0],
  379. 'max-lines': [0],
  380. 'max-nested-callbacks': [0],
  381. 'max-params': [0],
  382. 'max-statements': [0],
  383. 'multiline-comment-style': [0],
  384. 'new-cap': [0],
  385. 'no-alert': [0],
  386. 'no-array-constructor': [0], // handled by @typescript-eslint/no-array-constructor
  387. 'no-async-promise-executor': [0],
  388. 'no-await-in-loop': [0],
  389. 'no-bitwise': [0],
  390. 'no-buffer-constructor': [0],
  391. 'no-caller': [2],
  392. 'no-case-declarations': [2],
  393. 'no-class-assign': [2],
  394. 'no-compare-neg-zero': [2],
  395. 'no-cond-assign': [2, 'except-parens'],
  396. 'no-console': [1, {allow: ['debug', 'info', 'warn', 'error']}],
  397. 'no-const-assign': [2],
  398. 'no-constant-binary-expression': [2],
  399. 'no-constant-condition': [0],
  400. 'no-constructor-return': [2],
  401. 'no-continue': [0],
  402. 'no-control-regex': [0],
  403. 'no-debugger': [1],
  404. 'no-delete-var': [2],
  405. 'no-div-regex': [0],
  406. 'no-dupe-args': [2],
  407. 'no-dupe-class-members': [2],
  408. 'no-dupe-else-if': [2],
  409. 'no-dupe-keys': [2],
  410. 'no-duplicate-case': [2],
  411. 'no-duplicate-imports': [0],
  412. 'no-else-return': [2],
  413. 'no-empty-character-class': [2],
  414. 'no-empty-function': [0],
  415. 'no-empty-pattern': [2],
  416. 'no-empty-static-block': [2],
  417. 'no-empty': [2, {allowEmptyCatch: true}],
  418. 'no-eq-null': [2],
  419. 'no-eval': [2],
  420. 'no-ex-assign': [2],
  421. 'no-extend-native': [2],
  422. 'no-extra-bind': [2],
  423. 'no-extra-boolean-cast': [2],
  424. 'no-extra-label': [0],
  425. 'no-fallthrough': [2],
  426. 'no-func-assign': [2],
  427. 'no-global-assign': [2],
  428. 'no-implicit-coercion': [2],
  429. 'no-implicit-globals': [0],
  430. 'no-implied-eval': [0], // handled by @typescript-eslint/no-implied-eval
  431. 'no-import-assign': [2],
  432. 'no-inline-comments': [0],
  433. 'no-inner-declarations': [2],
  434. 'no-invalid-regexp': [2],
  435. 'no-invalid-this': [0],
  436. 'no-irregular-whitespace': [2],
  437. 'no-iterator': [2],
  438. // 'no-jquery/no-ajax-events': [2],
  439. // 'no-jquery/no-ajax': [2],
  440. // 'no-jquery/no-and-self': [2],
  441. // 'no-jquery/no-animate-toggle': [2],
  442. // 'no-jquery/no-animate': [2],
  443. // 'no-jquery/no-append-html': [2],
  444. // 'no-jquery/no-attr': [2],
  445. // 'no-jquery/no-bind': [2],
  446. // 'no-jquery/no-box-model': [2],
  447. // 'no-jquery/no-browser': [2],
  448. // 'no-jquery/no-camel-case': [2],
  449. // 'no-jquery/no-class-state': [2],
  450. // 'no-jquery/no-class': [0],
  451. // 'no-jquery/no-clone': [2],
  452. // 'no-jquery/no-closest': [0],
  453. // 'no-jquery/no-constructor-attributes': [2],
  454. // 'no-jquery/no-contains': [2],
  455. // 'no-jquery/no-context-prop': [2],
  456. // 'no-jquery/no-css': [2],
  457. // 'no-jquery/no-data': [0],
  458. // 'no-jquery/no-deferred': [2],
  459. // 'no-jquery/no-delegate': [2],
  460. // 'no-jquery/no-done-fail': [2],
  461. // 'no-jquery/no-each-collection': [0],
  462. // 'no-jquery/no-each-util': [0],
  463. // 'no-jquery/no-each': [0],
  464. // 'no-jquery/no-error-shorthand': [2],
  465. // 'no-jquery/no-error': [2],
  466. // 'no-jquery/no-escape-selector': [2],
  467. // 'no-jquery/no-event-shorthand': [2],
  468. // 'no-jquery/no-extend': [2],
  469. // 'no-jquery/no-fade': [2],
  470. // 'no-jquery/no-filter': [0],
  471. // 'no-jquery/no-find-collection': [0],
  472. // 'no-jquery/no-find-util': [2],
  473. // 'no-jquery/no-find': [0],
  474. // 'no-jquery/no-fx-interval': [2],
  475. // 'no-jquery/no-fx': [2],
  476. // 'no-jquery/no-global-eval': [2],
  477. // 'no-jquery/no-global-selector': [0],
  478. // 'no-jquery/no-grep': [2],
  479. // 'no-jquery/no-has': [2],
  480. // 'no-jquery/no-hold-ready': [2],
  481. // 'no-jquery/no-html': [0],
  482. // 'no-jquery/no-in-array': [2],
  483. // 'no-jquery/no-is-array': [2],
  484. // 'no-jquery/no-is-empty-object': [2],
  485. // 'no-jquery/no-is-function': [2],
  486. // 'no-jquery/no-is-numeric': [2],
  487. // 'no-jquery/no-is-plain-object': [2],
  488. // 'no-jquery/no-is-window': [2],
  489. // 'no-jquery/no-is': [2],
  490. // 'no-jquery/no-jquery-constructor': [0],
  491. // 'no-jquery/no-live': [2],
  492. // 'no-jquery/no-load-shorthand': [2],
  493. // 'no-jquery/no-load': [2],
  494. // 'no-jquery/no-map-collection': [0],
  495. // 'no-jquery/no-map-util': [2],
  496. // 'no-jquery/no-map': [2],
  497. // 'no-jquery/no-merge': [2],
  498. // 'no-jquery/no-node-name': [2],
  499. // 'no-jquery/no-noop': [2],
  500. // 'no-jquery/no-now': [2],
  501. // 'no-jquery/no-on-ready': [2],
  502. // 'no-jquery/no-other-methods': [0],
  503. // 'no-jquery/no-other-utils': [2],
  504. // 'no-jquery/no-param': [2],
  505. // 'no-jquery/no-parent': [0],
  506. // 'no-jquery/no-parents': [2],
  507. // 'no-jquery/no-parse-html-literal': [2],
  508. // 'no-jquery/no-parse-html': [2],
  509. // 'no-jquery/no-parse-json': [2],
  510. // 'no-jquery/no-parse-xml': [2],
  511. // 'no-jquery/no-prop': [2],
  512. // 'no-jquery/no-proxy': [2],
  513. // 'no-jquery/no-ready-shorthand': [2],
  514. // 'no-jquery/no-ready': [2],
  515. // 'no-jquery/no-selector-prop': [2],
  516. // 'no-jquery/no-serialize': [2],
  517. // 'no-jquery/no-size': [2],
  518. // 'no-jquery/no-sizzle': [2],
  519. // 'no-jquery/no-slide': [2],
  520. // 'no-jquery/no-sub': [2],
  521. // 'no-jquery/no-support': [2],
  522. // 'no-jquery/no-text': [2],
  523. // 'no-jquery/no-trigger': [0],
  524. // 'no-jquery/no-trim': [2],
  525. // 'no-jquery/no-type': [2],
  526. // 'no-jquery/no-unique': [2],
  527. // 'no-jquery/no-unload-shorthand': [2],
  528. // 'no-jquery/no-val': [0],
  529. // 'no-jquery/no-visibility': [2],
  530. // 'no-jquery/no-when': [2],
  531. // 'no-jquery/no-wrap': [2],
  532. // 'no-jquery/variable-pattern': [2],
  533. 'no-label-var': [2],
  534. 'no-labels': [0], // handled by no-restricted-syntax
  535. 'no-lone-blocks': [2],
  536. 'no-lonely-if': [0],
  537. 'no-loop-func': [0],
  538. 'no-loss-of-precision': [2],
  539. 'no-magic-numbers': [0],
  540. 'no-misleading-character-class': [2],
  541. 'no-multi-assign': [0],
  542. 'no-multi-str': [2],
  543. 'no-negated-condition': [0],
  544. 'no-nested-ternary': [0],
  545. 'no-new-func': [0], // handled by @typescript-eslint/no-implied-eval
  546. 'no-new-native-nonconstructor': [2],
  547. 'no-new-object': [2],
  548. 'no-new-symbol': [2],
  549. 'no-new-wrappers': [2],
  550. 'no-new': [0],
  551. 'no-nonoctal-decimal-escape': [2],
  552. 'no-obj-calls': [2],
  553. 'no-octal-escape': [2],
  554. 'no-octal': [2],
  555. 'no-param-reassign': [0],
  556. 'no-plusplus': [0],
  557. 'no-promise-executor-return': [0],
  558. 'no-proto': [2],
  559. 'no-prototype-builtins': [2],
  560. 'no-redeclare': [0], // must be disabled for typescript overloads
  561. 'no-regex-spaces': [2],
  562. 'no-restricted-exports': [0],
  563. 'no-restricted-globals': [2, 'addEventListener', 'blur', 'close', 'closed', 'confirm', 'defaultStatus', 'defaultstatus', 'error', 'event', 'external', 'find', 'focus', 'frameElement', 'frames', 'history', 'innerHeight', 'innerWidth', 'isFinite', 'isNaN', 'length', 'locationbar', 'menubar', 'moveBy', 'moveTo', 'name', 'onblur', 'onerror', 'onfocus', 'onload', 'onresize', 'onunload', 'open', 'opener', 'opera', 'outerHeight', 'outerWidth', 'pageXOffset', 'pageYOffset', 'parent', 'print', 'removeEventListener', 'resizeBy', 'resizeTo', 'screen', 'screenLeft', 'screenTop', 'screenX', 'screenY', 'scroll', 'scrollbars', 'scrollBy', 'scrollTo', 'scrollX', 'scrollY', 'status', 'statusbar', 'stop', 'toolbar', 'top'],
  564. 'no-restricted-imports': [0],
  565. 'no-restricted-syntax': [2, ...restrictedSyntax, {selector: 'CallExpression[callee.name="fetch"]', message: 'use modules/fetch.ts instead'}],
  566. 'no-return-assign': [0],
  567. 'no-script-url': [2],
  568. 'no-self-assign': [2, {props: true}],
  569. 'no-self-compare': [2],
  570. 'no-sequences': [2],
  571. 'no-setter-return': [2],
  572. 'no-shadow-restricted-names': [2],
  573. 'no-shadow': [0],
  574. 'no-sparse-arrays': [2],
  575. 'no-template-curly-in-string': [2],
  576. 'no-ternary': [0],
  577. 'no-this-before-super': [2],
  578. 'no-throw-literal': [2],
  579. 'no-undef-init': [2],
  580. 'no-undef': [2], // it is still needed by eslint & IDE to prompt undefined names in real time
  581. 'no-undefined': [0],
  582. 'no-underscore-dangle': [0],
  583. 'no-unexpected-multiline': [2],
  584. 'no-unmodified-loop-condition': [2],
  585. 'no-unneeded-ternary': [2],
  586. 'no-unreachable-loop': [2],
  587. 'no-unreachable': [2],
  588. 'no-unsafe-finally': [2],
  589. 'no-unsafe-negation': [2],
  590. 'no-unused-expressions': [2],
  591. 'no-unused-labels': [2],
  592. 'no-unused-private-class-members': [2],
  593. 'no-unused-vars': [0], // handled by @typescript-eslint/no-unused-vars
  594. 'no-use-before-define': [0], // handled by @typescript-eslint/no-use-before-define
  595. 'no-use-extend-native/no-use-extend-native': [2],
  596. 'no-useless-backreference': [2],
  597. 'no-useless-call': [2],
  598. 'no-useless-catch': [2],
  599. 'no-useless-computed-key': [2],
  600. 'no-useless-concat': [2],
  601. 'no-useless-constructor': [2],
  602. 'no-useless-escape': [2],
  603. 'no-useless-rename': [2],
  604. 'no-useless-return': [2],
  605. 'no-var': [2],
  606. 'no-void': [2],
  607. 'no-warning-comments': [0],
  608. 'no-with': [0], // handled by no-restricted-syntax
  609. 'object-shorthand': [2, 'always'],
  610. 'one-var-declaration-per-line': [0],
  611. 'one-var': [0],
  612. 'operator-assignment': [2, 'always'],
  613. 'operator-linebreak': [2, 'after'],
  614. 'prefer-arrow-callback': [2, {allowNamedFunctions: true, allowUnboundThis: true}],
  615. 'prefer-const': [2, {destructuring: 'all', ignoreReadBeforeAssign: true}],
  616. 'prefer-destructuring': [0],
  617. 'prefer-exponentiation-operator': [2],
  618. 'prefer-named-capture-group': [0],
  619. 'prefer-numeric-literals': [2],
  620. 'prefer-object-has-own': [2],
  621. 'prefer-object-spread': [2],
  622. 'prefer-promise-reject-errors': [2, {allowEmptyReject: false}],
  623. 'prefer-regex-literals': [2],
  624. 'prefer-rest-params': [2],
  625. 'prefer-spread': [2],
  626. 'prefer-template': [2],
  627. 'radix': [2, 'as-needed'],
  628. 'regexp/confusing-quantifier': [2],
  629. 'regexp/control-character-escape': [2],
  630. 'regexp/hexadecimal-escape': [0],
  631. 'regexp/letter-case': [0],
  632. 'regexp/match-any': [2],
  633. 'regexp/negation': [2],
  634. 'regexp/no-contradiction-with-assertion': [0],
  635. 'regexp/no-control-character': [0],
  636. 'regexp/no-dupe-characters-character-class': [2],
  637. 'regexp/no-dupe-disjunctions': [2],
  638. 'regexp/no-empty-alternative': [2],
  639. 'regexp/no-empty-capturing-group': [2],
  640. 'regexp/no-empty-character-class': [0],
  641. 'regexp/no-empty-group': [2],
  642. 'regexp/no-empty-lookarounds-assertion': [2],
  643. 'regexp/no-empty-string-literal': [2],
  644. 'regexp/no-escape-backspace': [2],
  645. 'regexp/no-extra-lookaround-assertions': [0],
  646. 'regexp/no-invalid-regexp': [2],
  647. 'regexp/no-invisible-character': [2],
  648. 'regexp/no-lazy-ends': [2],
  649. 'regexp/no-legacy-features': [2],
  650. 'regexp/no-misleading-capturing-group': [0],
  651. 'regexp/no-misleading-unicode-character': [0],
  652. 'regexp/no-missing-g-flag': [2],
  653. 'regexp/no-non-standard-flag': [2],
  654. 'regexp/no-obscure-range': [2],
  655. 'regexp/no-octal': [2],
  656. 'regexp/no-optional-assertion': [2],
  657. 'regexp/no-potentially-useless-backreference': [2],
  658. 'regexp/no-standalone-backslash': [2],
  659. 'regexp/no-super-linear-backtracking': [0],
  660. 'regexp/no-super-linear-move': [0],
  661. 'regexp/no-trivially-nested-assertion': [2],
  662. 'regexp/no-trivially-nested-quantifier': [2],
  663. 'regexp/no-unused-capturing-group': [0],
  664. 'regexp/no-useless-assertions': [2],
  665. 'regexp/no-useless-backreference': [2],
  666. 'regexp/no-useless-character-class': [2],
  667. 'regexp/no-useless-dollar-replacements': [2],
  668. 'regexp/no-useless-escape': [2],
  669. 'regexp/no-useless-flag': [2],
  670. 'regexp/no-useless-lazy': [2],
  671. 'regexp/no-useless-non-capturing-group': [2],
  672. 'regexp/no-useless-quantifier': [2],
  673. 'regexp/no-useless-range': [2],
  674. 'regexp/no-useless-set-operand': [2],
  675. 'regexp/no-useless-string-literal': [2],
  676. 'regexp/no-useless-two-nums-quantifier': [2],
  677. 'regexp/no-zero-quantifier': [2],
  678. 'regexp/optimal-lookaround-quantifier': [2],
  679. 'regexp/optimal-quantifier-concatenation': [0],
  680. 'regexp/prefer-character-class': [0],
  681. 'regexp/prefer-d': [0],
  682. 'regexp/prefer-escape-replacement-dollar-char': [0],
  683. 'regexp/prefer-lookaround': [0],
  684. 'regexp/prefer-named-backreference': [0],
  685. 'regexp/prefer-named-capture-group': [0],
  686. 'regexp/prefer-named-replacement': [0],
  687. 'regexp/prefer-plus-quantifier': [2],
  688. 'regexp/prefer-predefined-assertion': [2],
  689. 'regexp/prefer-quantifier': [0],
  690. 'regexp/prefer-question-quantifier': [2],
  691. 'regexp/prefer-range': [2],
  692. 'regexp/prefer-regexp-exec': [2],
  693. 'regexp/prefer-regexp-test': [2],
  694. 'regexp/prefer-result-array-groups': [0],
  695. 'regexp/prefer-set-operation': [2],
  696. 'regexp/prefer-star-quantifier': [2],
  697. 'regexp/prefer-unicode-codepoint-escapes': [2],
  698. 'regexp/prefer-w': [0],
  699. 'regexp/require-unicode-regexp': [0],
  700. 'regexp/simplify-set-operations': [2],
  701. 'regexp/sort-alternatives': [0],
  702. 'regexp/sort-character-class-elements': [0],
  703. 'regexp/sort-flags': [0],
  704. 'regexp/strict': [2],
  705. 'regexp/unicode-escape': [0],
  706. 'regexp/use-ignore-case': [0],
  707. 'require-atomic-updates': [0],
  708. 'require-await': [0], // handled by @typescript-eslint/require-await
  709. 'require-unicode-regexp': [0],
  710. 'require-yield': [2],
  711. 'sonarjs/cognitive-complexity': [0],
  712. 'sonarjs/elseif-without-else': [0],
  713. 'sonarjs/max-switch-cases': [0],
  714. 'sonarjs/no-all-duplicated-branches': [2],
  715. 'sonarjs/no-collapsible-if': [0],
  716. 'sonarjs/no-collection-size-mischeck': [2],
  717. 'sonarjs/no-duplicate-string': [0],
  718. 'sonarjs/no-duplicated-branches': [0],
  719. 'sonarjs/no-element-overwrite': [2],
  720. 'sonarjs/no-empty-collection': [2],
  721. 'sonarjs/no-extra-arguments': [2],
  722. 'sonarjs/no-gratuitous-expressions': [2],
  723. 'sonarjs/no-identical-conditions': [2],
  724. 'sonarjs/no-identical-expressions': [2],
  725. 'sonarjs/no-identical-functions': [2, 5],
  726. 'sonarjs/no-ignored-return': [2],
  727. 'sonarjs/no-inverted-boolean-check': [2],
  728. 'sonarjs/no-nested-switch': [0],
  729. 'sonarjs/no-nested-template-literals': [0],
  730. 'sonarjs/no-redundant-boolean': [2],
  731. 'sonarjs/no-redundant-jump': [2],
  732. 'sonarjs/no-same-line-conditional': [2],
  733. 'sonarjs/no-small-switch': [0],
  734. 'sonarjs/no-unused-collection': [2],
  735. 'sonarjs/no-use-of-empty-return-value': [2],
  736. 'sonarjs/no-useless-catch': [2],
  737. 'sonarjs/non-existent-operator': [2],
  738. 'sonarjs/prefer-immediate-return': [0],
  739. 'sonarjs/prefer-object-literal': [0],
  740. 'sonarjs/prefer-single-boolean-return': [0],
  741. 'sonarjs/prefer-while': [2],
  742. 'sort-imports': [0],
  743. 'sort-keys': [0],
  744. 'sort-vars': [0],
  745. 'strict': [0],
  746. 'symbol-description': [2],
  747. 'unicode-bom': [2, 'never'],
  748. 'unicorn/better-regex': [0],
  749. 'unicorn/catch-error-name': [0],
  750. 'unicorn/consistent-destructuring': [2],
  751. 'unicorn/consistent-empty-array-spread': [2],
  752. 'unicorn/consistent-existence-index-check': [0],
  753. 'unicorn/consistent-function-scoping': [0],
  754. 'unicorn/custom-error-definition': [0],
  755. 'unicorn/empty-brace-spaces': [2],
  756. 'unicorn/error-message': [0],
  757. 'unicorn/escape-case': [0],
  758. 'unicorn/expiring-todo-comments': [0],
  759. 'unicorn/explicit-length-check': [0],
  760. 'unicorn/filename-case': [0],
  761. 'unicorn/import-index': [0],
  762. 'unicorn/import-style': [0],
  763. 'unicorn/new-for-builtins': [2],
  764. 'unicorn/no-abusive-eslint-disable': [0],
  765. 'unicorn/no-anonymous-default-export': [0],
  766. 'unicorn/no-array-callback-reference': [0],
  767. 'unicorn/no-array-for-each': [2],
  768. 'unicorn/no-array-method-this-argument': [2],
  769. 'unicorn/no-array-push-push': [2],
  770. 'unicorn/no-array-reduce': [2],
  771. 'unicorn/no-await-expression-member': [0],
  772. 'unicorn/no-await-in-promise-methods': [2],
  773. 'unicorn/no-console-spaces': [0],
  774. 'unicorn/no-document-cookie': [2],
  775. 'unicorn/no-empty-file': [2],
  776. 'unicorn/no-for-loop': [0],
  777. 'unicorn/no-hex-escape': [0],
  778. 'unicorn/no-instanceof-array': [0],
  779. 'unicorn/no-invalid-fetch-options': [2],
  780. 'unicorn/no-invalid-remove-event-listener': [2],
  781. 'unicorn/no-keyword-prefix': [0],
  782. 'unicorn/no-length-as-slice-end': [2],
  783. 'unicorn/no-lonely-if': [2],
  784. 'unicorn/no-magic-array-flat-depth': [0],
  785. 'unicorn/no-negated-condition': [0],
  786. 'unicorn/no-negation-in-equality-check': [2],
  787. 'unicorn/no-nested-ternary': [0],
  788. 'unicorn/no-new-array': [0],
  789. 'unicorn/no-new-buffer': [0],
  790. 'unicorn/no-null': [0],
  791. 'unicorn/no-object-as-default-parameter': [0],
  792. 'unicorn/no-process-exit': [0],
  793. 'unicorn/no-single-promise-in-promise-methods': [2],
  794. 'unicorn/no-static-only-class': [2],
  795. 'unicorn/no-thenable': [2],
  796. 'unicorn/no-this-assignment': [2],
  797. 'unicorn/no-typeof-undefined': [2],
  798. 'unicorn/no-unnecessary-await': [2],
  799. 'unicorn/no-unnecessary-polyfills': [2],
  800. 'unicorn/no-unreadable-array-destructuring': [0],
  801. 'unicorn/no-unreadable-iife': [2],
  802. 'unicorn/no-unused-properties': [2],
  803. 'unicorn/no-useless-fallback-in-spread': [2],
  804. 'unicorn/no-useless-length-check': [2],
  805. 'unicorn/no-useless-promise-resolve-reject': [2],
  806. 'unicorn/no-useless-spread': [2],
  807. 'unicorn/no-useless-switch-case': [2],
  808. 'unicorn/no-useless-undefined': [0],
  809. 'unicorn/no-zero-fractions': [2],
  810. 'unicorn/number-literal-case': [0],
  811. 'unicorn/numeric-separators-style': [0],
  812. 'unicorn/prefer-add-event-listener': [2],
  813. 'unicorn/prefer-array-find': [2],
  814. 'unicorn/prefer-array-flat-map': [2],
  815. 'unicorn/prefer-array-flat': [2],
  816. 'unicorn/prefer-array-index-of': [2],
  817. 'unicorn/prefer-array-some': [2],
  818. 'unicorn/prefer-at': [0],
  819. 'unicorn/prefer-blob-reading-methods': [2],
  820. 'unicorn/prefer-code-point': [0],
  821. 'unicorn/prefer-date-now': [2],
  822. 'unicorn/prefer-default-parameters': [0],
  823. 'unicorn/prefer-dom-node-append': [2],
  824. 'unicorn/prefer-dom-node-dataset': [0],
  825. 'unicorn/prefer-dom-node-remove': [2],
  826. 'unicorn/prefer-dom-node-text-content': [2],
  827. 'unicorn/prefer-event-target': [2],
  828. 'unicorn/prefer-export-from': [0],
  829. 'unicorn/prefer-global-this': [0],
  830. 'unicorn/prefer-includes': [2],
  831. 'unicorn/prefer-json-parse-buffer': [0],
  832. 'unicorn/prefer-keyboard-event-key': [2],
  833. 'unicorn/prefer-logical-operator-over-ternary': [2],
  834. 'unicorn/prefer-math-min-max': [2],
  835. 'unicorn/prefer-math-trunc': [2],
  836. 'unicorn/prefer-modern-dom-apis': [0],
  837. 'unicorn/prefer-modern-math-apis': [2],
  838. 'unicorn/prefer-module': [2],
  839. 'unicorn/prefer-native-coercion-functions': [2],
  840. 'unicorn/prefer-negative-index': [2],
  841. 'unicorn/prefer-node-protocol': [2],
  842. 'unicorn/prefer-number-properties': [0],
  843. 'unicorn/prefer-object-from-entries': [2],
  844. 'unicorn/prefer-object-has-own': [0],
  845. 'unicorn/prefer-optional-catch-binding': [2],
  846. 'unicorn/prefer-prototype-methods': [0],
  847. 'unicorn/prefer-query-selector': [2],
  848. 'unicorn/prefer-reflect-apply': [0],
  849. 'unicorn/prefer-regexp-test': [2],
  850. 'unicorn/prefer-set-has': [0],
  851. 'unicorn/prefer-set-size': [2],
  852. 'unicorn/prefer-spread': [0],
  853. 'unicorn/prefer-string-raw': [0],
  854. 'unicorn/prefer-string-replace-all': [0],
  855. 'unicorn/prefer-string-slice': [0],
  856. 'unicorn/prefer-string-starts-ends-with': [2],
  857. 'unicorn/prefer-string-trim-start-end': [2],
  858. 'unicorn/prefer-structured-clone': [2],
  859. 'unicorn/prefer-switch': [0],
  860. 'unicorn/prefer-ternary': [0],
  861. 'unicorn/prefer-top-level-await': [0],
  862. 'unicorn/prefer-type-error': [0],
  863. 'unicorn/prevent-abbreviations': [0],
  864. 'unicorn/relative-url-style': [2],
  865. 'unicorn/require-array-join-separator': [2],
  866. 'unicorn/require-number-to-fixed-digits-argument': [2],
  867. 'unicorn/require-post-message-target-origin': [0],
  868. 'unicorn/string-content': [0],
  869. 'unicorn/switch-case-braces': [0],
  870. 'unicorn/template-indent': [2],
  871. 'unicorn/text-encoding-identifier-case': [0],
  872. 'unicorn/throw-new-error': [2],
  873. 'use-isnan': [2],
  874. 'valid-typeof': [2, {requireStringLiterals: true}],
  875. 'vars-on-top': [0],
  876. 'wc/attach-shadow-constructor': [2],
  877. 'wc/define-tag-after-class-definition': [0],
  878. 'wc/expose-class-on-global': [0],
  879. 'wc/file-name-matches-element': [2],
  880. 'wc/guard-define-call': [0],
  881. 'wc/guard-super-call': [2],
  882. 'wc/max-elements-per-file': [0],
  883. 'wc/no-child-traversal-in-attributechangedcallback': [2],
  884. 'wc/no-child-traversal-in-connectedcallback': [2],
  885. 'wc/no-closed-shadow-root': [2],
  886. 'wc/no-constructor-attributes': [2],
  887. 'wc/no-constructor-params': [2],
  888. 'wc/no-constructor': [2],
  889. 'wc/no-customized-built-in-elements': [2],
  890. 'wc/no-exports-with-element': [0],
  891. 'wc/no-invalid-element-name': [2],
  892. 'wc/no-invalid-extends': [2],
  893. 'wc/no-method-prefixed-with-on': [2],
  894. 'wc/no-self-class': [2],
  895. 'wc/no-typos': [2],
  896. 'wc/require-listener-teardown': [2],
  897. 'wc/tag-name-matches-class': [2],
  898. 'yoda': [2, 'never'],
  899. },
  900. },
  901. // @ts-expect-error
  902. {
  903. ...playwright.configs['flat/recommended'],
  904. files: ['tests/e2e/**'],
  905. rules: {
  906. ...playwright.configs['flat/recommended'].rules,
  907. },
  908. },
  909. {
  910. files: ['**/*.vue'],
  911. languageOptions: {
  912. parserOptions: {
  913. parser: '@typescript-eslint/parser',
  914. },
  915. },
  916. extends: [
  917. // @ts-expect-error
  918. vue.configs['flat/recommended'],
  919. // @ts-expect-error
  920. vueScopedCss.configs['flat/recommended'],
  921. ],
  922. rules: {
  923. 'vue/attributes-order': [0],
  924. 'vue/html-closing-bracket-spacing': [2, {startTag: 'never', endTag: 'never', selfClosingTag: 'never'}],
  925. 'vue/max-attributes-per-line': [0],
  926. 'vue/singleline-html-element-content-newline': [0],
  927. },
  928. },
  929. {
  930. files: ['web_src/js/modules/fetch.ts', 'web_src/js/standalone/**/*'],
  931. rules: {
  932. 'no-restricted-syntax': [2, ...restrictedSyntax],
  933. },
  934. },
  935. {
  936. files: ['**/*.test.ts', 'web_src/js/test/setup.ts'],
  937. // @ts-expect-error - https://github.com/vitest-dev/eslint-plugin-vitest/issues/737
  938. plugins: {vitest},
  939. languageOptions: {globals: globals.vitest},
  940. rules: {
  941. 'github/unescaped-html-literal': [0],
  942. 'vitest/consistent-test-filename': [0],
  943. 'vitest/consistent-test-it': [0],
  944. 'vitest/expect-expect': [0],
  945. 'vitest/max-expects': [0],
  946. 'vitest/max-nested-describe': [0],
  947. 'vitest/no-alias-methods': [0],
  948. 'vitest/no-commented-out-tests': [0],
  949. 'vitest/no-conditional-expect': [0],
  950. 'vitest/no-conditional-in-test': [0],
  951. 'vitest/no-conditional-tests': [0],
  952. 'vitest/no-disabled-tests': [0],
  953. 'vitest/no-done-callback': [0],
  954. 'vitest/no-duplicate-hooks': [0],
  955. 'vitest/no-focused-tests': [2],
  956. 'vitest/no-hooks': [0],
  957. 'vitest/no-identical-title': [2],
  958. 'vitest/no-interpolation-in-snapshots': [0],
  959. 'vitest/no-large-snapshots': [0],
  960. 'vitest/no-mocks-import': [0],
  961. 'vitest/no-restricted-matchers': [0],
  962. 'vitest/no-restricted-vi-methods': [0],
  963. 'vitest/no-standalone-expect': [0],
  964. 'vitest/no-test-prefixes': [0],
  965. 'vitest/no-test-return-statement': [0],
  966. 'vitest/prefer-called-with': [0],
  967. 'vitest/prefer-comparison-matcher': [0],
  968. 'vitest/prefer-each': [0],
  969. 'vitest/prefer-equality-matcher': [0],
  970. 'vitest/prefer-expect-resolves': [0],
  971. 'vitest/prefer-hooks-in-order': [0],
  972. 'vitest/prefer-hooks-on-top': [2],
  973. 'vitest/prefer-lowercase-title': [0],
  974. 'vitest/prefer-mock-promise-shorthand': [0],
  975. 'vitest/prefer-snapshot-hint': [0],
  976. 'vitest/prefer-spy-on': [0],
  977. 'vitest/prefer-strict-equal': [0],
  978. 'vitest/prefer-to-be': [0],
  979. 'vitest/prefer-to-be-falsy': [0],
  980. 'vitest/prefer-to-be-object': [0],
  981. 'vitest/prefer-to-be-truthy': [0],
  982. 'vitest/prefer-to-contain': [0],
  983. 'vitest/prefer-to-have-length': [0],
  984. 'vitest/prefer-todo': [0],
  985. 'vitest/require-hook': [0],
  986. 'vitest/require-to-throw-message': [0],
  987. 'vitest/require-top-level-describe': [0],
  988. 'vitest/valid-describe-callback': [2],
  989. 'vitest/valid-expect': [2],
  990. 'vitest/valid-title': [2],
  991. },
  992. },
  993. {
  994. files: ['web_src/js/types.ts'],
  995. rules: {
  996. 'import-x/no-unused-modules': [0],
  997. },
  998. },
  999. {
  1000. files: ['**/*.d.ts'],
  1001. rules: {
  1002. 'import-x/no-unused-modules': [0],
  1003. '@typescript-eslint/consistent-type-definitions': [0],
  1004. '@typescript-eslint/consistent-type-imports': [0],
  1005. },
  1006. },
  1007. {
  1008. files: ['*.config.*'],
  1009. rules: {
  1010. 'import-x/no-unused-modules': [0],
  1011. },
  1012. },
  1013. {
  1014. files: ['web_src/**/*', 'docs/**/*'],
  1015. languageOptions: {globals: globals.browser},
  1016. },
  1017. {
  1018. files: ['web_src/**/*'],
  1019. languageOptions: {
  1020. globals: {
  1021. ...globals.browser,
  1022. __webpack_public_path__: true,
  1023. process: false, // https://github.com/webpack/webpack/issues/15833
  1024. },
  1025. },
  1026. },
  1027. ]);