linter-bundle 6.3.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/.linter-bundle.js +27 -17
  2. package/.linter-bundle.schema.json +45 -0
  3. package/CHANGELOG.md +125 -3
  4. package/README.md +51 -63
  5. package/eslint/gatsby.mjs +95 -0
  6. package/eslint/index.mjs +1127 -0
  7. package/eslint/javascript-lazy.mjs +24 -0
  8. package/eslint/javascript.mjs +126 -0
  9. package/eslint/jest.mjs +172 -0
  10. package/eslint/jsdoc.mjs +103 -0
  11. package/eslint/react.mjs +232 -0
  12. package/eslint/rules/no-unnecessary-typeof.md +1 -1
  13. package/eslint/rules/{no-unnecessary-typeof.js → no-unnecessary-typeof.mjs} +9 -11
  14. package/eslint/rules/restricted-filenames.md +4 -4
  15. package/eslint/rules/{restricted-filenames.js → restricted-filenames.mjs} +7 -6
  16. package/eslint/storybook.mjs +42 -0
  17. package/eslint/type-declarations.mjs +49 -0
  18. package/eslint/{overrides-worker.cjs → worker.mjs} +12 -14
  19. package/eslint.mjs +5 -0
  20. package/files/index.js +3 -3
  21. package/helper/{ensure-type.cjs → ensure-type.mjs} +1 -5
  22. package/helper/get-outdated-dependencies.js +4 -4
  23. package/helper/get-outdated-overrides.js +2 -2
  24. package/helper/get-stylelint-path.js +4 -3
  25. package/helper/is-npm-or-yarn.js +2 -2
  26. package/helper/linter-bundle-config.js +9 -14
  27. package/helper/run-process.js +1 -1
  28. package/lint.js +21 -16
  29. package/package.json +31 -29
  30. package/stylelint/index.mjs +1111 -0
  31. package/stylelint/plugins/stylelint-15.11.0-stylistic/html-tags/{index.cjs → index.mjs} +1 -1
  32. package/stylelint/plugins/stylelint-15.11.0-stylistic/reference/{selectors.cjs → selectors.mjs} +15 -31
  33. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-case/{index.cjs → index.mjs} +6 -12
  34. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-space-after/{index.cjs → index.mjs} +11 -13
  35. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-newline-after/{index.cjs → index.mjs} +18 -22
  36. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-space-before/{index.cjs → index.mjs} +10 -9
  37. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{atRuleNameSpaceChecker.cjs → atRuleNameSpaceChecker.mjs} +4 -3
  38. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-empty-line-before/{index.cjs → index.mjs} +16 -30
  39. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-after/{index.cjs → index.mjs} +13 -35
  40. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-before/{index.cjs → index.mjs} +11 -40
  41. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-space-before/{index.cjs → index.mjs} +10 -27
  42. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-newline-after/{index.cjs → index.mjs} +14 -65
  43. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-after/{index.cjs → index.mjs} +13 -30
  44. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-before/{index.cjs → index.mjs} +14 -27
  45. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/color-hex-case/{index.cjs → index.mjs} +10 -16
  46. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.mjs +93 -0
  47. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-before/{index.cjs → index.mjs} +11 -12
  48. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-after/{index.cjs → index.mjs} +11 -29
  49. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-before/{index.cjs → index.mjs} +9 -8
  50. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-after/{index.cjs → index.mjs} +10 -23
  51. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-before/{index.cjs → index.mjs} +11 -36
  52. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-trailing-semicolon/{index.cjs → index.mjs} +9 -27
  53. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-newline-after/{index.cjs → index.mjs} +9 -25
  54. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-after/{index.cjs → index.mjs} +8 -9
  55. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-before/{index.cjs → index.mjs} +8 -9
  56. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{declarationBangSpaceChecker.cjs → declarationBangSpaceChecker.mjs} +5 -4
  57. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{declarationColonSpaceChecker.cjs → declarationColonSpaceChecker.mjs} +5 -4
  58. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{findMediaOperator.cjs → findMediaOperator.mjs} +2 -2
  59. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/{index.cjs → index.mjs} +8 -9
  60. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/{index.cjs → index.mjs} +8 -9
  61. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-after/{index.cjs → index.mjs} +8 -9
  62. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-before/{index.cjs → index.mjs} +8 -9
  63. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-max-empty-lines/{index.cjs → index.mjs} +19 -39
  64. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-newline-inside/{index.cjs → index.mjs} +19 -54
  65. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-space-inside/{index.cjs → index.mjs} +21 -68
  66. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/{index.cjs → index.mjs} +16 -31
  67. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{functionCommaSpaceChecker.cjs → functionCommaSpaceChecker.mjs} +8 -7
  68. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{functionCommaSpaceFix.cjs → functionCommaSpaceFix.mjs} +1 -1
  69. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/indentation/{index.cjs → index.mjs} +39 -64
  70. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/{index.cjs → index.mjs} +15 -44
  71. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-empty-lines/{index.cjs → index.mjs} +10 -49
  72. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-line-length/{index.cjs → index.mjs} +10 -9
  73. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-after/{index.cjs → index.mjs} +8 -9
  74. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-before/{index.cjs → index.mjs} +8 -9
  75. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-name-case/{index.cjs → index.mjs} +9 -16
  76. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-parentheses-space-inside/{index.cjs → index.mjs} +8 -21
  77. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-after/{index.cjs → index.mjs} +10 -11
  78. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-before/{index.cjs → index.mjs} +10 -11
  79. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-after/{index.cjs → index.mjs} +8 -9
  80. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-before/{index.cjs → index.mjs} +6 -6
  81. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-after/{index.cjs → index.mjs} +8 -9
  82. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-before/{index.cjs → index.mjs} +8 -9
  83. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{mediaFeatureColonSpaceChecker.cjs → mediaFeatureColonSpaceChecker.mjs} +5 -4
  84. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{mediaQueryListCommaWhitespaceChecker.cjs → mediaQueryListCommaWhitespaceChecker.mjs} +6 -5
  85. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-empty-first-line/{index.cjs → index.mjs} +6 -20
  86. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-eol-whitespace/{index.cjs → index.mjs} +13 -16
  87. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-extra-semicolons/{index.cjs → index.mjs} +10 -33
  88. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-missing-end-of-source-newline/{index.cjs → index.mjs} +7 -13
  89. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-leading-zero/{index.cjs → index.mjs} +13 -31
  90. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-no-trailing-zeros/{index.cjs → index.mjs} +9 -18
  91. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/property-case/{index.cjs → index.mjs} +10 -16
  92. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-brackets-space-inside/{index.cjs → index.mjs} +9 -36
  93. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-after/{index.cjs → index.mjs} +7 -8
  94. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-before/{index.cjs → index.mjs} +7 -8
  95. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-after/{index.cjs → index.mjs} +7 -8
  96. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-before/{index.cjs → index.mjs} +7 -8
  97. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-descendant-combinator-no-non-space/{index.cjs → index.mjs} +9 -20
  98. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-after/{index.cjs → index.mjs} +9 -14
  99. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-before/{index.cjs → index.mjs} +7 -8
  100. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-after/{index.cjs → index.mjs} +7 -8
  101. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-before/{index.cjs → index.mjs} +7 -8
  102. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-max-empty-lines/{index.cjs → index.mjs} +10 -21
  103. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-case/{index.cjs → index.mjs} +10 -24
  104. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-parentheses-space-inside/{index.cjs → index.mjs} +12 -35
  105. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-element-case/{index.cjs → index.mjs} +10 -15
  106. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorAttributeOperatorSpaceChecker.cjs → selectorAttributeOperatorSpaceChecker.mjs} +6 -5
  107. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorCombinatorSpaceChecker.cjs → selectorCombinatorSpaceChecker.mjs} +12 -11
  108. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorListCommaWhitespaceChecker.cjs → selectorListCommaWhitespaceChecker.mjs} +5 -4
  109. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/string-quotes/{index.cjs → index.mjs} +43 -65
  110. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unicode-bom/{index.cjs → index.mjs} +5 -5
  111. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unit-case/{index.cjs → index.mjs} +17 -34
  112. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-after/{index.cjs → index.mjs} +11 -12
  113. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-before/{index.cjs → index.mjs} +6 -6
  114. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-after/{index.cjs → index.mjs} +10 -11
  115. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/{index.cjs → index.mjs} +10 -11
  116. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/{index.cjs → index.mjs} +12 -18
  117. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{valueListCommaWhitespaceChecker.cjs → valueListCommaWhitespaceChecker.mjs} +6 -5
  118. package/stylelint/plugins/stylelint-15.11.0-stylistic/style-search/{index.cjs → index.mjs} +1 -1
  119. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{addEmptyLineAfter.cjs → addEmptyLineAfter.mjs} +1 -1
  120. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{hasEmptyBlock.cjs → hasEmptyBlock.mjs} +2 -2
  121. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{nextNonCommentNode.cjs → nextNonCommentNode.mjs} +1 -1
  122. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{removeEmptyLinesAfter.cjs → removeEmptyLinesAfter.mjs} +1 -1
  123. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/transformSelector.mjs +19 -0
  124. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{whitespaceChecker.cjs → whitespaceChecker.mjs} +5 -5
  125. package/stylelint/plugins/stylelint-selector-no-empty.js +2 -0
  126. package/stylelint/plugins/stylelint-selector-tag-no-without-class.js +2 -2
  127. package/stylelint.mjs +6 -0
  128. package/TODO.md +0 -58
  129. package/eslint/index.cjs +0 -1071
  130. package/eslint/overrides-gatsby.cjs +0 -108
  131. package/eslint/overrides-javascript-lazy.cjs +0 -27
  132. package/eslint/overrides-javascript.cjs +0 -121
  133. package/eslint/overrides-jest.cjs +0 -144
  134. package/eslint/overrides-jsdoc.cjs +0 -94
  135. package/eslint/overrides-react.cjs +0 -220
  136. package/eslint/overrides-storybook.cjs +0 -44
  137. package/eslint/overrides-type-declarations.cjs +0 -51
  138. package/eslint/rules/no-global-undefined-check.js +0 -85
  139. package/eslint/rules/no-global-undefined-check.md +0 -34
  140. package/eslint.cjs +0 -5
  141. package/stylelint/index.cjs +0 -1104
  142. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.cjs +0 -95
  143. package/stylelint.cjs +0 -5
@@ -0,0 +1,1127 @@
1
+ /**
2
+ * @file Global ESLint settings
3
+ */
4
+
5
+ import fs from 'node:fs';
6
+ import path from 'node:path';
7
+
8
+ import stylisticPlugin from '@stylistic/eslint-plugin';
9
+ // @ts-expect-error -- There are no type definitions for this plugin
10
+ import eslintCommentsPlugin from 'eslint-plugin-eslint-comments';
11
+ import functionalPlugin from 'eslint-plugin-functional';
12
+ // @ts-expect-error -- There are no type definitions for this plugin
13
+ import importPlugin from 'eslint-plugin-import';
14
+ // @ts-expect-error -- There are no type definitions for this plugin
15
+ import jsxA11YPlugin from 'eslint-plugin-jsx-a11y';
16
+ // @ts-expect-error -- There are no type definitions for this plugin
17
+ import promisePlugin from 'eslint-plugin-promise';
18
+ import unicornPlugin from 'eslint-plugin-unicorn';
19
+ import globals from 'globals';
20
+ import * as typescriptEslint from 'typescript-eslint';
21
+
22
+ import * as ensureType from '../helper/ensure-type.mjs';
23
+ import { linterBundleConfig } from '../helper/linter-bundle-config.js';
24
+
25
+ import noUnnecessaryTypeofRule from './rules/no-unnecessary-typeof.mjs';
26
+ import restrictedFilenamesRule from './rules/restricted-filenames.mjs';
27
+
28
+ export default [
29
+ {
30
+ ignores: [
31
+ '.cache/',
32
+ '.vscode/',
33
+ '.yarn/',
34
+ 'coverage/',
35
+ 'fixtures/',
36
+ 'node_modules/'
37
+ ],
38
+ plugins: {
39
+ 'eslint-comments': eslintCommentsPlugin,
40
+ 'functional': functionalPlugin,
41
+ 'import': importPlugin,
42
+ 'jsx-a11y': jsxA11YPlugin,
43
+ 'promise': promisePlugin,
44
+ 'unicorn': unicornPlugin,
45
+ '@stylistic': stylisticPlugin,
46
+ '@typescript-eslint': typescriptEslint.plugin,
47
+
48
+ 'linter-bundle': {
49
+ rules: {
50
+ 'no-unnecessary-typeof': noUnnecessaryTypeofRule,
51
+ 'restricted-filenames': restrictedFilenamesRule
52
+ }
53
+ }
54
+ },
55
+ languageOptions: {
56
+ parser: typescriptEslint.parser,
57
+ parserOptions: {
58
+ ecmaVersion: 2020,
59
+ sourceType: 'module',
60
+ ecmaFeatures: {
61
+ jsx: true
62
+ },
63
+ project: [
64
+ // eslint-disable-next-line n/no-process-env -- We need to read the environment variable here, because it may contain the configuration.
65
+ (process.env['TSCONFIG'] ?? './tsconfig.json'),
66
+ './jsconfig.json'
67
+ ].filter((fileName) => {
68
+ const filePath = path.resolve(process.cwd(), fileName);
69
+
70
+ return (fs.existsSync(filePath) && fs.lstatSync(filePath).isFile());
71
+ }),
72
+ tsconfigRootDir: process.cwd(),
73
+ warnOnUnsupportedTypeScriptVersion: false
74
+ },
75
+ globals: {
76
+ ...globals.browser,
77
+ ...globals.node,
78
+
79
+ ArrayBuffer: 'readonly',
80
+ FileReaderSync: 'readonly',
81
+ Float32Array: 'readonly',
82
+ Float64Array: 'readonly',
83
+ Int8Array: 'readonly',
84
+ Int16Array: 'readonly',
85
+ Int32Array: 'readonly',
86
+ Map: 'readonly',
87
+ Promise: 'readonly',
88
+ Set: 'readonly',
89
+ Uint8Array: 'readonly',
90
+ Uint16Array: 'readonly',
91
+ Uint32Array: 'readonly'
92
+ }
93
+ },
94
+ linterOptions: {
95
+ reportUnusedDisableDirectives: true,
96
+ reportUnusedInlineConfigs: 'error'
97
+ },
98
+ settings: {
99
+ 'import/parsers': {
100
+ '@typescript-eslint/parser': ['.ts', '.tsx']
101
+ },
102
+ 'import/resolver': {
103
+ typescript: { alwaysTryTypes: true },
104
+ ...(() => {
105
+ const filePath = path.resolve(process.cwd(), 'webpack.config.js');
106
+
107
+ if ((fs.existsSync(filePath) && fs.lstatSync(filePath).isFile())) {
108
+ return {
109
+ webpack: { config: filePath }
110
+ };
111
+ }
112
+
113
+ return undefined;
114
+ })()
115
+ },
116
+ 'react': {
117
+ version: 'detect'
118
+ }
119
+ }
120
+ },
121
+ {
122
+ files: [
123
+ '**/*.js',
124
+ '**/*.ts',
125
+ '**/*.mjs',
126
+ '**/*.mts',
127
+ '**/*.cjs',
128
+ '**/*.cts',
129
+ '**/*.jsx',
130
+ '**/*.tsx'
131
+ ],
132
+ rules: {
133
+ /**
134
+ * ./rules
135
+ */
136
+ 'linter-bundle/no-unnecessary-typeof': 'error',
137
+
138
+ /**
139
+ * eslint
140
+ * @see https://eslint.org/docs/rules/
141
+ */
142
+ 'accessor-pairs': 'error',
143
+ 'array-bracket-newline': ['error', 'consistent'],
144
+ 'array-bracket-spacing': 'error',
145
+ 'array-callback-return': 'error',
146
+ 'array-element-newline': 'off', // Line breaks should be used in such a way that maximum readability is achieved. This cannot be represented by a fixed rule.
147
+ 'arrow-body-style': 'error',
148
+ 'arrow-parens': 'error',
149
+ 'arrow-spacing': 'error',
150
+ 'block-scoped-var': 'error',
151
+ 'block-spacing': 'error',
152
+ 'brace-style': 'off', // Covered by @typescript-eslint/brace-style
153
+ 'camelcase': 'off', // Covered by @typescript-eslint/naming-convention
154
+ 'capitalized-comments': 'off',
155
+ 'class-methods-use-this': 'off', // Covered by @typescript-eslint/class-methods-use-this
156
+ 'comma-dangle': 'off', // Covered by @stylistic/comma-dangle
157
+ 'comma-spacing': 'off', // Covered by @stylistic/comma-spacing
158
+ 'comma-style': 'error',
159
+ 'complexity': ['error', { max: 20 }],
160
+ 'computed-property-spacing': 'error',
161
+ 'consistent-return': 'off', // Handled by TypeScript type annotations
162
+ 'consistent-this': 'error',
163
+ 'constructor-super': 'error',
164
+ 'curly': 'error',
165
+ 'default-case-last': 'error',
166
+ 'default-case': 'error',
167
+ 'default-param-last': 'off', // @todo It should be valid to have optional parameters after default parameters
168
+ 'dot-location': ['error', 'property'],
169
+ 'dot-notation': 'off', // Covered by @typescript-eslint/dot-notation
170
+ 'eol-last': 'error',
171
+ 'eqeqeq': 'error',
172
+ 'for-direction': 'error',
173
+ 'func-call-spacing': 'off', // Covered by @stylistic/func-call-spacing
174
+ 'func-name-matching': 'error',
175
+ 'func-names': 'error',
176
+ 'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
177
+ 'function-call-argument-newline': 'off', // @todo Multiple multi-line object arguments are not allowed, so this option is not usable right now
178
+ 'function-paren-newline': ['error', 'multiline-arguments'],
179
+ 'generator-star-spacing': 'error',
180
+ 'getter-return': 'error',
181
+ 'grouped-accessor-pairs': 'error',
182
+ 'guard-for-in': 'error',
183
+ 'id-denylist': 'error',
184
+ 'id-length': ['error', { exceptions: ['a', 'b', 'c', 'i', 'j', 'n', 'x', 'y', 'z', '_'] }],
185
+ 'id-match': 'error',
186
+ 'implicit-arrow-linebreak': 'error',
187
+ 'indent': 'off', // Covered by @stylistic/indent
188
+ 'init-declarations': 'off', // @todo It should be possible to ignore predefined consts like MAX_RADIX
189
+ 'jsx-quotes': 'error',
190
+ 'key-spacing': 'off', // Covered by @stylistic/key-spacing
191
+ 'keyword-spacing': 'error',
192
+ 'linebreak-style': 'error',
193
+ 'lines-around-comment': 'off', // Doesn't work with interfaces; sometimes doesn't make sense if the comment is related to the code above it
194
+ 'lines-between-class-members': 'off', // @todo Deactivated till we have a JSDoc description for all class members
195
+ 'logical-assignment-operators': ['error', 'always'],
196
+ 'max-classes-per-file': 'error',
197
+ 'max-depth': ['error', { max: 5 }],
198
+ 'max-len': ['error', {
199
+ code: 300,
200
+ tabWidth: 4,
201
+ comments: 300,
202
+ ignoreUrls: true
203
+ }],
204
+ 'max-lines-per-function': ['error', { max: 200, skipBlankLines: true, skipComments: true }],
205
+ 'max-lines': ['error', { max: 500, skipBlankLines: true, skipComments: true }],
206
+ 'max-nested-callbacks': 'error',
207
+ 'max-params': ['error', { max: 5 }],
208
+ 'max-statements-per-line': ['error', { max: 3 }],
209
+ 'max-statements': ['error', 50, { ignoreTopLevelFunctions: true }],
210
+ 'multiline-ternary': 'off', // I would prefer this style: `(a === b ? (\ntrue\n) : {\notherwise: false\n})`, which means line-breaks should be only allowed, if the operand is wrapped into `(`, `{` or `[`.
211
+ 'new-cap': ['error', { properties: false }],
212
+ 'new-parens': 'error',
213
+ 'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }],
214
+ 'no-alert': 'error',
215
+ 'no-array-constructor': 'off', // Covered by @typescript-eslint/no-array-constructor
216
+ 'no-async-promise-executor': 'error',
217
+ 'no-await-in-loop': 'error',
218
+ 'no-bitwise': ['error', { allow: ['^', '~', '<<', '>>', '>>>', '|=', '&=', '^=', '<<=', '>>=', '>>>='] }], // Disallow "&" and "|".
219
+ 'no-caller': 'error',
220
+ 'no-case-declarations': 'error',
221
+ 'no-class-assign': 'error',
222
+ 'no-compare-neg-zero': 'error',
223
+ 'no-cond-assign': 'error',
224
+ 'no-confusing-arrow': ['error', { allowParens: true }],
225
+ 'no-console': 'error',
226
+ 'no-const-assign': 'error',
227
+ 'no-constant-binary-expression': 'error',
228
+ 'no-constant-condition': 'error',
229
+ 'no-constructor-return': 'error',
230
+ 'no-continue': 'off', // If it makes the code more readable, wer are using `continue`
231
+ 'no-control-regex': 'off', // This rule does not make sense to me
232
+ 'no-debugger': 'error',
233
+ 'no-delete-var': 'error',
234
+ 'no-div-regex': 'error',
235
+ 'no-dupe-args': 'error',
236
+ 'no-dupe-class-members': 'off', // Covered by @typescript-eslint/no-dupe-class-members
237
+ 'no-dupe-else-if': 'error',
238
+ 'no-dupe-keys': 'error',
239
+ 'no-duplicate-case': 'error',
240
+ 'no-duplicate-imports': 'off', // Covered by import/no-duplicates (see https://github.com/typescript-eslint/typescript-eslint/issues/2315)
241
+ 'no-else-return': 'error',
242
+ 'no-empty-character-class': 'error',
243
+ 'no-empty-function': 'off', // Covered by @typescript-eslint/no-empty-function
244
+ 'no-empty-pattern': 'error',
245
+ 'no-empty-static-block': 'error',
246
+ 'no-empty': 'error',
247
+ 'no-eq-null': 'error',
248
+ 'no-eval': 'error',
249
+ 'no-ex-assign': 'error',
250
+ 'no-extend-native': 'error',
251
+ 'no-extra-bind': 'error',
252
+ 'no-extra-boolean-cast': 'error',
253
+ 'no-extra-label': 'error',
254
+ 'no-extra-parens': 'off', // Covered by @typescript-eslint/no-extra-parens
255
+ 'no-extra-semi': 'off', // Covered by @stylistic/no-extra-semi
256
+ 'no-fallthrough': ['error', { allowEmptyCase: true }],
257
+ 'no-floating-decimal': 'error',
258
+ 'no-func-assign': 'error',
259
+ 'no-global-assign': 'error',
260
+ 'no-implicit-coercion': ['error', { disallowTemplateShorthand: true }],
261
+ 'no-implicit-globals': 'error',
262
+ 'no-implied-eval': 'error',
263
+ 'no-import-assign': 'error',
264
+ 'no-inline-comments': 'off',
265
+ 'no-inner-declarations': ['error', 'both'],
266
+ 'no-invalid-regexp': 'error',
267
+ 'no-invalid-this': 'off', // Covered by @typescript-eslint/no-invalid-this
268
+ 'no-irregular-whitespace': 'error',
269
+ 'no-iterator': 'error',
270
+ 'no-label-var': 'error',
271
+ 'no-labels': ['error', { allowLoop: true }],
272
+ 'no-lone-blocks': 'error',
273
+ 'no-lonely-if': 'off', // Covered by unicorn/no-lonely-if
274
+ 'no-loop-func': 'off', // Covered by @typescript-eslint/no-loop-func
275
+ 'no-loss-of-precision': 'error',
276
+ 'no-magic-numbers': 'off', // Covered by @typescript-eslint/no-magic-numbers
277
+ 'no-misleading-character-class': 'error',
278
+ 'no-mixed-operators': 'error',
279
+ 'no-mixed-spaces-and-tabs': 'error',
280
+ 'no-multi-assign': 'error',
281
+ 'no-multi-spaces': 'error',
282
+ 'no-multi-str': 'error',
283
+ 'no-multiple-empty-lines': ['error', { max: 1 }],
284
+ 'no-negated-condition': 'off',
285
+ 'no-nested-ternary': 'error',
286
+ 'no-new-func': 'error',
287
+ 'no-new-native-nonconstructor': 'error',
288
+ 'no-new-wrappers': 'error',
289
+ 'no-new': 'error',
290
+ 'no-nonoctal-decimal-escape': 'error',
291
+ 'no-obj-calls': 'error',
292
+ 'no-object-constructor': 'error',
293
+ 'no-octal-escape': 'error',
294
+ 'no-octal': 'error',
295
+ 'no-param-reassign': 'off', // Parameter reassignment used wisely makes the code more readable
296
+ 'no-plusplus': 'off',
297
+ 'no-promise-executor-return': 'error',
298
+ 'no-proto': 'error',
299
+ 'no-prototype-builtins': 'error',
300
+ 'no-redeclare': 'off', // Covered by @typescript-eslint/no-redeclare
301
+ 'no-regex-spaces': 'error',
302
+ 'no-restricted-exports': 'error',
303
+ 'no-restricted-globals': [
304
+ 'error',
305
+ {
306
+ name: 'isNaN',
307
+ message: 'Use Number.isNaN() instead, and ensure that the input value is of type number. isNaN(undefined) !== Number.isNaN(undefined)'
308
+ },
309
+ ...ensureType.array(linterBundleConfig.ts?.overrides?.general?.['no-restricted-globals']?.additionalRestrictions)
310
+ ],
311
+ 'no-restricted-imports': 'off', // Covered by @typescript-eslint/no-restricted-imports
312
+ 'no-restricted-properties': [
313
+ 'error',
314
+ ...ensureType.array(linterBundleConfig.ts?.overrides?.general?.['no-restricted-properties']?.additionalRestrictions)
315
+ ],
316
+ 'no-restricted-syntax': [
317
+ 'error',
318
+ ...ensureType.array(linterBundleConfig.ts?.overrides?.general?.['no-restricted-syntax']?.additionalRestrictions)
319
+ ],
320
+ 'no-return-assign': 'error',
321
+ 'no-script-url': 'error',
322
+ 'no-self-assign': 'error',
323
+ 'no-self-compare': 'error',
324
+ 'no-sequences': 'error',
325
+ 'no-setter-return': 'error',
326
+ 'no-shadow-restricted-names': 'error',
327
+ 'no-shadow': 'off', // Covered by @typescript-eslint/no-shadow
328
+ 'no-sparse-arrays': 'error',
329
+ 'no-tabs': ['error', { allowIndentationTabs: true }],
330
+ 'no-template-curly-in-string': 'error',
331
+ 'no-ternary': 'off',
332
+ 'no-this-before-super': 'error',
333
+ 'no-throw-literal': 'off', // Covered by @typescript-eslint/no-throw-literal
334
+ 'no-trailing-spaces': 'error',
335
+ 'no-undef-init': 'error',
336
+ 'no-undef': 'off', // Covered by TypeScript
337
+ 'no-undefined': 'off', // @todo "Using the void operator to generate the value of undefined if necessary." should be disableable
338
+ 'no-underscore-dangle': ['error', { allow: ['__DEV__'], allowAfterThis: true }],
339
+ 'no-unexpected-multiline': 'error',
340
+ 'no-unmodified-loop-condition': 'error',
341
+ 'no-unneeded-ternary': 'error',
342
+ 'no-unreachable-loop': 'error',
343
+ 'no-unreachable': 'error',
344
+ 'no-unsafe-finally': 'error',
345
+ 'no-unsafe-negation': 'error',
346
+ 'no-unsafe-optional-chaining': 'error',
347
+ 'no-unused-expressions': 'off', // Covered by @typescript-eslint/no-unused-expressions
348
+ 'no-unused-labels': 'error',
349
+ 'no-unused-private-class-members': 'error',
350
+ 'no-unused-vars': 'off', // Covered by @typescript-eslint/no-unused-vars
351
+ 'no-use-before-define': 'off', // Covered by @typescript-eslint/no-use-before-define
352
+ 'no-useless-assignment': 'error',
353
+ 'no-useless-backreference': 'error',
354
+ 'no-useless-call': 'off', // @todo Produces into false-positives for CharsetConverter → `internalMap.encoder.call(encoding, str.toLowerCase())`
355
+ 'no-useless-catch': 'error',
356
+ 'no-useless-computed-key': 'error',
357
+ 'no-useless-concat': 'error',
358
+ 'no-useless-constructor': 'off', // Covered by @typescript-eslint/no-useless-constructor
359
+ 'no-useless-escape': 'error',
360
+ 'no-useless-rename': 'error',
361
+ 'no-useless-return': 'off', // @todo Option to ignore switch-case blocks: In switch-case blocks it makes sense to keep all cases equal, instead of removing the 'return' from the last case, because this could produce bugs in later adjustments.
362
+ 'no-var': 'error',
363
+ 'no-void': 'off', // This is in conflict with @typescript-eslint/no-floating-promises which expects either `await` or `void`
364
+ 'no-warning-comments': 'error',
365
+ 'no-whitespace-before-property': 'error',
366
+ 'no-with': 'error',
367
+ 'nonblock-statement-body-position': 'error',
368
+ 'object-curly-newline': 'error',
369
+ 'object-curly-spacing': 'off', // Covered by @stylistic/object-curly-spacing
370
+ 'object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
371
+ 'object-shorthand': 'error',
372
+ 'one-var-declaration-per-line': 'error',
373
+ 'one-var': ['error', { initialized: 'never', uninitialized: 'never' }],
374
+ 'operator-assignment': 'error',
375
+ 'operator-linebreak': ['error', 'after', { overrides: { ':': 'ignore' } }],
376
+ 'padded-blocks': ['error', 'never'],
377
+ 'padding-line-between-statements': 'error',
378
+ 'prefer-arrow-callback': ['error', { allowNamedFunctions: true }],
379
+ 'prefer-const': 'error',
380
+ 'prefer-destructuring': 'off', // We don't prefer destructuring if a type is specified ['error', { VariableDeclarator: { array: true, object: true }, AssignmentExpression: { array: false, object: false } }],
381
+ 'prefer-exponentiation-operator': 'error',
382
+ 'prefer-named-capture-group': 'off', // ES2018+, not supported in most browsers yet
383
+ 'prefer-numeric-literals': 'error',
384
+ 'prefer-object-spread': 'error',
385
+ 'prefer-promise-reject-errors': 'off', // Covered by @typescript-eslint/prefer-promise-reject-errors
386
+ 'prefer-regex-literals': 'error',
387
+ 'prefer-rest-params': 'error',
388
+ 'prefer-spread': 'error',
389
+ 'prefer-template': 'error',
390
+ 'quote-props': ['error', 'consistent-as-needed'],
391
+ 'quotes': 'off', // Covered by @stylistic/quotes
392
+ 'radix': 'error',
393
+ 'require-atomic-updates': 'error',
394
+ 'require-await': 'off', // Covered by @typescript-eslint/require-await
395
+ 'require-unicode-regexp': 'error',
396
+ 'require-yield': 'error',
397
+ 'rest-spread-spacing': 'error',
398
+ 'semi-spacing': 'error',
399
+ 'semi-style': 'error',
400
+ 'semi': 'off', // Covered by @stylistic/semi
401
+ 'sort-imports': 'off', // import/order
402
+ 'sort-keys': 'off', // Keys should be grouped by their scope/category, not by their name
403
+ 'sort-vars': 'off', // Something like `for (let pos = 4 + addressLength, dataPos = 0; pos < length - 2; pos += 2, dataPos++) {` should be sorted by importance
404
+ 'space-before-blocks': 'error',
405
+ 'space-before-function-paren': 'off', // Covered by @stylistic/space-before-function-paren
406
+ 'space-in-parens': 'error',
407
+ 'space-infix-ops': 'off', // Covered by @stylistic/space-infix-ops
408
+ 'space-unary-ops': 'error',
409
+ 'spaced-comment': ['error', 'always', { markers: ['/'], block: { markers: ['!'], balanced: true } }],
410
+ 'strict': 'error',
411
+ 'switch-colon-spacing': 'error',
412
+ 'symbol-description': 'error',
413
+ 'template-curly-spacing': 'error',
414
+ 'template-tag-spacing': 'error',
415
+ 'unicode-bom': 'error',
416
+ 'use-isnan': 'error',
417
+ 'valid-typeof': ['error', { requireStringLiterals: true }],
418
+ 'vars-on-top': 'error',
419
+ 'wrap-iife': 'error',
420
+ 'wrap-regex': 'error',
421
+ 'yield-star-spacing': ['error', { before: true, after: false }],
422
+ 'yoda': 'error',
423
+
424
+ /**
425
+ * stylistic
426
+ * @see https://eslint.style/rules
427
+ */
428
+ '@stylistic/brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
429
+ '@stylistic/comma-dangle': ['error', { generics: 'ignore' }],
430
+ '@stylistic/comma-spacing': 'error',
431
+ '@stylistic/func-call-spacing': 'error',
432
+ '@stylistic/indent': [
433
+ 'error',
434
+ 'tab',
435
+ {
436
+ SwitchCase: 1,
437
+ VariableDeclarator: 1,
438
+ MemberExpression: 1,
439
+ flatTernaryExpressions: true,
440
+ ignoredNodes: ['ConditionalExpression']
441
+ }
442
+ ],
443
+ '@stylistic/key-spacing': 'error',
444
+ '@stylistic/member-delimiter-style': ['error', { multiline: { delimiter: 'semi', requireLast: true }, singleline: { delimiter: 'semi', requireLast: true } }],
445
+ '@stylistic/no-extra-semi': 'error',
446
+ '@stylistic/object-curly-spacing': ['error', 'always'],
447
+ '@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
448
+ '@stylistic/semi': 'error',
449
+ '@stylistic/space-before-function-paren': 'error',
450
+ '@stylistic/space-infix-ops': 'error',
451
+ '@stylistic/type-annotation-spacing': 'error',
452
+
453
+ /**
454
+ * typescript-eslint
455
+ * @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules
456
+ */
457
+ '@typescript-eslint/adjacent-overload-signatures': 'error',
458
+ '@typescript-eslint/array-type': 'error',
459
+ '@typescript-eslint/await-thenable': 'error',
460
+ '@typescript-eslint/ban-ts-comment': ['error', {
461
+ 'ts-expect-error': 'allow-with-description'
462
+ }],
463
+ '@typescript-eslint/ban-tslint-comment': 'error',
464
+ '@typescript-eslint/class-literal-property-style': 'error',
465
+ '@typescript-eslint/class-methods-use-this': ['error', { exceptMethods: ['componentDidMount', 'componentDidUpdate', 'componentWillUnmount', 'shouldComponentUpdate'], ignoreOverrideMethods: true, ignoreClassesThatImplementAnInterface: true }],
466
+ '@typescript-eslint/consistent-generic-constructors': 'error',
467
+ '@typescript-eslint/consistent-indexed-object-style': 'error',
468
+ '@typescript-eslint/consistent-return': 'error',
469
+ '@typescript-eslint/consistent-type-assertions': 'error',
470
+ '@typescript-eslint/consistent-type-definitions': 'error',
471
+ '@typescript-eslint/consistent-type-exports': 'error',
472
+ '@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
473
+ '@typescript-eslint/dot-notation': 'error',
474
+ '@typescript-eslint/explicit-function-return-type': ['error', { allowExpressions: true }],
475
+ '@typescript-eslint/explicit-member-accessibility': ['error', {
476
+ ignoredMethodNames: [
477
+ 'constructor',
478
+ 'getDerivedStateFromProps',
479
+ 'componentDidMount',
480
+ 'shouldComponentUpdate',
481
+ 'render',
482
+ 'getSnapshotBeforeUpdate',
483
+ 'componentDidUpdate',
484
+ 'componentWillUnmount',
485
+ 'getDerivedStateFromError',
486
+ 'componentDidCatch'
487
+ ]
488
+ }],
489
+ '@typescript-eslint/explicit-module-boundary-types': ['off', { // @todo There must be an option to specify argument names which shall be ignored (arguments starting with "_", "props")
490
+ allowedNames: [
491
+ 'getDerivedStateFromProps',
492
+ 'componentDidMount',
493
+ 'shouldComponentUpdate',
494
+ 'render',
495
+ 'getSnapshotBeforeUpdate',
496
+ 'componentDidUpdate',
497
+ 'componentWillUnmount',
498
+ 'getDerivedStateFromError',
499
+ 'componentDidCatch'
500
+ ]
501
+ }],
502
+ '@typescript-eslint/member-ordering': ['error', {
503
+ default: [
504
+ // Index signature
505
+ 'signature',
506
+
507
+ // Fields
508
+ 'public-static-field',
509
+ 'protected-static-field',
510
+ '#private-static-field',
511
+ 'private-static-field',
512
+
513
+ 'public-decorated-field',
514
+ 'protected-decorated-field',
515
+ 'private-decorated-field',
516
+
517
+ 'public-instance-field',
518
+ 'protected-instance-field',
519
+ '#private-instance-field',
520
+ 'private-instance-field',
521
+
522
+ 'public-abstract-field',
523
+ 'protected-abstract-field',
524
+
525
+ // Constructors
526
+ 'public-constructor',
527
+ 'protected-constructor',
528
+ 'private-constructor',
529
+
530
+ // Methods / Getters / Setters
531
+ 'public-decorated-set',
532
+ 'public-decorated-get',
533
+ 'public-decorated-method',
534
+ 'public-instance-set',
535
+ 'public-instance-get',
536
+ 'public-instance-method',
537
+ 'public-static-set',
538
+ 'public-static-get',
539
+ 'public-static-method',
540
+ 'public-abstract-get',
541
+ 'public-abstract-set',
542
+ 'public-abstract-method',
543
+
544
+ 'protected-decorated-set',
545
+ 'protected-decorated-get',
546
+ 'protected-decorated-method',
547
+ 'protected-instance-set',
548
+ 'protected-instance-get',
549
+ 'protected-instance-method',
550
+ 'protected-static-set',
551
+ 'protected-static-get',
552
+ 'protected-static-method',
553
+ 'protected-abstract-get',
554
+ 'protected-abstract-set',
555
+ 'protected-abstract-method',
556
+
557
+ 'private-decorated-set',
558
+ 'private-decorated-get',
559
+ 'private-decorated-method',
560
+ '#private-instance-set',
561
+ '#private-instance-get',
562
+ '#private-instance-method',
563
+ 'private-instance-set',
564
+ 'private-instance-get',
565
+ 'private-instance-method',
566
+ '#private-static-set',
567
+ '#private-static-get',
568
+ '#private-static-method',
569
+ 'private-static-set',
570
+ 'private-static-get',
571
+ 'private-static-method'
572
+ ]
573
+ }],
574
+ '@typescript-eslint/method-signature-style': ['error', 'property'],
575
+ '@typescript-eslint/naming-convention': [
576
+ 'error',
577
+
578
+ ...ensureType.array(linterBundleConfig.ts?.overrides?.general?.['@typescript-eslint/naming-convention']?.additionalOptions),
579
+
580
+ { selector: 'default', format: ['camelCase'] },
581
+
582
+ // Variable
583
+ { selector: 'variable', format: ['camelCase', 'PascalCase'] }, // @todo PascalCase only for objects
584
+ {
585
+ selector: 'variable',
586
+ filter: '^(is|should|has|can|did|will)[A-Z]',
587
+ types: ['boolean'],
588
+ format: ['camelCase']
589
+ },
590
+ {
591
+ selector: 'variable',
592
+ modifiers: ['const'],
593
+ format: ['camelCase', 'PascalCase', 'UPPER_CASE']
594
+ },
595
+ {
596
+ selector: 'variable',
597
+ types: ['number', 'string', 'array'],
598
+ format: ['camelCase', 'UPPER_CASE']
599
+ },
600
+ {
601
+ selector: 'variable',
602
+ types: ['function'],
603
+ format: ['camelCase', 'PascalCase']
604
+ },
605
+
606
+ // Allow constant names starting with "_" if they are unused
607
+ {
608
+ selector: ['variable'],
609
+ filter: '^_',
610
+ modifiers: ['unused'],
611
+ format: null
612
+ },
613
+
614
+ // Function
615
+ { selector: 'function', format: ['camelCase', 'PascalCase'] },
616
+
617
+ // Parameter
618
+ { selector: 'parameter', format: ['camelCase', 'PascalCase'], leadingUnderscore: 'allow' },
619
+
620
+ // Property
621
+ { selector: 'property', format: ['camelCase', 'PascalCase'] },
622
+ {
623
+ selector: 'property',
624
+ types: ['number', 'string', 'array'],
625
+ format: ['camelCase', 'PascalCase', 'UPPER_CASE']
626
+ },
627
+ {
628
+ selector: 'property',
629
+ modifiers: ['readonly'],
630
+ format: ['camelCase', 'PascalCase', 'UPPER_CASE']
631
+ },
632
+ {
633
+ selector: 'objectLiteralProperty',
634
+ // `__html` is a property of React's `dangerouslySetInnerHTML` object
635
+ filter: '^__html$',
636
+ types: ['string'],
637
+ format: null
638
+ },
639
+ {
640
+ // Allow properties which only contain digits
641
+ selector: 'objectLiteralProperty',
642
+ filter: String.raw`^\d+$`,
643
+ format: null
644
+ },
645
+ {
646
+ // Allow empty or one-character properties
647
+ selector: 'objectLiteralProperty',
648
+ filter: '^.?$',
649
+ format: null
650
+ },
651
+ {
652
+ // Allow properties which which don't contain an underscore (to prevent usage of "UPPER_CASE") and contain at least 4 characters
653
+ selector: 'objectLiteralProperty',
654
+ filter: '^[^_]{4,}$',
655
+ format: null
656
+ },
657
+ { selector: 'typeProperty', format: ['camelCase', 'PascalCase'] },
658
+ {
659
+ selector: 'typeProperty',
660
+ types: ['number', 'string', 'array'],
661
+ format: ['camelCase', 'PascalCase', 'UPPER_CASE']
662
+ },
663
+ {
664
+ selector: 'typeProperty',
665
+ modifiers: ['readonly'],
666
+ format: ['camelCase', 'PascalCase', 'UPPER_CASE']
667
+ },
668
+
669
+ // Parameter property
670
+ { selector: 'parameterProperty', format: ['camelCase'] },
671
+
672
+ // Method
673
+ { selector: 'method', format: ['camelCase'] },
674
+
675
+ // Accessor
676
+ { selector: 'accessor', format: ['camelCase'] },
677
+
678
+ // Enum member
679
+ { selector: 'enumMember', format: ['UPPER_CASE'] },
680
+
681
+ // Class
682
+ { selector: 'class', format: ['PascalCase'] },
683
+
684
+ // Interface
685
+ { selector: 'interface', format: ['PascalCase'] },
686
+
687
+ // Import
688
+ { selector: 'import', format: ['camelCase', 'PascalCase'] },
689
+
690
+ // Type alias
691
+ { selector: 'typeAlias', format: ['PascalCase'] },
692
+
693
+ // Enum
694
+ { selector: 'enum', format: ['PascalCase'] },
695
+
696
+ // Type parameter
697
+ { selector: 'typeParameter', format: ['PascalCase'] }
698
+ ],
699
+ '@typescript-eslint/no-array-constructor': 'error',
700
+ '@typescript-eslint/no-array-delete': 'error',
701
+ '@typescript-eslint/no-base-to-string': 'error',
702
+ '@typescript-eslint/no-confusing-non-null-assertion': 'error',
703
+ '@typescript-eslint/no-confusing-void-expression': ['error', { ignoreArrowShorthand: true, ignoreVoidOperator: true }],
704
+ '@typescript-eslint/no-dupe-class-members': 'error',
705
+ '@typescript-eslint/no-duplicate-enum-values': 'error',
706
+ '@typescript-eslint/no-duplicate-type-constituents': 'error',
707
+ '@typescript-eslint/no-dynamic-delete': 'error',
708
+ '@typescript-eslint/no-empty-function': 'error',
709
+ '@typescript-eslint/no-empty-interface': 'off',
710
+ '@typescript-eslint/no-empty-object-type': 'error',
711
+ '@typescript-eslint/no-explicit-any': 'off',
712
+ '@typescript-eslint/no-extra-non-null-assertion': 'error',
713
+ '@typescript-eslint/no-extra-parens': ['off', 'all', { nestedBinaryExpressions: true, enforceForArrowConditionals: true }], // @todo There should be a option to enforce parens for IIFs + This has to be activated if all other linting errors are resolved
714
+ '@typescript-eslint/no-extraneous-class': 'error',
715
+ '@typescript-eslint/no-floating-promises': 'error',
716
+ '@typescript-eslint/no-for-in-array': 'error',
717
+ '@typescript-eslint/no-implicit-any-catch': 'off', // Results into false-positive with the TS4.4 option "useUnknownInCatchVariables"
718
+ '@typescript-eslint/no-import-type-side-effects': 'error',
719
+ '@typescript-eslint/no-inferrable-types': 'off', // Sometimes an explicit type helps to understand the code better
720
+ '@typescript-eslint/no-invalid-this': 'error',
721
+ '@typescript-eslint/no-invalid-void-type': ['error', { allowInGenericTypeArguments: true }],
722
+ '@typescript-eslint/no-loop-func': 'error',
723
+ '@typescript-eslint/no-magic-numbers': 'off', // @todo There should be an option that numbers in arrays are ok like `const MaxSizes = [4, 8, 16, 32, 64];`
724
+ /* ['error', {
725
+ ignore: [-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 15, 16, 24, 32, 60, 63, 64, 100, 128, 250, 255, 256, 500, 1000, 4_294_967_296],
726
+ ignoreArrayIndexes: true,
727
+ ignoreClassFieldInitialValues: true,
728
+ enforceConst: true,
729
+ detectObjects: true
730
+ }], */
731
+ '@typescript-eslint/no-meaningless-void-operator': 'error',
732
+ '@typescript-eslint/no-misused-new': 'error',
733
+ '@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: false }],
734
+ '@typescript-eslint/no-mixed-enums': 'error',
735
+ '@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }],
736
+ '@typescript-eslint/no-non-null-assertion': 'error',
737
+ '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
738
+ '@typescript-eslint/no-redeclare': ['error', { ignoreDeclarationMerge: true }],
739
+ '@typescript-eslint/no-redundant-type-constituents': 'off', // False positive with Promise<... | never>
740
+ '@typescript-eslint/no-require-imports': 'error',
741
+ '@typescript-eslint/no-restricted-imports': 'error',
742
+ '@typescript-eslint/no-shadow': 'error',
743
+ '@typescript-eslint/no-this-alias': 'error',
744
+ '@typescript-eslint/no-type-alias': ['off', { // @todo There should be an option like 'sub-in-unions-and-intersections', which allows `type A = (string | number)[];`
745
+ allowAliases: 'always',
746
+ allowCallbacks: 'always',
747
+ allowConditionalTypes: 'always',
748
+ allowConstructors: 'always',
749
+ allowLiterals: 'in-unions-and-intersections',
750
+ allowMappedTypes: 'always',
751
+ allowTupleTypes: 'in-unions-and-intersections'
752
+ }],
753
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
754
+ '@typescript-eslint/no-unnecessary-condition': ['error', { allowConstantLoopConditions: true, checkTypePredicates: true }],
755
+ '@typescript-eslint/no-unnecessary-parameter-property-assignment': 'error',
756
+ '@typescript-eslint/no-unnecessary-qualifier': 'error',
757
+ '@typescript-eslint/no-unnecessary-template-expression': 'error',
758
+ '@typescript-eslint/no-unnecessary-type-arguments': 'error',
759
+ '@typescript-eslint/no-unnecessary-type-assertion': 'error',
760
+ '@typescript-eslint/no-unnecessary-type-constraint': 'error',
761
+ '@typescript-eslint/no-unnecessary-type-parameters': 'error',
762
+ '@typescript-eslint/no-unsafe-argument': 'error',
763
+ '@typescript-eslint/no-unsafe-assignment': 'error',
764
+ '@typescript-eslint/no-unsafe-call': 'error',
765
+ '@typescript-eslint/no-unsafe-declaration-merging': 'error',
766
+ '@typescript-eslint/no-unsafe-enum-comparison': 'error',
767
+ '@typescript-eslint/no-unsafe-member-access': 'error',
768
+ '@typescript-eslint/no-unsafe-return': 'error',
769
+ '@typescript-eslint/no-unsafe-unary-minus': 'error',
770
+ '@typescript-eslint/no-unused-expressions': 'error',
771
+ '@typescript-eslint/no-unsafe-type-assertion': 'error',
772
+ '@typescript-eslint/no-unused-vars': ['error', {
773
+ args: 'all',
774
+ argsIgnorePattern: '^_',
775
+ caughtErrors: 'all',
776
+ caughtErrorsIgnorePattern: '^_',
777
+ destructuredArrayIgnorePattern: '^_',
778
+ varsIgnorePattern: '^_',
779
+ ignoreRestSiblings: true
780
+ }],
781
+ '@typescript-eslint/no-use-before-define': ['error', { functions: false }],
782
+ '@typescript-eslint/no-useless-constructor': 'error',
783
+ '@typescript-eslint/no-useless-empty-export': 'error',
784
+ '@typescript-eslint/no-var-requires': 'error',
785
+ '@typescript-eslint/non-nullable-type-assertion-style': 'off', // Conflicts with `no-non-null-assertion`, which we prefer
786
+ '@typescript-eslint/only-throw-error': 'error',
787
+ '@typescript-eslint/prefer-as-const': 'error',
788
+ '@typescript-eslint/prefer-enum-initializers': 'off',
789
+ '@typescript-eslint/prefer-find': 'error',
790
+ '@typescript-eslint/prefer-for-of': 'error',
791
+ '@typescript-eslint/prefer-function-type': 'error',
792
+ '@typescript-eslint/prefer-includes': 'error',
793
+ '@typescript-eslint/prefer-literal-enum-member': 'error',
794
+ '@typescript-eslint/prefer-namespace-keyword': 'error',
795
+ '@typescript-eslint/prefer-nullish-coalescing': ['error', { ignoreConditionalTests: true, ignoreMixedLogicalExpressions: true }],
796
+ '@typescript-eslint/prefer-optional-chain': 'error',
797
+ '@typescript-eslint/prefer-promise-reject-errors': 'error',
798
+ '@typescript-eslint/prefer-readonly': 'error',
799
+ '@typescript-eslint/prefer-readonly-parameter-types': ['off', { ignoreInferredTypes: true }], // @todo An interface should ensure that it's properties are readonly, not every usage of it
800
+ '@typescript-eslint/prefer-reduce-type-parameter': 'error',
801
+ '@typescript-eslint/prefer-regexp-exec': 'error',
802
+ '@typescript-eslint/prefer-return-this-type': 'error',
803
+ '@typescript-eslint/prefer-string-starts-ends-with': 'error',
804
+ '@typescript-eslint/promise-function-async': 'error',
805
+ '@typescript-eslint/require-array-sort-compare': ['error', { ignoreStringArrays: true }],
806
+ '@typescript-eslint/require-await': 'off', // Sometimes a function is marked as async to have a consistent interface with other functions in a class, even if this specific function does not contain async code (yet)
807
+ '@typescript-eslint/restrict-plus-operands': 'error',
808
+ '@typescript-eslint/restrict-template-expressions': ['off', { // @todo Activate later. Doesn't work well yet, see https://github.com/typescript-eslint/typescript-eslint/issues/1797 or https://github.com/typescript-eslint/typescript-eslint/issues/1660
809
+ allowAny: true,
810
+ allowBoolean: true,
811
+ allowNullish: true,
812
+ allowNumber: true
813
+ }],
814
+ '@typescript-eslint/return-await': 'error',
815
+ '@typescript-eslint/sort-type-constituents': 'off', // Types should be sorted and grouped by priority and their meaning, not alphabetically
816
+ '@typescript-eslint/sort-type-union-intersection-members': 'off', // Types should be sorted and grouped by priority and their meaning, not alphabetically
817
+ '@typescript-eslint/strict-boolean-expressions': ['off', { allowNullable: true, allowSafe: true, ignoreRhs: true }], // @todo Doesn't work for specific code, check later after all linter warnings are fixed, maybe at some positions we can use '??'
818
+ '@typescript-eslint/switch-exhaustiveness-check': ['error', { considerDefaultExhaustiveForUnions: true }],
819
+ '@typescript-eslint/triple-slash-reference': 'error',
820
+ '@typescript-eslint/typedef': 'off', // We are using "noImplicitAny" in tsconfig.json instead
821
+ '@typescript-eslint/unbound-method': 'error',
822
+ '@typescript-eslint/unified-signatures': 'error',
823
+ '@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
824
+
825
+ /**
826
+ * eslint-plugin-functional
827
+ * @see https://github.com/jonaskello/eslint-plugin-functional#supported-rules
828
+ */
829
+ 'functional/functional-parameters': 'off',
830
+ 'functional/immutable-data': 'off', // This rule would require a lot of additional code and workarounds, which would make the result much more illegible // @todo is that resolved in v6.0.0?
831
+ 'functional/no-class-inheritance': 'off',
832
+ 'functional/no-classes': 'off',
833
+ 'functional/no-conditional-statements': 'off',
834
+ 'functional/no-expression-statements': ['off', { ignoreVoid: true }], // Creates too much false-positives // @todo is that resolved in v6.0.0?
835
+ 'functional/no-let': 'off', // This is better covered by the `prefer-const` rule
836
+ 'functional/no-loop-statements': 'off',
837
+ 'functional/no-mixed-types': ['error', {
838
+ checkInterfaces: false,
839
+ checkTypeLiterals: true
840
+ }],
841
+ 'functional/no-promise-reject': 'off',
842
+ 'functional/no-return-void': 'off',
843
+ 'functional/no-this-expressions': 'off',
844
+ 'functional/no-throw-statements': 'off',
845
+ 'functional/no-try-statements': 'off',
846
+ 'functional/prefer-immutable-types': 'off',
847
+ 'functional/prefer-property-signatures': 'off', // Covered by @typescript-eslint/method-signature-style
848
+ 'functional/prefer-tacit': 'off', // @see https://github.com/jonaskello/eslint-plugin-functional/issues/263
849
+ 'functional/readonly-type': ['error', 'keyword'],
850
+ 'functional/type-declaration-immutability': 'off',
851
+
852
+ /**
853
+ * eslint-plugin-import
854
+ * @see https://github.com/import-js/eslint-plugin-import
855
+ */
856
+ 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
857
+ 'import/default': 'error',
858
+ 'import/dynamic-import-chunkname': ['error', {
859
+ webpackChunknameFormat: '[0-9a-zA-Z-_/.+]+'
860
+ }],
861
+ 'import/export': 'error',
862
+ 'import/exports-last': 'off', // Exports should be declared first; helper functions last
863
+ 'import/extensions': 'off', // There is no check that it's really an extension or part of the file name. Misinterprets 'JavaDateTime' as extension in 'DateTime.JavaDateTime' for 'DateTime.DOSDateTime.ts'. So, we disable this rule
864
+ 'import/first': 'error',
865
+ 'import/group-exports': 'off',
866
+ 'import/max-dependencies': ['error', { max: 25, ignoreTypeImports: true }],
867
+ 'import/named': 'error',
868
+ 'import/namespace': ['error', { allowComputed: true }],
869
+ 'import/newline-after-import': ['error', { considerComments: false }],
870
+ 'import/no-absolute-path': 'error',
871
+ 'import/no-amd': 'error',
872
+ 'import/no-anonymous-default-export': 'error',
873
+ 'import/no-commonjs': 'error',
874
+ 'import/no-cycle': 'error',
875
+ 'import/no-default-export': 'error',
876
+ 'import/no-deprecated': 'error',
877
+ 'import/no-duplicates': 'error',
878
+ 'import/no-dynamic-require': 'error',
879
+ 'import/no-empty-named-blocks': 'error',
880
+ 'import/no-extraneous-dependencies': ['error', { includeTypes: true }],
881
+ 'import/no-internal-modules': ['off', { // @todo Throws an "Cannot read property 'value' of null" error in src/help/scss/help.scss.d.ts:2 since the update to v2.21.1. If this issue does not get fixed in the next releases, report it!
882
+ allow: [
883
+ 'workbox-window/utils/WorkboxEvent'
884
+ ]
885
+ }],
886
+ 'import/no-import-module-exports': 'off', // Activated only for JavaScript files
887
+ 'import/no-mutable-exports': 'error',
888
+ 'import/no-named-as-default-member': 'error',
889
+ 'import/no-named-as-default': 'error',
890
+ 'import/no-named-default': 'error',
891
+ 'import/no-named-export': 'off',
892
+ 'import/no-namespace': 'off', // @todo Enabling this produces a JavaScript error in the rule; anyhow - could that reduce the package size, because of improved tree-shaking/dead-code-elimination?
893
+ 'import/no-nodejs-modules': 'error',
894
+ 'import/no-relative-packages': 'error',
895
+ 'import/no-relative-parent-imports': 'off', // @todo Disabled because of a bug on Windows, re-enable as soon as it's resolved: https://github.com/import-js/eslint-plugin-import/issues/1644
896
+ 'import/no-restricted-paths': 'error',
897
+ 'import/no-self-import': 'error',
898
+ 'import/no-unassigned-import': ['error', {
899
+ allow: [
900
+ '**/*.scss',
901
+ 'jest-extended'
902
+ ]
903
+ }],
904
+ 'import/no-unresolved': ['error', { caseSensitiveStrict: true }],
905
+ 'import/no-unused-modules': ['off', { unusedExports: true }], // Disabled because of false-positive with `export type { ... }` + `import type { ... }`
906
+ 'import/no-useless-path-segments': 'error',
907
+ 'import/no-webpack-loader-syntax': 'off', // Indeed, you should avoid that, but if we do it, we have a reason for it
908
+ 'import/order': ['error', {
909
+ 'alphabetize': { order: 'asc', orderImportKind: 'asc', caseInsensitive: true },
910
+ 'groups': ['builtin', 'unknown', 'external', 'internal', 'parent', 'sibling', 'index'],
911
+ 'newlines-between': 'always',
912
+ 'pathGroupsExcludedImportTypes': [],
913
+ 'pathGroups': [
914
+ ...ensureType.array(linterBundleConfig.ts?.overrides?.general?.['import/order']?.additionalExternalPatterns).map(
915
+
916
+ /**
917
+ * Creates an "external" group using the additional external pattern configuration.
918
+ * @param {string} pattern - A given pattern
919
+ * @returns {{ pattern: string; group: 'external'; }} An "external" path configuration object
920
+ */
921
+ (pattern) => ({ pattern, group: 'external' })
922
+ ),
923
+ { pattern: '@*', group: 'internal' },
924
+ { pattern: '@*/**', group: 'internal' },
925
+ { pattern: '*!*/**', group: 'internal', position: 'after' } // Webpack loaders, e.g. 'worker-ref-loader!@app/components/FileFormatIdentificationDialog/TypeDetection.worker'
926
+ ],
927
+ 'distinctGroup': false
928
+ }],
929
+ 'import/prefer-default-export': 'off',
930
+ 'import/unambiguous': 'off',
931
+
932
+ /**
933
+ * eslint-plugin-eslint-comments
934
+ * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/
935
+ */
936
+ 'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
937
+ 'eslint-comments/no-aggregating-enable': 'error',
938
+ 'eslint-comments/no-duplicate-disable': 'error',
939
+ 'eslint-comments/no-unlimited-disable': 'off', // Covered by `unicorn/no-abusive-eslint-disable`
940
+ 'eslint-comments/no-unused-disable': 'error', // @todo What's the benefit over the `reportUnusedDisableDirectives` option?
941
+ 'eslint-comments/no-unused-enable': 'error',
942
+ 'eslint-comments/no-restricted-disable': 'off',
943
+ 'eslint-comments/no-use': 'off',
944
+ 'eslint-comments/require-description': ['error', { ignore: ['eslint-enable'] }],
945
+
946
+ /**
947
+ * eslint-plugin-promise
948
+ * @see https://github.com/xjamundx/eslint-plugin-promise
949
+ */
950
+ 'promise/always-return': 'off', // If the result of an `.then()` is not used, there is no need to return something.
951
+ 'promise/avoid-new': 'off',
952
+ 'promise/catch-or-return': 'error',
953
+ 'promise/no-callback-in-promise': 'off',
954
+ 'promise/no-multiple-resolved': 'error',
955
+ 'promise/no-native': 'off',
956
+ 'promise/no-nesting': 'off',
957
+ 'promise/no-new-statics': 'error',
958
+ 'promise/no-promise-in-callback': 'off',
959
+ 'promise/no-return-in-finally': 'error',
960
+ 'promise/no-return-wrap': 'error',
961
+ 'promise/param-names': 'off', // @todo Disabled until this issue is fixed: https://github.com/xjamundx/eslint-plugin-promise/issues/206
962
+ 'promise/prefer-await-to-callbacks': 'off', // It's not always possible to use avoid callbacks.
963
+ 'promise/prefer-await-to-then': 'off', // Depending on the use-case `.then()`/`.catch()` might be easier to understand
964
+ 'promise/prefer-catch': 'error',
965
+ 'promise/valid-params': 'off', // TypeScript ensures that
966
+ 'promise/spec-only': 'error',
967
+
968
+ /**
969
+ * eslint-plugin-unicorn
970
+ * @see https://github.com/sindresorhus/eslint-plugin-unicorn
971
+ */
972
+ 'unicorn/better-regex': 'error',
973
+ 'unicorn/catch-error-name': 'error',
974
+ 'unicorn/consistent-assert': 'error',
975
+ 'unicorn/consistent-date-clone': 'error',
976
+ 'unicorn/consistent-destructuring': 'off', // Depending on the usage, it makes sense to destructure e.g. `props` only partial.
977
+ 'unicorn/consistent-empty-array-spread': 'error',
978
+ 'unicorn/consistent-existence-index-check': 'error',
979
+ 'unicorn/consistent-function-scoping': 'error',
980
+ 'unicorn/custom-error-definition': 'off',
981
+ 'unicorn/empty-brace-spaces': 'error',
982
+ 'unicorn/error-message': 'error',
983
+ 'unicorn/escape-case': 'error',
984
+ 'unicorn/expiring-todo-comments': 'error',
985
+ 'unicorn/explicit-length-check': 'error',
986
+ 'unicorn/filename-case': ['off', { // Disabled in favour of the linter-bundle `files` task
987
+ cases: {
988
+ camelCase: true,
989
+ pascalCase: true
990
+ },
991
+ ignore: [
992
+ /([A-Za-z0-9]?[a-z0-9]+)*[A-Z]{2,4}([A-Za-z0-9]?[a-z0-9]+)*/u // Up to 4 Characters can be upper-case in a row (e.g. in `prepareDOM` or `SVGIcon`)
993
+ ]
994
+ }],
995
+ 'unicorn/import-style': ['error', {
996
+ styles: {
997
+ path: {
998
+ unassigned: false,
999
+ default: false,
1000
+ namespace: true,
1001
+ named: true
1002
+ }
1003
+ }
1004
+ }],
1005
+ 'unicorn/new-for-builtins': 'error',
1006
+ 'unicorn/no-abusive-eslint-disable': 'error',
1007
+ 'unicorn/no-accessor-recursion': 'error',
1008
+ 'unicorn/no-array-callback-reference': 'off', // If I use functions, they are the best option for this use-case
1009
+ 'unicorn/no-array-for-each': 'error',
1010
+ 'unicorn/no-array-method-this-argument': 'error',
1011
+ 'unicorn/no-array-push-push': 'error',
1012
+ 'unicorn/no-array-reduce': ['error', { allowSimpleOperations: true }],
1013
+ 'unicorn/no-await-expression-member': 'error',
1014
+ 'unicorn/no-console-spaces': 'error',
1015
+ 'unicorn/no-document-cookie': 'error',
1016
+ 'unicorn/no-empty-file': 'error',
1017
+ 'unicorn/no-for-loop': 'off', // @typescript-eslint/prefer-for-of
1018
+ 'unicorn/no-hex-escape': 'error',
1019
+ 'unicorn/no-instanceof-builtins': 'error',
1020
+ 'unicorn/no-invalid-fetch-options': 'error',
1021
+ 'unicorn/no-invalid-remove-event-listener': 'error',
1022
+ 'unicorn/no-keyword-prefix': 'off',
1023
+ 'unicorn/no-length-as-slice-end': 'error',
1024
+ 'unicorn/no-lonely-if': 'off', // Sometimes the code is clearer if-conditions are not combined
1025
+ 'unicorn/no-magic-array-flat-depth': 'error',
1026
+ 'unicorn/no-named-default': 'error',
1027
+ 'unicorn/no-negated-condition': 'off',
1028
+ 'unicorn/no-negation-in-equality-check': 'error',
1029
+ 'unicorn/no-nested-ternary': 'off', // We prefer no-nested-ternary of ESlint
1030
+ 'unicorn/no-new-array': 'off', // `new Array(length)` should be preferred over `Array.from({ length })` because it's much faster. @see https://jsben.ch/qTpYp
1031
+ 'unicorn/no-new-buffer': 'error',
1032
+ 'unicorn/no-null': 'off', // @todo Too much old native JavaScript functions are based on `null`. Maybe we can replace them later.
1033
+ 'unicorn/no-object-as-default-parameter': 'error',
1034
+ 'unicorn/no-process-exit': 'error',
1035
+ 'unicorn/no-static-only-class': 'error',
1036
+ 'unicorn/no-thenable': 'error',
1037
+ 'unicorn/no-this-assignment': 'error',
1038
+ 'unicorn/no-typeof-undefined': 'error',
1039
+ 'unicorn/no-unnecessary-await': 'error',
1040
+ 'unicorn/no-unnecessary-polyfills': 'error',
1041
+ 'unicorn/no-unreadable-array-destructuring': 'error',
1042
+ 'unicorn/no-unreadable-iife': 'error',
1043
+ 'unicorn/no-unused-properties': 'error',
1044
+ 'unicorn/no-useless-fallback-in-spread': 'error',
1045
+ 'unicorn/no-useless-promise-resolve-reject': 'error',
1046
+ 'unicorn/no-useless-length-check': 'error',
1047
+ 'unicorn/no-useless-spread': 'error',
1048
+ 'unicorn/no-useless-switch-case': 'error',
1049
+ 'unicorn/no-useless-undefined': 'off', // This rule conflicts with `@typescript-eslint/consistent-return`, which is preferred, as `return undefined` makes sense for a function which has the return type `undefined`.
1050
+ 'unicorn/no-zero-fractions': 'error',
1051
+ 'unicorn/number-literal-case': 'error',
1052
+ 'unicorn/numeric-separators-style': 'error',
1053
+ 'unicorn/prefer-add-event-listener': 'error',
1054
+ 'unicorn/prefer-array-find': 'error',
1055
+ 'unicorn/prefer-array-flat': 'error',
1056
+ 'unicorn/prefer-array-flat-map': 'error',
1057
+ 'unicorn/prefer-array-index-of': 'error',
1058
+ 'unicorn/prefer-array-some': 'error',
1059
+ 'unicorn/prefer-at': 'off', // @todo Disabled for now, since `at` is not supported by TypeScript type definitions yet.
1060
+ 'unicorn/prefer-blob-reading-methods': 'off', // @todo Disabled for now, since it's only supported in Safari 14+. Activate in 2025
1061
+ 'unicorn/prefer-code-point': 'error',
1062
+ 'unicorn/prefer-date-now': 'error',
1063
+ 'unicorn/prefer-default-parameters': 'error',
1064
+ 'unicorn/prefer-dom-node-append': 'error',
1065
+ 'unicorn/prefer-dom-node-dataset': 'off', // `setAttribute` is faster than `dataset`. See https://www.measurethat.net/Benchmarks/Show/7740/0/classname-vs-setattribute-vs-classlist-vs-dataset
1066
+ 'unicorn/prefer-dom-node-remove': 'error',
1067
+ 'unicorn/prefer-dom-node-text-content': 'error',
1068
+ 'unicorn/prefer-event-target': 'off', // @todo Disabled for now, since `EventTarget` requires Node.js 16. Activate in 2025
1069
+ 'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }],
1070
+ 'unicorn/prefer-global-this': 'error',
1071
+ 'unicorn/prefer-includes': 'error',
1072
+ 'unicorn/prefer-json-parse-buffer': 'off', // TypeScript states that string needs to be used as of the ES specification. @see https://github.com/microsoft/TypeScript/issues/11842
1073
+ 'unicorn/prefer-keyboard-event-key': 'error',
1074
+ 'unicorn/prefer-logical-operator-over-ternary': 'error',
1075
+ 'unicorn/prefer-math-min-max': 'error',
1076
+ 'unicorn/prefer-math-trunc': 'error',
1077
+ 'unicorn/prefer-modern-dom-apis': 'error',
1078
+ 'unicorn/prefer-modern-math-apis': 'error',
1079
+ 'unicorn/prefer-module': 'off',
1080
+ 'unicorn/prefer-native-coercion-functions': 'off',
1081
+ 'unicorn/prefer-negative-index': 'error',
1082
+ 'unicorn/prefer-number-properties': 'error',
1083
+ 'unicorn/prefer-object-has-own': 'off', // Not widely supported yet. Can be activated in 2024
1084
+ 'unicorn/prefer-object-from-entries': 'error',
1085
+ 'unicorn/prefer-optional-catch-binding': 'error',
1086
+ 'unicorn/prefer-prototype-methods': 'error',
1087
+ 'unicorn/prefer-query-selector': 'off', // document.getElementById() is much faster
1088
+ 'unicorn/prefer-reflect-apply': 'error',
1089
+ 'unicorn/prefer-set-has': 'error',
1090
+ 'unicorn/prefer-set-size': 'error',
1091
+ 'unicorn/prefer-spread': 'off', // @todo Disabled till there a solution for the warning, that `slice()` on Typed-Arrays should be replaced (which is not possible). @see https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1064
1092
+ 'unicorn/prefer-string-raw': 'error',
1093
+ 'unicorn/prefer-string-replace-all': 'off', // @todo Available since 2020 in browsers. Should this be preferred?
1094
+ 'unicorn/prefer-string-slice': 'off', // @todo As of today (2020.08.24) and since the last 9 years, substr() is three times faster than slice() in Firefox.
1095
+ 'unicorn/prefer-string-starts-ends-with': 'error',
1096
+ 'unicorn/prefer-string-trim-start-end': 'error',
1097
+ 'unicorn/prefer-structured-clone': 'error',
1098
+ 'unicorn/prefer-switch': 'error',
1099
+ 'unicorn/prefer-ternary': 'off', // We prefer readability over saving a few chars
1100
+ 'unicorn/prefer-top-level-await': 'off', // @todo Available since 2021. Activate in 2024
1101
+ 'unicorn/prefer-regexp-test': 'error',
1102
+ 'unicorn/prefer-type-error': 'error',
1103
+ 'unicorn/prevent-abbreviations': ['error', { ignore: ['args', 'i', 'j', 'i18n', /[Rr]ef/u, /[Pp]arams/u, /[Pp]rops/u] }],
1104
+ 'unicorn/relative-url-style': 'error',
1105
+ 'unicorn/require-array-join-separator': 'error',
1106
+ 'unicorn/require-number-to-fixed-digits-argument': 'error',
1107
+ 'unicorn/require-post-message-target-origin': 'off', // False-positive with Workers which don't support a `targetOrigin`
1108
+ 'unicorn/string-content': 'off', // Breaks code (e.g. imports with `...` in Next.js or GraphQL template strings),
1109
+ 'unicorn/switch-case-braces': ['error', 'avoid'],
1110
+ 'unicorn/template-indent': 'error',
1111
+ 'unicorn/text-encoding-identifier-case': 'off',
1112
+ 'unicorn/throw-new-error': 'error'
1113
+ }
1114
+ },
1115
+ {
1116
+ files: [
1117
+ '.linter-bundle.js',
1118
+ '*.config.js',
1119
+ '*.config.mjs'
1120
+ ],
1121
+ rules: {
1122
+ // The configuration files needs to have default exports.
1123
+ 'import/no-default-export': 'off',
1124
+ 'import/no-anonymous-default-export': 'off'
1125
+ }
1126
+ }
1127
+ ];