@averay/codeformat 0.2.10 → 0.2.12
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.
- package/.github/workflows/lint.yml +65 -0
- package/README.md +12 -2
- package/dist/bin/tools/knip.js +3 -2
- package/dist/bin/tools/knip.js.map +1 -1
- package/dist/rulesets/eslint/ruleset-shared.d.ts +1 -1
- package/dist/rulesets/eslint/ruleset-shared.js +1 -2
- package/dist/rulesets/eslint/ruleset-shared.js.map +1 -1
- package/dist/rulesets/eslint/ruleset-typescript.d.ts +218 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/makePrettierConfig.d.ts +12 -0
- package/dist/src/makePrettierConfig.js +24 -0
- package/dist/src/makePrettierConfig.js.map +1 -0
- package/package.json +24 -21
- package/.php-cs-fixer.cache +0 -1
- package/.php-cs-fixer.php +0 -9
- package/.prettierrc.json +0 -8
- package/.stylelintignore +0 -3
- package/CODE_OF_CONDUCT.md +0 -83
- package/bin/codeformat.ts +0 -27
- package/bin/tools/eslint.ts +0 -17
- package/bin/tools/index.ts +0 -6
- package/bin/tools/knip.ts +0 -21
- package/bin/tools/phpCsFixer.ts +0 -16
- package/bin/tools/prettier.ts +0 -20
- package/bin/tools/stylelint.ts +0 -16
- package/bin/tools/tsc.ts +0 -12
- package/bin/utils/Cli.ts +0 -80
- package/bin/utils/Output.ts +0 -30
- package/bin/utils/ToolRunner.ts +0 -64
- package/bin/utils/filesystem.ts +0 -22
- package/bin/utils/runners.ts +0 -10
- package/bin/utils/types.ts +0 -24
- package/composer.json +0 -6
- package/composer.lock +0 -3507
- package/eslint.config.js +0 -34
- package/knip.config.ts +0 -18
- package/lib/convertWarnsToErrors.ts +0 -43
- package/lib/cssPatterns.ts +0 -20
- package/rulesets/eslint/ruleset-shared.ts +0 -362
- package/rulesets/eslint/ruleset-typescript.ts +0 -239
- package/rulesets/php/ruleset-php-cs-fixer.php +0 -93
- package/rulesets/stylelint/ruleset-css.ts +0 -39
- package/rulesets/stylelint/ruleset-scss.ts +0 -47
- package/src/extensions.ts +0 -7
- package/src/index.ts +0 -4
- package/src/makeEslintConfig.ts +0 -97
- package/src/makeStylelintConfig.ts +0 -46
- package/stylelint.config.js +0 -7
- package/tsconfig.build.json +0 -13
- /package/{src → dist/src}/php/PhpCsFixerConfig.php +0 -0
package/eslint.config.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import globals from 'globals';
|
|
2
|
-
|
|
3
|
-
import makeEslintConfig from './src/makeEslintConfig.ts';
|
|
4
|
-
|
|
5
|
-
export default [
|
|
6
|
-
{
|
|
7
|
-
ignores: ['dist/**/*.*'],
|
|
8
|
-
},
|
|
9
|
-
...makeEslintConfig({ tsconfigPath: './tsconfig.json' }),
|
|
10
|
-
{
|
|
11
|
-
languageOptions: {
|
|
12
|
-
globals: { Bun: true, ...globals.node },
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
// Rulesets
|
|
17
|
-
{
|
|
18
|
-
files: ['rulesets/**/*.ts'],
|
|
19
|
-
rules: {
|
|
20
|
-
'sort-keys': 'error', // Organise rules.
|
|
21
|
-
'unicorn/no-useless-spread': 'off', // Keep the unprefixed core rules together.
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
// CLI
|
|
26
|
-
{
|
|
27
|
-
files: ['bin/**/*.ts'],
|
|
28
|
-
rules: {
|
|
29
|
-
'no-process-env': 'off',
|
|
30
|
-
'no-process-exit': 'off',
|
|
31
|
-
'unicorn/no-process-exit': 'off',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
];
|
package/knip.config.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { KnipConfig } from 'knip';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
ignoreBinaries: ['publish', /^dist\/bin\//u],
|
|
5
|
-
ignoreDependencies: [
|
|
6
|
-
// Build tools
|
|
7
|
-
'bumpp',
|
|
8
|
-
'husky',
|
|
9
|
-
// Included to be used by consumers
|
|
10
|
-
/^@prettier\/plugin-/u,
|
|
11
|
-
// To be dealt with
|
|
12
|
-
'typescript-eslint',
|
|
13
|
-
],
|
|
14
|
-
ignoreExportsUsedInFile: true,
|
|
15
|
-
entry: ['src/index.ts', 'bin/codeformat.ts'],
|
|
16
|
-
project: ['src/**/*.ts', 'bin/**/*.ts', 'lib/**/*.ts', 'rulesets/**/*.ts'],
|
|
17
|
-
ignore: ['dist/**'],
|
|
18
|
-
} satisfies KnipConfig;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
type Converted<T> = {
|
|
2
|
-
[key in keyof T]: T[key] extends 'warn' | 1
|
|
3
|
-
? 'error'
|
|
4
|
-
: T[key] extends ['warn' | 1, ...infer Rest]
|
|
5
|
-
? ['error', ...Rest]
|
|
6
|
-
: T[key];
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type Iterated<T extends Record<any, any>> = Iterable<[keyof T, T[keyof T]], unknown, unknown>;
|
|
10
|
-
|
|
11
|
-
const isWarning = (value: unknown): value is 'warn' | 1 => value === 'warn' || value === 1;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Replaces any `warn` values in the provided object with `error` (including those within arrays with configs), preserving all other values.
|
|
15
|
-
*
|
|
16
|
-
* @param ruleset The original ruleset to process.
|
|
17
|
-
* @returns The processed ruleset with warnings replaced with errors.
|
|
18
|
-
* @example
|
|
19
|
-
* convertWarnsToErrors({
|
|
20
|
-
* rule1: 'warn',
|
|
21
|
-
* rule2: ['warn', { foo: 'bar' }],
|
|
22
|
-
* rule3: 'off',
|
|
23
|
-
* })
|
|
24
|
-
* // {
|
|
25
|
-
* // rule1: 'error',
|
|
26
|
-
* // rule2: ['error', { foo: 'bar' }],
|
|
27
|
-
* // rule3: 'off',
|
|
28
|
-
* // }
|
|
29
|
-
*/
|
|
30
|
-
export default function convertWarnsToErrors<T extends Record<string, unknown>>(ruleset: T): Converted<T> {
|
|
31
|
-
const rulesetProcessed = {} as Converted<T>;
|
|
32
|
-
for (const [key, value] of Object.entries(ruleset) as Iterated<T>) {
|
|
33
|
-
let processedValue;
|
|
34
|
-
if (Array.isArray(value)) {
|
|
35
|
-
processedValue = [...value];
|
|
36
|
-
processedValue[0] = isWarning(processedValue[0]) ? 'error' : processedValue[0];
|
|
37
|
-
} else {
|
|
38
|
-
processedValue = isWarning(value) ? 'error' : value;
|
|
39
|
-
}
|
|
40
|
-
rulesetProcessed[key] = processedValue as Converted<T>[typeof key];
|
|
41
|
-
}
|
|
42
|
-
return rulesetProcessed;
|
|
43
|
-
}
|
package/lib/cssPatterns.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/* eslint require-unicode-regexp: 'off' -- Expressions are passed to Stylelint as strings so cannot use any flags in order to match their behaviour. */
|
|
2
|
-
|
|
3
|
-
const patterns = {
|
|
4
|
-
bem: /^[a-z]+(?:(?:-|--|__)[a-z]+)*$/.source,
|
|
5
|
-
bemWithOptionalSingleUnderscorePrefix: /^_?[a-z]+(?:(?:-|--|__)[a-z]+)*$/.source,
|
|
6
|
-
bemWithOptionalUnderscoresPrefix: /^(?:__)?[a-z]+(?:(?:-|--|__)[a-z]+)*$/.source,
|
|
7
|
-
kebab: /^[a-z]+(?:-[a-z]+)*$/.source,
|
|
8
|
-
} as const satisfies Record<string, string>;
|
|
9
|
-
|
|
10
|
-
export function patternOrScssInterpolation(pattern: string): string {
|
|
11
|
-
// Remove anchors
|
|
12
|
-
if (!pattern.startsWith('^') || !pattern.endsWith('$')) {
|
|
13
|
-
throw new Error('Pattern must use both start & end anchors.');
|
|
14
|
-
}
|
|
15
|
-
pattern = pattern.slice(1, -1);
|
|
16
|
-
|
|
17
|
-
return new RegExp(`^(?:#{[^}]+}|${pattern})$`).source;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default patterns;
|
|
@@ -1,362 +0,0 @@
|
|
|
1
|
-
/* eslint import-x/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-x';
|
|
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': [
|
|
19
|
-
'error',
|
|
20
|
-
'always',
|
|
21
|
-
{
|
|
22
|
-
ignoreConsecutiveComments: true,
|
|
23
|
-
ignorePattern: /language=/u.source, // IntelliJ language injection statements
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
'consistent-return': 'error',
|
|
27
|
-
'consistent-this': ['error', '_this'],
|
|
28
|
-
'constructor-super': 'error',
|
|
29
|
-
curly: ['error', 'all'],
|
|
30
|
-
'default-case': 'error',
|
|
31
|
-
'default-case-last': 'error',
|
|
32
|
-
'default-param-last': 'error',
|
|
33
|
-
'dot-notation': 'error',
|
|
34
|
-
eqeqeq: ['error', 'always', { null: 'ignore' }],
|
|
35
|
-
'for-direction': 'error',
|
|
36
|
-
'func-names': ['error', 'as-needed'],
|
|
37
|
-
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
|
38
|
-
'getter-return': 'error',
|
|
39
|
-
'global-require': 'error',
|
|
40
|
-
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
|
|
41
|
-
'guard-for-in': 'error',
|
|
42
|
-
'id-denylist': ['error', 'cb', 'e', 'enc', 'err', 'evt'],
|
|
43
|
-
'lines-between-class-members': 'off', // Moved to Stylistic
|
|
44
|
-
'logical-assignment-operators': ['error', 'always'],
|
|
45
|
-
'max-classes-per-file': ['error', 1],
|
|
46
|
-
'max-statements-per-line': 'off', // Moved to Stylistic
|
|
47
|
-
'multiline-comment-style': 'off', // Moved to Stylistic
|
|
48
|
-
'new-cap': ['error', { properties: true }],
|
|
49
|
-
'no-alert': 'error',
|
|
50
|
-
'no-array-constructor': 'error',
|
|
51
|
-
'no-async-promise-executor': 'error',
|
|
52
|
-
'no-await-in-loop': 'error',
|
|
53
|
-
'no-bitwise': 'error',
|
|
54
|
-
'no-buffer-constructor': 'error',
|
|
55
|
-
'no-caller': 'error',
|
|
56
|
-
'no-case-declarations': 'error',
|
|
57
|
-
'no-class-assign': 'error',
|
|
58
|
-
'no-compare-neg-zero': 'error',
|
|
59
|
-
'no-cond-assign': 'error',
|
|
60
|
-
'no-const-assign': 'error',
|
|
61
|
-
'no-constant-binary-expression': 'error',
|
|
62
|
-
'no-constant-condition': 'error',
|
|
63
|
-
'no-constructor-return': 'error',
|
|
64
|
-
'no-control-regex': 'error',
|
|
65
|
-
'no-debugger': 'error',
|
|
66
|
-
'no-delete-var': 'error',
|
|
67
|
-
'no-div-regex': 'error',
|
|
68
|
-
'no-dupe-args': 'error',
|
|
69
|
-
'no-dupe-class-members': 'error',
|
|
70
|
-
'no-dupe-else-if': 'error',
|
|
71
|
-
'no-dupe-keys': 'error',
|
|
72
|
-
'no-duplicate-case': 'error',
|
|
73
|
-
'no-duplicate-imports': 'error',
|
|
74
|
-
'no-empty': 'error',
|
|
75
|
-
'no-empty-character-class': 'error',
|
|
76
|
-
'no-empty-function': 'error',
|
|
77
|
-
'no-empty-pattern': ['error', { allowObjectPatternsAsParameters: true }],
|
|
78
|
-
'no-empty-static-block': 'error',
|
|
79
|
-
'no-eval': 'error',
|
|
80
|
-
'no-ex-assign': 'error',
|
|
81
|
-
'no-extend-native': 'error',
|
|
82
|
-
'no-extra-bind': 'error',
|
|
83
|
-
'no-extra-boolean-cast': 'error',
|
|
84
|
-
'no-extra-label': 'error',
|
|
85
|
-
'no-fallthrough': 'error',
|
|
86
|
-
'no-func-assign': 'error',
|
|
87
|
-
'no-global-assign': 'error',
|
|
88
|
-
'no-implicit-coercion': 'error',
|
|
89
|
-
'no-implicit-globals': 'error',
|
|
90
|
-
'no-implied-eval': 'error',
|
|
91
|
-
'no-import-assign': 'error',
|
|
92
|
-
'no-inner-declarations': 'error',
|
|
93
|
-
'no-invalid-regexp': 'error',
|
|
94
|
-
'no-invalid-this': 'error',
|
|
95
|
-
'no-irregular-whitespace': 'error',
|
|
96
|
-
'no-iterator': 'error',
|
|
97
|
-
'no-label-var': 'error',
|
|
98
|
-
'no-labels': ['error', { allowLoop: true }],
|
|
99
|
-
'no-lone-blocks': 'error',
|
|
100
|
-
'no-loop-func': 'error',
|
|
101
|
-
'no-loss-of-precision': 'error',
|
|
102
|
-
'no-magic-numbers': [
|
|
103
|
-
'error',
|
|
104
|
-
{
|
|
105
|
-
detectObjects: true,
|
|
106
|
-
enforceConst: true,
|
|
107
|
-
ignore: [-1, 0, 1],
|
|
108
|
-
ignoreArrayIndexes: true,
|
|
109
|
-
ignoreClassFieldInitialValues: true,
|
|
110
|
-
ignoreDefaultValues: true,
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
'no-misleading-character-class': 'error',
|
|
114
|
-
'no-mixed-requires': 'error',
|
|
115
|
-
'no-multi-assign': 'error',
|
|
116
|
-
'no-multi-str': 'error',
|
|
117
|
-
'no-nested-ternary': 'error',
|
|
118
|
-
'no-new': 'error',
|
|
119
|
-
'no-new-func': 'error',
|
|
120
|
-
'no-new-native-nonconstructor': 'error',
|
|
121
|
-
'no-new-object': 'error',
|
|
122
|
-
'no-new-require': 'error',
|
|
123
|
-
'no-new-wrappers': 'error',
|
|
124
|
-
'no-nonoctal-decimal-escape': 'error',
|
|
125
|
-
'no-obj-calls': 'error',
|
|
126
|
-
'no-octal': 'error',
|
|
127
|
-
'no-octal-escape': 'error',
|
|
128
|
-
'no-path-concat': 'error',
|
|
129
|
-
'no-plusplus': 'error',
|
|
130
|
-
'no-process-env': 'error',
|
|
131
|
-
'no-process-exit': 'error',
|
|
132
|
-
'no-promise-executor-return': 'error',
|
|
133
|
-
'no-proto': 'error',
|
|
134
|
-
'no-prototype-builtins': 'error',
|
|
135
|
-
'no-redeclare': 'error',
|
|
136
|
-
'no-regex-spaces': 'error',
|
|
137
|
-
'no-restricted-globals': ['error', 'event'],
|
|
138
|
-
'no-restricted-syntax': ['error', 'WithStatement', "BinaryExpression[operator='in']"],
|
|
139
|
-
'no-return-assign': 'error',
|
|
140
|
-
'no-return-await': 'error',
|
|
141
|
-
'no-script-url': 'error',
|
|
142
|
-
'no-self-assign': 'error',
|
|
143
|
-
'no-self-compare': 'error',
|
|
144
|
-
'no-sequences': 'error',
|
|
145
|
-
'no-setter-return': 'error',
|
|
146
|
-
'no-shadow': ['error', { hoist: 'all' }],
|
|
147
|
-
'no-shadow-restricted-names': 'error',
|
|
148
|
-
'no-sparse-arrays': 'error',
|
|
149
|
-
'no-template-curly-in-string': 'error',
|
|
150
|
-
'no-this-before-super': 'error',
|
|
151
|
-
'no-throw-literal': 'error',
|
|
152
|
-
'no-undef': 'error',
|
|
153
|
-
'no-undef-init': 'error',
|
|
154
|
-
'no-underscore-dangle': [
|
|
155
|
-
'error',
|
|
156
|
-
{
|
|
157
|
-
allow: ['_', '_this', '_1', '_2', '_3', '_4', '_5', '_6', '_7', '_8', '_9'],
|
|
158
|
-
allowAfterSuper: true,
|
|
159
|
-
allowAfterThis: true,
|
|
160
|
-
allowAfterThisConstructor: true,
|
|
161
|
-
allowFunctionParams: false,
|
|
162
|
-
allowInArrayDestructuring: false,
|
|
163
|
-
enforceInClassFields: true,
|
|
164
|
-
enforceInMethodNames: true,
|
|
165
|
-
},
|
|
166
|
-
],
|
|
167
|
-
'no-unmodified-loop-condition': 'error',
|
|
168
|
-
'no-unneeded-ternary': 'error',
|
|
169
|
-
'no-unreachable': 'error',
|
|
170
|
-
'no-unreachable-loop': 'error',
|
|
171
|
-
'no-unsafe-finally': 'error',
|
|
172
|
-
'no-unsafe-negation': 'error',
|
|
173
|
-
'no-unsafe-optional-chaining': 'error',
|
|
174
|
-
'no-unused-expressions': 'error',
|
|
175
|
-
'no-unused-labels': 'error',
|
|
176
|
-
'no-unused-private-class-members': 'error',
|
|
177
|
-
'no-unused-vars': [
|
|
178
|
-
'error',
|
|
179
|
-
{
|
|
180
|
-
argsIgnorePattern: /^_\w*$/u.source,
|
|
181
|
-
caughtErrorsIgnorePattern: /^_\w*$/u.source,
|
|
182
|
-
varsIgnorePattern: /^(_\d*|React)$/u.source,
|
|
183
|
-
},
|
|
184
|
-
],
|
|
185
|
-
'no-use-before-define': 'error',
|
|
186
|
-
'no-useless-backreference': 'error',
|
|
187
|
-
'no-useless-call': 'error',
|
|
188
|
-
'no-useless-catch': 'error',
|
|
189
|
-
'no-useless-computed-key': ['error', { enforceForClassMembers: true }],
|
|
190
|
-
'no-useless-concat': 'error',
|
|
191
|
-
'no-useless-constructor': 'error',
|
|
192
|
-
'no-useless-escape': 'error',
|
|
193
|
-
'no-useless-rename': 'error',
|
|
194
|
-
'no-useless-return': 'error',
|
|
195
|
-
'no-var': 'error',
|
|
196
|
-
'no-void': 'error',
|
|
197
|
-
'no-with': 'error',
|
|
198
|
-
'object-shorthand': ['error', 'always', { avoidExplicitReturnArrows: true, avoidQuotes: true }],
|
|
199
|
-
'one-var': ['error', 'never'],
|
|
200
|
-
'operator-assignment': 'error',
|
|
201
|
-
'padding-line-between-statements': 'off', // Moved to Stylistic
|
|
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': 'off', // Moved to Stylistic
|
|
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-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],
|
|
231
|
-
'import-x/first': ['error'],
|
|
232
|
-
'import-x/newline-after-import': 'error',
|
|
233
|
-
'import-x/no-absolute-path': 'error',
|
|
234
|
-
'import-x/no-amd': 'error',
|
|
235
|
-
'import-x/no-anonymous-default-export': [
|
|
236
|
-
'error',
|
|
237
|
-
{ allowArray: true, allowCallExpression: true, allowLiteral: true, allowNew: true, allowObject: true },
|
|
238
|
-
],
|
|
239
|
-
'import-x/no-commonjs': 'error',
|
|
240
|
-
'import-x/no-cycle': ['error', { ignoreExternal: true }],
|
|
241
|
-
'import-x/no-duplicates': 'error',
|
|
242
|
-
'import-x/no-dynamic-require': 'error',
|
|
243
|
-
'import-x/no-empty-named-blocks': 'error',
|
|
244
|
-
'import-x/no-extraneous-dependencies': 'error',
|
|
245
|
-
'import-x/no-mutable-exports': 'error',
|
|
246
|
-
'import-x/no-named-as-default-member': 'error',
|
|
247
|
-
'import-x/no-named-default': 'error',
|
|
248
|
-
'import-x/no-self-import': 'error',
|
|
249
|
-
'import-x/no-unresolved': ['error', { caseSensitiveStrict: true }],
|
|
250
|
-
'import-x/no-unused-modules': 'error',
|
|
251
|
-
'import-x/no-useless-path-segments': 'error',
|
|
252
|
-
'import-x/no-webpack-loader-syntax': 'error',
|
|
253
|
-
'import-x/order': [
|
|
254
|
-
'error',
|
|
255
|
-
{
|
|
256
|
-
alphabetize: { caseInsensitive: true, order: 'asc', orderImportKind: 'asc' },
|
|
257
|
-
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
258
|
-
named: true,
|
|
259
|
-
'newlines-between': 'always',
|
|
260
|
-
pathGroups: [
|
|
261
|
-
/* eslint-disable sort-keys -- Logically ordered */
|
|
262
|
-
{ pattern: /^pkg:/u.source, group: 'external' },
|
|
263
|
-
{ pattern: /^#/u.source, group: 'internal' },
|
|
264
|
-
/* eslint-enable sort-keys -- Logically ordered */
|
|
265
|
-
],
|
|
266
|
-
},
|
|
267
|
-
],
|
|
268
|
-
'import-x/prefer-default-export': 'off', // Causes friction when creating a utilities file with a single export in advance of adding additional exports.
|
|
269
|
-
|
|
270
|
-
...jsdocPlugin.configs.recommended.rules,
|
|
271
|
-
'jsdoc/check-indentation': 'error',
|
|
272
|
-
'jsdoc/check-param-names': ['error', { checkDestructured: false }],
|
|
273
|
-
'jsdoc/check-syntax': 'error',
|
|
274
|
-
'jsdoc/match-description': ['error', { matchDescription: '[A-Z]', tags: { param: true, returns: true } }],
|
|
275
|
-
'jsdoc/no-bad-blocks': 'error',
|
|
276
|
-
'jsdoc/no-defaults': 'error',
|
|
277
|
-
'jsdoc/require-asterisk-prefix': 'error',
|
|
278
|
-
'jsdoc/require-jsdoc': 'off',
|
|
279
|
-
'jsdoc/require-param': [
|
|
280
|
-
'error',
|
|
281
|
-
{
|
|
282
|
-
checkConstructors: false,
|
|
283
|
-
checkDestructured: false,
|
|
284
|
-
ignoreWhenAllParamsMissing: true,
|
|
285
|
-
},
|
|
286
|
-
],
|
|
287
|
-
'jsdoc/require-returns': 'off',
|
|
288
|
-
'jsdoc/sort-tags': 'error',
|
|
289
|
-
'jsdoc/tag-lines': ['error', 'any', { startLines: 1 }],
|
|
290
|
-
|
|
291
|
-
...promisePlugin.configs.recommended.rules,
|
|
292
|
-
'promise/always-return': ['error', { ignoreAssignmentVariable: ['globalThis', 'window'], ignoreLastCallback: true }],
|
|
293
|
-
'promise/no-multiple-resolved': 'error',
|
|
294
|
-
|
|
295
|
-
...regexpPlugin.configs.recommended.rules,
|
|
296
|
-
'regexp/hexadecimal-escape': ['error', 'never'],
|
|
297
|
-
'regexp/letter-case': 'error',
|
|
298
|
-
'regexp/no-empty-character-class': 'error',
|
|
299
|
-
'regexp/no-extra-lookaround-assertions': 'error',
|
|
300
|
-
'regexp/no-misleading-capturing-group': 'error',
|
|
301
|
-
'regexp/no-misleading-unicode-character': 'error',
|
|
302
|
-
'regexp/no-missing-g-flag': 'error',
|
|
303
|
-
'regexp/no-octal': 'error',
|
|
304
|
-
'regexp/no-standalone-backslash': 'error',
|
|
305
|
-
'regexp/prefer-escape-replacement-dollar-char': 'error',
|
|
306
|
-
'regexp/prefer-named-backreference': 'error',
|
|
307
|
-
'regexp/prefer-named-replacement': 'error',
|
|
308
|
-
'regexp/prefer-quantifier': 'error',
|
|
309
|
-
'regexp/prefer-result-array-groups': 'error',
|
|
310
|
-
'regexp/unicode-escape': 'error',
|
|
311
|
-
'regexp/use-ignore-case': 'error',
|
|
312
|
-
|
|
313
|
-
...sonarjsPlugin.configs.recommended.rules,
|
|
314
|
-
'sonarjs/cognitive-complexity': 'off',
|
|
315
|
-
'sonarjs/function-return-type': 'off', // Overly restrictive.
|
|
316
|
-
'sonarjs/max-switch-cases': 'off',
|
|
317
|
-
'sonarjs/no-inverted-boolean-check': 'error',
|
|
318
|
-
'sonarjs/no-nested-template-literals': 'off',
|
|
319
|
-
'sonarjs/no-selector-parameter': 'off', // Overly restrictive.
|
|
320
|
-
'sonarjs/no-small-switch': 'off',
|
|
321
|
-
'sonarjs/prefer-immediate-return': 'off',
|
|
322
|
-
'sonarjs/prefer-regexp-exec': 'off',
|
|
323
|
-
'sonarjs/prefer-single-boolean-return': 'off',
|
|
324
|
-
|
|
325
|
-
...stylisticPlugin.configs.recommended.rules,
|
|
326
|
-
'@stylistic/arrow-parens': 'off',
|
|
327
|
-
'@stylistic/brace-style': 'off',
|
|
328
|
-
'@stylistic/indent': 'off',
|
|
329
|
-
'@stylistic/indent-binary-ops': 'off',
|
|
330
|
-
'@stylistic/jsx-indent-props': 'off',
|
|
331
|
-
'@stylistic/jsx-one-expression-per-line': 'off',
|
|
332
|
-
'@stylistic/jsx-wrap-multilines': 'off',
|
|
333
|
-
'@stylistic/lines-between-class-members': 'off',
|
|
334
|
-
'@stylistic/max-statements-per-line': 'error',
|
|
335
|
-
'@stylistic/member-delimiter-style': 'off',
|
|
336
|
-
'@stylistic/multiline-comment-style': 'error',
|
|
337
|
-
'@stylistic/multiline-ternary': 'off',
|
|
338
|
-
'@stylistic/no-multiple-empty-line': 'off',
|
|
339
|
-
'@stylistic/operator-linebreak': 'off',
|
|
340
|
-
'@stylistic/padding-line-between-statements': [
|
|
341
|
-
'error',
|
|
342
|
-
/* eslint-disable sort-keys -- Logically ordered */
|
|
343
|
-
{ blankLine: 'always', prev: 'directive', next: '*' },
|
|
344
|
-
{ blankLine: 'always', prev: 'function', next: 'function' },
|
|
345
|
-
/* eslint-enable sort-keys -- Logically ordered */
|
|
346
|
-
],
|
|
347
|
-
'@stylistic/quote-props': 'off',
|
|
348
|
-
'@stylistic/quotes': 'off',
|
|
349
|
-
'@stylistic/semi': 'off',
|
|
350
|
-
'@stylistic/spaced-comment': ['error', 'always', { markers: ['/'] }],
|
|
351
|
-
|
|
352
|
-
...unicornPlugin.configs.recommended.rules,
|
|
353
|
-
'unicorn/consistent-function-scoping': ['error', { checkArrowFunctions: false }],
|
|
354
|
-
'unicorn/filename-case': 'off',
|
|
355
|
-
'unicorn/no-null': 'off',
|
|
356
|
-
'unicorn/no-useless-undefined': 'off', // Conflicts with `consistent-return`.
|
|
357
|
-
'unicorn/prefer-event-target': 'error',
|
|
358
|
-
'unicorn/prefer-query-selector': 'off',
|
|
359
|
-
'unicorn/prevent-abbreviations': 'off',
|
|
360
|
-
'unicorn/require-post-message-target-origin': 'error',
|
|
361
|
-
'unicorn/text-encoding-identifier-case': 'off', // Too many false positives
|
|
362
|
-
} satisfies TSESLint.FlatConfig.Rules;
|