@averay/codeformat 0.1.14 → 0.2.1

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.
@@ -0,0 +1,350 @@
1
+ /* eslint import/no-named-as-default-member: "off" -- All plugins follow the same naming conventions. */
2
+
3
+ import stylisticPlugin from '@stylistic/eslint-plugin';
4
+ import { type TSESLint } from '@typescript-eslint/utils';
5
+ import eslintCommentsPlugin from 'eslint-plugin-eslint-comments';
6
+ import importPlugin from 'eslint-plugin-import';
7
+ import jsdocPlugin from 'eslint-plugin-jsdoc';
8
+ import promisePlugin from 'eslint-plugin-promise';
9
+ import regexpPlugin from 'eslint-plugin-regexp';
10
+ import sonarjsPlugin from 'eslint-plugin-sonarjs';
11
+ import unicornPlugin from 'eslint-plugin-unicorn';
12
+
13
+ export default {
14
+ ...{
15
+ 'accessor-pairs': ['error', { setWithoutGet: true }],
16
+ 'array-callback-return': 'error',
17
+ 'block-scoped-var': 'error',
18
+ 'capitalized-comments': ['error', 'always', { ignoreConsecutiveComments: true }],
19
+ 'consistent-return': 'error',
20
+ 'consistent-this': ['error', '_this'],
21
+ 'constructor-super': 'error',
22
+ curly: ['error', 'all'],
23
+ 'default-case': 'error',
24
+ 'default-case-last': 'error',
25
+ 'default-param-last': 'error',
26
+ 'dot-notation': 'error',
27
+ eqeqeq: ['error', 'always', { null: 'ignore' }],
28
+ 'for-direction': 'error',
29
+ 'func-names': ['error', 'as-needed'],
30
+ 'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
31
+ 'getter-return': 'error',
32
+ 'global-require': 'error',
33
+ 'grouped-accessor-pairs': ['error', 'getBeforeSet'],
34
+ 'guard-for-in': 'error',
35
+ 'id-denylist': ['error', 'cb', 'e', 'enc', 'err', 'evt'],
36
+ 'lines-between-class-members': 'error',
37
+ 'logical-assignment-operators': ['error', 'always'],
38
+ 'max-classes-per-file': ['error', 1],
39
+ 'max-statements-per-line': 'error',
40
+ 'multiline-comment-style': 'error',
41
+ 'new-cap': ['error', { properties: true }],
42
+ 'no-alert': 'error',
43
+ 'no-array-constructor': 'error',
44
+ 'no-async-promise-executor': 'error',
45
+ 'no-await-in-loop': 'error',
46
+ 'no-bitwise': 'error',
47
+ 'no-buffer-constructor': 'error',
48
+ 'no-caller': 'error',
49
+ 'no-case-declarations': 'error',
50
+ 'no-class-assign': 'error',
51
+ 'no-compare-neg-zero': 'error',
52
+ 'no-cond-assign': 'error',
53
+ 'no-const-assign': 'error',
54
+ 'no-constant-binary-expression': 'error',
55
+ 'no-constant-condition': 'error',
56
+ 'no-constructor-return': 'error',
57
+ 'no-control-regex': 'error',
58
+ 'no-debugger': 'error',
59
+ 'no-delete-var': 'error',
60
+ 'no-div-regex': 'error',
61
+ 'no-dupe-args': 'error',
62
+ 'no-dupe-class-members': 'error',
63
+ 'no-dupe-else-if': 'error',
64
+ 'no-dupe-keys': 'error',
65
+ 'no-duplicate-case': 'error',
66
+ 'no-duplicate-imports': 'error',
67
+ 'no-empty': 'error',
68
+ 'no-empty-character-class': 'error',
69
+ 'no-empty-function': 'error',
70
+ 'no-empty-pattern': 'error',
71
+ 'no-empty-static-block': 'error',
72
+ 'no-eval': 'error',
73
+ 'no-ex-assign': 'error',
74
+ 'no-extend-native': 'error',
75
+ 'no-extra-bind': 'error',
76
+ 'no-extra-boolean-cast': 'error',
77
+ 'no-extra-label': 'error',
78
+ 'no-fallthrough': 'error',
79
+ 'no-func-assign': 'error',
80
+ 'no-global-assign': 'error',
81
+ 'no-implicit-coercion': 'error',
82
+ 'no-implicit-globals': 'error',
83
+ 'no-implied-eval': 'error',
84
+ 'no-import-assign': 'error',
85
+ 'no-inner-declarations': 'error',
86
+ 'no-invalid-regexp': 'error',
87
+ 'no-invalid-this': 'error',
88
+ 'no-irregular-whitespace': 'error',
89
+ 'no-iterator': 'error',
90
+ 'no-label-var': 'error',
91
+ 'no-labels': ['error', { allowLoop: true }],
92
+ 'no-lone-blocks': 'error',
93
+ 'no-loop-func': 'error',
94
+ 'no-loss-of-precision': 'error',
95
+ 'no-magic-numbers': [
96
+ 'error',
97
+ {
98
+ detectObjects: true,
99
+ enforceConst: true,
100
+ ignore: [-1, 0, 1],
101
+ ignoreArrayIndexes: true,
102
+ ignoreClassFieldInitialValues: true,
103
+ ignoreDefaultValues: true,
104
+ },
105
+ ],
106
+ 'no-misleading-character-class': 'error',
107
+ 'no-mixed-requires': 'error',
108
+ 'no-multi-assign': 'error',
109
+ 'no-multi-str': 'error',
110
+ 'no-nested-ternary': 'error',
111
+ 'no-new': 'error',
112
+ 'no-new-func': 'error',
113
+ 'no-new-native-nonconstructor': 'error',
114
+ 'no-new-object': 'error',
115
+ 'no-new-require': 'error',
116
+ 'no-new-symbol': 'error',
117
+ 'no-new-wrappers': 'error',
118
+ 'no-nonoctal-decimal-escape': 'error',
119
+ 'no-obj-calls': 'error',
120
+ 'no-octal': 'error',
121
+ 'no-octal-escape': 'error',
122
+ 'no-path-concat': 'error',
123
+ 'no-plusplus': 'error',
124
+ 'no-process-env': 'error',
125
+ 'no-process-exit': 'error',
126
+ 'no-promise-executor-return': 'error',
127
+ 'no-proto': 'error',
128
+ 'no-prototype-builtins': 'error',
129
+ 'no-redeclare': 'error',
130
+ 'no-regex-spaces': 'error',
131
+ 'no-restricted-globals': ['error', 'event'],
132
+ 'no-restricted-syntax': ['error', 'WithStatement', "BinaryExpression[operator='in']"],
133
+ 'no-return-assign': 'error',
134
+ 'no-return-await': 'error',
135
+ 'no-script-url': 'error',
136
+ 'no-self-assign': 'error',
137
+ 'no-self-compare': 'error',
138
+ 'no-sequences': 'error',
139
+ 'no-setter-return': 'error',
140
+ 'no-shadow': ['error', { hoist: 'all' }],
141
+ 'no-shadow-restricted-names': 'error',
142
+ 'no-sparse-arrays': 'error',
143
+ 'no-template-curly-in-string': 'error',
144
+ 'no-this-before-super': 'error',
145
+ 'no-throw-literal': 'error',
146
+ 'no-undef': 'error',
147
+ 'no-undef-init': 'error',
148
+ 'no-underscore-dangle': [
149
+ 'error',
150
+ {
151
+ allow: ['_', '_this', '_1', '_2', '_3', '_4', '_5', '_6', '_7', '_8', '_9'],
152
+ allowAfterSuper: true,
153
+ allowAfterThis: true,
154
+ allowAfterThisConstructor: true,
155
+ allowFunctionParams: false,
156
+ allowInArrayDestructuring: false,
157
+ enforceInClassFields: true,
158
+ enforceInMethodNames: true,
159
+ },
160
+ ],
161
+ 'no-unmodified-loop-condition': 'error',
162
+ 'no-unneeded-ternary': 'error',
163
+ 'no-unreachable': 'error',
164
+ 'no-unreachable-loop': 'error',
165
+ 'no-unsafe-finally': 'error',
166
+ 'no-unsafe-negation': 'error',
167
+ 'no-unsafe-optional-chaining': 'error',
168
+ 'no-unused-expressions': 'error',
169
+ 'no-unused-labels': 'error',
170
+ 'no-unused-private-class-members': 'error',
171
+ 'no-unused-vars': [
172
+ 'error',
173
+ {
174
+ argsIgnorePattern: /^_\w*$/u.source,
175
+ caughtErrorsIgnorePattern: /^_\w*$/u.source,
176
+ varsIgnorePattern: /^(_\d*|React)$/u.source,
177
+ },
178
+ ],
179
+ 'no-use-before-define': 'error',
180
+ 'no-useless-backreference': 'error',
181
+ 'no-useless-call': 'error',
182
+ 'no-useless-catch': 'error',
183
+ 'no-useless-computed-key': ['error', { enforceForClassMembers: true }],
184
+ 'no-useless-concat': 'error',
185
+ 'no-useless-constructor': 'error',
186
+ 'no-useless-escape': 'error',
187
+ 'no-useless-rename': 'error',
188
+ 'no-useless-return': 'error',
189
+ 'no-var': 'error',
190
+ 'no-void': 'error',
191
+ 'no-with': 'error',
192
+ 'object-shorthand': ['error', 'always', { avoidExplicitReturnArrows: true, avoidQuotes: true }],
193
+ 'one-var': ['error', 'never'],
194
+ 'operator-assignment': 'error',
195
+ 'padding-line-between-statements': [
196
+ 'error',
197
+ /* eslint-disable sort-keys -- Logically ordered */
198
+ { blankLine: 'always', prev: 'directive', next: '*' },
199
+ { blankLine: 'always', prev: 'function', next: 'function' },
200
+ /* eslint-enable sort-keys -- Restore */
201
+ ],
202
+ 'prefer-arrow-callback': 'error',
203
+ 'prefer-const': 'error',
204
+ 'prefer-destructuring': 'error',
205
+ 'prefer-exponentiation-operator': 'error',
206
+ 'prefer-numeric-literals': 'error',
207
+ 'prefer-object-spread': 'error',
208
+ 'prefer-promise-reject-errors': 'error',
209
+ 'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
210
+ 'prefer-rest-params': 'error',
211
+ 'prefer-spread': 'error',
212
+ 'prefer-template': 'error',
213
+ radix: 'error',
214
+ 'require-atomic-updates': 'error',
215
+ 'require-unicode-regexp': 'error',
216
+ 'require-yield': 'error',
217
+ 'spaced-comment': 'error',
218
+ 'symbol-description': 'error',
219
+ 'use-isnan': 'error',
220
+ 'valid-typeof': 'error',
221
+ 'vars-on-top': 'error',
222
+ yoda: 'error',
223
+ },
224
+
225
+ ...eslintCommentsPlugin.configs.recommended.rules,
226
+ 'eslint-comments/no-unused-disable': 'error',
227
+ 'eslint-comments/require-description': 'error',
228
+
229
+ ...importPlugin.configs.recommended.rules,
230
+ 'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
231
+ 'import/first': ['error', 'absolute-first'],
232
+ 'import/newline-after-import': 'error',
233
+ 'import/no-absolute-path': 'error',
234
+ 'import/no-amd': 'error',
235
+ 'import/no-anonymous-default-export': [
236
+ 'error',
237
+ { allowArray: true, allowCallExpression: true, allowLiteral: true, allowNew: true, allowObject: true },
238
+ ],
239
+ 'import/no-commonjs': 'error',
240
+ 'import/no-cycle': ['error', { ignoreExternal: true }],
241
+ 'import/no-duplicates': 'error',
242
+ 'import/no-dynamic-require': 'error',
243
+ 'import/no-empty-named-blocks': 'error',
244
+ 'import/no-extraneous-dependencies': 'error',
245
+ 'import/no-mutable-exports': 'error',
246
+ 'import/no-named-as-default-member': 'error',
247
+ 'import/no-named-default': 'error',
248
+ 'import/no-self-import': 'error',
249
+ 'import/no-unresolved': ['error', { caseSensitiveStrict: true }],
250
+ 'import/no-unused-modules': 'error',
251
+ 'import/no-useless-path-segments': 'error',
252
+ 'import/no-webpack-loader-syntax': 'error',
253
+ 'import/order': [
254
+ 'error',
255
+ {
256
+ alphabetize: { caseInsensitive: true, order: 'asc' },
257
+ groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
258
+ 'newlines-between': 'always',
259
+ },
260
+ ],
261
+ 'import/prefer-default-export': 'off', // Causes friction when creating a utilities file with a single export in advance of adding additional exports.
262
+
263
+ ...jsdocPlugin.configs.recommended.rules,
264
+ 'jsdoc/check-indentation': 'error',
265
+ 'jsdoc/check-param-names': ['error', { checkDestructured: false }],
266
+ 'jsdoc/check-syntax': 'error',
267
+ 'jsdoc/match-description': ['error', { matchDescription: '[A-Z]', tags: { param: true, returns: true } }],
268
+ 'jsdoc/no-bad-blocks': 'error',
269
+ 'jsdoc/no-defaults': 'error',
270
+ 'jsdoc/require-asterisk-prefix': 'error',
271
+ 'jsdoc/require-jsdoc': 'off',
272
+ 'jsdoc/require-param': [
273
+ 'error',
274
+ {
275
+ checkConstructors: false,
276
+ checkDestructured: false,
277
+ ignoreWhenAllParamsMissing: true,
278
+ },
279
+ ],
280
+ 'jsdoc/require-returns': 'off',
281
+ 'jsdoc/sort-tags': 'error',
282
+ 'jsdoc/tag-lines': ['error', 'any', { startLines: 1 }],
283
+
284
+ ...promisePlugin.configs.recommended.rules,
285
+ 'promise/always-return': ['error', { ignoreAssignmentVariable: ['globalThis', 'window'], ignoreLastCallback: true }],
286
+ 'promise/no-multiple-resolved': 'error',
287
+
288
+ ...regexpPlugin.configs.recommended.rules,
289
+ 'regexp/hexadecimal-escape': ['error', 'never'],
290
+ 'regexp/letter-case': 'error',
291
+ 'regexp/no-empty-character-class': 'error',
292
+ 'regexp/no-extra-lookaround-assertions': 'error',
293
+ 'regexp/no-misleading-capturing-group': 'error',
294
+ 'regexp/no-misleading-unicode-character': 'error',
295
+ 'regexp/no-missing-g-flag': 'error',
296
+ 'regexp/no-octal': 'error',
297
+ 'regexp/no-standalone-backslash': 'error',
298
+ 'regexp/prefer-escape-replacement-dollar-char': 'error',
299
+ 'regexp/prefer-named-backreference': 'error',
300
+ 'regexp/prefer-named-replacement': 'error',
301
+ 'regexp/prefer-quantifier': 'error',
302
+ 'regexp/prefer-result-array-groups': 'error',
303
+ 'regexp/unicode-escape': 'error',
304
+ 'regexp/use-ignore-case': 'error',
305
+
306
+ ...sonarjsPlugin.configs.recommended.rules,
307
+ 'sonarjs/cognitive-complexity': 'off',
308
+ 'sonarjs/function-return-type': 'off', // Overly restrictive.
309
+ 'sonarjs/max-switch-cases': 'off',
310
+ 'sonarjs/no-inverted-boolean-check': 'error',
311
+ 'sonarjs/no-nested-template-literals': 'off',
312
+ 'sonarjs/no-selector-parameter': 'off', // Overly restrictive.
313
+ 'sonarjs/no-small-switch': 'off',
314
+ 'sonarjs/prefer-immediate-return': 'off',
315
+ 'sonarjs/prefer-regexp-exec': 'off',
316
+ 'sonarjs/prefer-single-boolean-return': 'off',
317
+
318
+ ...stylisticPlugin.configs['recommended-flat'].rules,
319
+ '@stylistic/arrow-parens': 'off',
320
+ '@stylistic/brace-style': 'off',
321
+ '@stylistic/indent': 'off',
322
+ '@stylistic/indent-binary-ops': 'off',
323
+ '@stylistic/jsx-indent-props': 'off',
324
+ '@stylistic/jsx-one-expression-per-line': 'off',
325
+ '@stylistic/jsx-wrap-multilines': 'off',
326
+ '@stylistic/member-delimiter-style': 'off',
327
+ '@stylistic/multiline-ternary': 'off',
328
+ '@stylistic/no-multiple-empty-line': 'off',
329
+ '@stylistic/operator-linebreak': 'off',
330
+ '@stylistic/padding-line-between-statements': [
331
+ 'error',
332
+ /* eslint-disable sort-keys -- Logically ordered */
333
+ { blankLine: 'always', prev: 'directive', next: '*' },
334
+ { blankLine: 'always', prev: 'function', next: 'function' },
335
+ /* eslint-enable sort-keys -- Logically ordered */
336
+ ],
337
+ '@stylistic/quote-props': 'off',
338
+ '@stylistic/quotes': 'off',
339
+ '@stylistic/semi': 'off',
340
+
341
+ ...unicornPlugin.configs.recommended.rules,
342
+ 'unicorn/consistent-function-scoping': ['error', { checkArrowFunctions: false }],
343
+ 'unicorn/filename-case': 'off',
344
+ 'unicorn/no-null': 'off',
345
+ 'unicorn/no-useless-undefined': 'off', // Conflicts with `consistent-return`.
346
+ 'unicorn/prefer-event-target': 'error',
347
+ 'unicorn/prefer-query-selector': 'off',
348
+ 'unicorn/prevent-abbreviations': 'off',
349
+ 'unicorn/require-post-message-target-origin': 'error',
350
+ } satisfies TSESLint.FlatConfig.Rules;
@@ -0,0 +1,239 @@
1
+ import js from '@eslint/js';
2
+ import typescriptPlugin from '@typescript-eslint/eslint-plugin';
3
+ import { type TSESLint } from '@typescript-eslint/utils';
4
+ import importPlugin from 'eslint-plugin-import';
5
+
6
+ export default {
7
+ ...js.configs.recommended.rules,
8
+ ...importPlugin.configs.typescript.rules,
9
+ ...typescriptPlugin.configs['eslint-recommended']?.rules,
10
+ ...typescriptPlugin.configs['recommended']?.rules,
11
+ ...typescriptPlugin.configs['recommended-requiring-type-checking']?.rules,
12
+ ...typescriptPlugin.configs['strict']?.rules,
13
+
14
+ ...{
15
+ 'array-callback-return': 'off',
16
+ 'consistent-return': 'off',
17
+ 'default-case': 'off',
18
+ 'default-param-last': 'off',
19
+ 'dot-notation': 'off',
20
+ 'lines-between-class-members': 'off',
21
+ 'no-array-constructor': 'off',
22
+ 'no-dupe-class-members': 'off',
23
+ 'no-duplicate-imports': 'off',
24
+ 'no-empty-function': 'off',
25
+ 'no-implied-eval': 'off',
26
+ 'no-invalid-this': 'off',
27
+ 'no-loop-func': 'off',
28
+ 'no-loss-of-precision': 'off',
29
+ 'no-magic-numbers': 'off',
30
+ 'no-redeclare': 'off',
31
+ 'no-restricted-imports': 'off',
32
+ 'no-restricted-syntax': ['error', 'WithStatement'],
33
+ 'no-return-await': 'off',
34
+ 'no-shadow': 'off',
35
+ 'no-throw-literal': 'off',
36
+ 'no-unused-expressions': 'off',
37
+ 'no-unused-vars': 'off',
38
+ 'no-use-before-define': 'off',
39
+ 'no-useless-constructor': 'off',
40
+ 'padding-line-between-statements': 'off',
41
+ },
42
+
43
+ '@typescript-eslint/adjacent-overload-signatures': 'error',
44
+ '@typescript-eslint/array-type': 'error',
45
+ '@typescript-eslint/await-thenable': 'error',
46
+ '@typescript-eslint/ban-ts-comment': 'error',
47
+ '@typescript-eslint/class-literal-property-style': 'off', // Breaks subclassed getters
48
+ '@typescript-eslint/consistent-indexed-object-style': 'error',
49
+ '@typescript-eslint/consistent-type-assertions': [
50
+ 'error',
51
+ { assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' },
52
+ ],
53
+ '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
54
+ '@typescript-eslint/consistent-type-exports': ['error', { fixMixedExportsWithInlineTypeSpecifier: true }],
55
+ '@typescript-eslint/consistent-type-imports': 'error',
56
+ '@typescript-eslint/default-param-last': 'error',
57
+ '@typescript-eslint/dot-notation': 'error',
58
+ '@typescript-eslint/explicit-function-return-type': ['error', { allowExpressions: true }],
59
+ '@typescript-eslint/explicit-member-accessibility': ['error', { overrides: { constructors: 'no-public' } }],
60
+ '@typescript-eslint/explicit-module-boundary-types': ['error', { allowArgumentsExplicitlyTypedAsAny: true }],
61
+ '@typescript-eslint/member-ordering': 'off',
62
+ '@typescript-eslint/method-signature-style': 'off',
63
+ '@typescript-eslint/naming-convention': [
64
+ 'error',
65
+ /* eslint-disable sort-keys -- Logically ordered */
66
+ {
67
+ selector: 'default',
68
+ format: ['strictCamelCase'],
69
+ },
70
+ {
71
+ selector: 'import',
72
+ format: ['strictCamelCase', 'StrictPascalCase', 'UPPER_CASE'],
73
+ },
74
+ {
75
+ selector: 'variable',
76
+ modifiers: ['const'],
77
+ format: ['strictCamelCase', 'StrictPascalCase', 'UPPER_CASE'],
78
+ },
79
+ {
80
+ selector: 'variable',
81
+ modifiers: ['const'],
82
+ filter: { regex: /^_(static|\d+)?$/u.source, match: true },
83
+ format: ['strictCamelCase'],
84
+ leadingUnderscore: 'allow',
85
+ },
86
+ {
87
+ selector: 'parameter',
88
+ format: ['strictCamelCase'],
89
+ leadingUnderscore: 'allow',
90
+ },
91
+ {
92
+ selector: 'property',
93
+ format: ['strictCamelCase', 'UPPER_CASE'],
94
+ },
95
+ {
96
+ selector: 'classProperty',
97
+ modifiers: ['static'],
98
+ format: ['strictCamelCase', 'StrictPascalCase', 'UPPER_CASE'],
99
+ },
100
+ {
101
+ selector: 'enumMember',
102
+ format: ['strictCamelCase', 'StrictPascalCase', 'UPPER_CASE'],
103
+ },
104
+ {
105
+ selector: 'function',
106
+ format: ['strictCamelCase', 'StrictPascalCase'],
107
+ },
108
+ {
109
+ selector: 'typeLike',
110
+ format: ['StrictPascalCase'],
111
+ },
112
+ {
113
+ selector: ['objectLiteralProperty'],
114
+ format: null,
115
+ },
116
+ {
117
+ selector: ['classProperty', 'objectLiteralMethod'],
118
+ format: ['strictCamelCase', 'UPPER_CASE'],
119
+ },
120
+ {
121
+ selector: 'typeParameter',
122
+ format: ['StrictPascalCase'],
123
+ custom: { regex: /^([A-Z]|T[A-Z][a-zA-Z]+|key)$/u.source, match: true },
124
+ },
125
+ /* eslint-enable sort-keys -- Logically ordered */
126
+ ],
127
+ '@typescript-eslint/no-array-constructor': 'error',
128
+ '@typescript-eslint/no-base-to-string': 'error',
129
+ '@typescript-eslint/no-confusing-non-null-assertion': 'error',
130
+ '@typescript-eslint/no-confusing-void-expression': 'error',
131
+ '@typescript-eslint/no-dupe-class-members': 'error',
132
+ '@typescript-eslint/no-dynamic-delete': 'off',
133
+ '@typescript-eslint/no-empty-function': 'error',
134
+ '@typescript-eslint/no-empty-interface': ['error', { allowSingleExtends: true }],
135
+ '@typescript-eslint/no-explicit-any': 'off',
136
+ '@typescript-eslint/no-extra-non-null-assertion': 'error',
137
+ '@typescript-eslint/no-extraneous-class': 'error',
138
+ '@typescript-eslint/no-floating-promises': 'error',
139
+ '@typescript-eslint/no-for-in-array': 'error',
140
+ '@typescript-eslint/no-implied-eval': 'error',
141
+ '@typescript-eslint/no-inferrable-types': ['error', { ignoreParameters: true }],
142
+ '@typescript-eslint/no-invalid-this': 'error',
143
+ '@typescript-eslint/no-invalid-void-type': 'error',
144
+ '@typescript-eslint/no-loop-func': 'error',
145
+ '@typescript-eslint/no-loss-of-precision': 'error',
146
+ '@typescript-eslint/no-magic-numbers': [
147
+ 'error',
148
+ {
149
+ detectObjects: true,
150
+ enforceConst: true,
151
+ ignore: [-1, 0, 1, 2, 100, '0n'],
152
+ ignoreArrayIndexes: true,
153
+ ignoreClassFieldInitialValues: true,
154
+ ignoreDefaultValues: true,
155
+ },
156
+ ],
157
+ '@typescript-eslint/no-meaningless-void-operator': 'error',
158
+ '@typescript-eslint/no-misused-new': 'error',
159
+ '@typescript-eslint/no-misused-promises': 'error',
160
+ '@typescript-eslint/no-namespace': 'error',
161
+ '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
162
+ '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
163
+ '@typescript-eslint/no-non-null-assertion': 'error',
164
+ '@typescript-eslint/no-redeclare': 'error',
165
+ '@typescript-eslint/no-require-imports': 'error',
166
+ '@typescript-eslint/no-restricted-imports': 'error',
167
+ '@typescript-eslint/no-shadow': ['error', { hoist: 'all' }],
168
+ '@typescript-eslint/no-this-alias': 'error',
169
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
170
+ '@typescript-eslint/no-unnecessary-condition': ['error', { allowConstantLoopConditions: true }],
171
+ '@typescript-eslint/no-unnecessary-qualifier': 'error',
172
+ '@typescript-eslint/no-unnecessary-type-arguments': 'error',
173
+ '@typescript-eslint/no-unnecessary-type-assertion': 'error',
174
+ '@typescript-eslint/no-unnecessary-type-constraint': 'error',
175
+ '@typescript-eslint/no-unused-expressions': 'error',
176
+ '@typescript-eslint/no-unused-vars': [
177
+ 'error',
178
+ {
179
+ argsIgnorePattern: /^_\w*$/u.source,
180
+ caughtErrorsIgnorePattern: /^_\w*$/u.source,
181
+ varsIgnorePattern: /^(_\d*|React)$/u.source,
182
+ },
183
+ ],
184
+ '@typescript-eslint/no-use-before-define': 'error',
185
+ '@typescript-eslint/no-useless-constructor': 'error',
186
+ '@typescript-eslint/no-useless-empty-export': 'error',
187
+ '@typescript-eslint/no-var-requires': 'error',
188
+ '@typescript-eslint/non-nullable-type-assertion-style': 'error',
189
+ '@typescript-eslint/only-throw-error': 'error',
190
+ '@typescript-eslint/prefer-as-const': 'error',
191
+ '@typescript-eslint/prefer-enum-initializers': 'error',
192
+ '@typescript-eslint/prefer-for-of': 'error',
193
+ '@typescript-eslint/prefer-function-type': 'error',
194
+ '@typescript-eslint/prefer-includes': 'error',
195
+ '@typescript-eslint/prefer-literal-enum-member': 'error',
196
+ '@typescript-eslint/prefer-namespace-keyword': 'error',
197
+ '@typescript-eslint/prefer-nullish-coalescing': [
198
+ 'error',
199
+ { ignoreConditionalTests: false, ignoreMixedLogicalExpressions: false },
200
+ ],
201
+ '@typescript-eslint/prefer-optional-chain': 'error',
202
+ '@typescript-eslint/prefer-readonly': 'error',
203
+ '@typescript-eslint/prefer-reduce-type-parameter': 'error',
204
+ '@typescript-eslint/prefer-return-this-type': 'error',
205
+ '@typescript-eslint/prefer-string-starts-ends-with': 'error',
206
+ '@typescript-eslint/prefer-ts-expect-error': 'error',
207
+ '@typescript-eslint/promise-function-async': 'error',
208
+ '@typescript-eslint/require-array-sort-compare': 'error',
209
+ '@typescript-eslint/restrict-plus-operands': 'error',
210
+ '@typescript-eslint/restrict-template-expressions': 'error',
211
+ '@typescript-eslint/return-await': 'error',
212
+ '@typescript-eslint/strict-boolean-expressions': [
213
+ 'error',
214
+ { allowNullableObject: false, allowNullableString: false, allowNumber: false, allowString: false },
215
+ ],
216
+ '@typescript-eslint/switch-exhaustiveness-check': [
217
+ 'error',
218
+ {
219
+ allowDefaultCaseForExhaustiveSwitch: false,
220
+ considerDefaultExhaustiveForUnions: true,
221
+ requireDefaultForNonUnion: true,
222
+ },
223
+ ],
224
+ '@typescript-eslint/triple-slash-reference': 'error',
225
+ '@typescript-eslint/unbound-method': 'off', // Does not support @autobind nor recognise binding in constructors
226
+ '@typescript-eslint/unified-signatures': 'off',
227
+
228
+ 'import/no-duplicates': 'off', // Breaks if importing both default and named exports as types (https://github.com/import-js/eslint-plugin-import/issues/2007).
229
+
230
+ 'jsdoc/no-types': 'error',
231
+ 'jsdoc/require-param-type': 'off',
232
+ 'jsdoc/require-returns-type': 'off',
233
+
234
+ 'sonarjs/super-invocation': 'off', // Causes issues and is enforced by TypeScript already.
235
+ } satisfies TSESLint.FlatConfig.Rules;
236
+
237
+ export const moduleDeclarations = {
238
+ 'no-duplicate-imports': 'off', // Allow imports within multiple module declarations.
239
+ } satisfies TSESLint.FlatConfig.Rules;
@@ -0,0 +1,38 @@
1
+ import propertiesOrder from '@averay/css-properties-sort-order';
2
+ import recommended from 'stylelint-config-recommended';
3
+ import standard from 'stylelint-config-standard';
4
+
5
+ import patterns from '../../lib/cssPatterns.ts';
6
+
7
+ export default {
8
+ ...recommended.rules,
9
+ ...standard.rules,
10
+
11
+ // Core rules
12
+ ...{
13
+ 'color-named': 'never',
14
+ 'function-url-no-scheme-relative': true,
15
+ },
16
+
17
+ // Disable Prettier conflicts
18
+ ...{
19
+ 'at-rule-empty-line-before': null,
20
+ 'comment-empty-line-before': null,
21
+ 'rule-empty-line-before': null,
22
+ },
23
+
24
+ // Patterns
25
+ ...{
26
+ 'container-name-pattern': patterns.bem,
27
+ 'custom-media-pattern': patterns.bem,
28
+ 'custom-property-pattern': patterns.bem,
29
+ 'keyframes-name-pattern': patterns.bem,
30
+ 'layer-name-pattern': patterns.bem,
31
+ 'selector-class-pattern': patterns.bemWithOptionalUnderscoresPrefix,
32
+ 'selector-id-pattern': patterns.kebab,
33
+ },
34
+
35
+ // Extensions
36
+ 'order/order': ['custom-properties', 'declarations'],
37
+ 'order/properties-order': [propertiesOrder, { unspecified: 'bottomAlphabetical' }],
38
+ };
@@ -0,0 +1,32 @@
1
+ import recommended from 'stylelint-config-recommended-scss';
2
+ import standard from 'stylelint-config-standard-scss';
3
+
4
+ import patterns from '../../lib/cssPatterns.ts';
5
+
6
+ export default {
7
+ ...recommended.rules,
8
+ ...standard.rules,
9
+
10
+ // Disable Prettier conflicts
11
+ ...{
12
+ 'scss/at-else-closing-brace-newline-after': null,
13
+ 'scss/at-else-closing-brace-space-after': null,
14
+ 'scss/at-else-empty-line-before': null,
15
+ 'scss/at-else-if-parentheses-space-before': null,
16
+ 'scss/at-function-parentheses-space-before': null,
17
+ 'scss/at-if-closing-brace-newline-after': null,
18
+ 'scss/at-if-closing-brace-space-after': null,
19
+ 'scss/at-mixin-parentheses-space-before': null,
20
+ 'scss/dollar-variable-colon-newline-after': null,
21
+ 'scss/dollar-variable-colon-space-after': null,
22
+ 'scss/dollar-variable-colon-space-before': null,
23
+ 'scss/operator-no-newline-after': null,
24
+ 'scss/operator-no-newline-before': null,
25
+ 'scss/operator-no-unspaced': null,
26
+ },
27
+
28
+ 'scss/at-function-pattern': patterns.bemWithOptionalSingleUnderscorePrefix,
29
+ 'scss/at-mixin-pattern': patterns.bemWithOptionalSingleUnderscorePrefix,
30
+ 'scss/dollar-variable-pattern': patterns.bemWithOptionalSingleUnderscorePrefix,
31
+ 'scss/percent-placeholder-pattern': patterns.bemWithOptionalSingleUnderscorePrefix,
32
+ };
@@ -0,0 +1,7 @@
1
+ export default {
2
+ js: ['js', 'jsx', 'cjs', 'cjs', 'mjs', 'mjsx'],
3
+ ts: ['ts', 'tsx', 'cts', 'cts', 'mts', 'mtsx'],
4
+
5
+ css: ['css'],
6
+ scss: ['scss'],
7
+ } satisfies Record<string, string[]>;