@mikey-pro/eslint-config 8.1.1 → 9.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.
- package/README.md +14 -2
- package/flat.js +48 -0
- package/index.js +32 -150
- package/overrides.js +114 -119
- package/package.json +50 -32
- package/rules.js +437 -106
package/README.md
CHANGED
|
@@ -18,9 +18,19 @@ A preset ESLint configuration
|
|
|
18
18
|
npm i -D mikey-pro
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
### Configure
|
|
21
|
+
### Configure (Flat ESLint v9+ Recommended)
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Create / update `eslint.config.js`:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import mikeyPro from '@mikey-pro/eslint-config/flat';
|
|
27
|
+
|
|
28
|
+
export default mikeyPro;
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Legacy Configuration (still supported)
|
|
32
|
+
|
|
33
|
+
Extend in `package.json` (deprecated style):
|
|
24
34
|
|
|
25
35
|
```json
|
|
26
36
|
{
|
|
@@ -29,3 +39,5 @@ Extend to ESLint in `package.json`:
|
|
|
29
39
|
}
|
|
30
40
|
}
|
|
31
41
|
```
|
|
42
|
+
|
|
43
|
+
Both configurations are kept semantically equivalent; the legacy form will be removed in a future major release.
|
package/flat.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Modern ESLint 9 Flat Configuration for Mikey Pro
|
|
2
|
+
// Ultimate coding style guide for excellence
|
|
3
|
+
|
|
4
|
+
import { baseConfig } from './base-config.js';
|
|
5
|
+
|
|
6
|
+
export default [
|
|
7
|
+
// Global ignores
|
|
8
|
+
{
|
|
9
|
+
ignores: [
|
|
10
|
+
'**/dist/**/*',
|
|
11
|
+
'**/vendor/**/*',
|
|
12
|
+
'**/node_modules/**/*',
|
|
13
|
+
'**/coverage/**/*',
|
|
14
|
+
'**/.next/**/*',
|
|
15
|
+
'**/.nuxt/**/*',
|
|
16
|
+
'**/.output/**/*',
|
|
17
|
+
'**/.vite/**/*',
|
|
18
|
+
'**/build/**/*',
|
|
19
|
+
'**/out/**/*',
|
|
20
|
+
'*.properties',
|
|
21
|
+
'*.cclibs',
|
|
22
|
+
'*.svg',
|
|
23
|
+
'*.png',
|
|
24
|
+
'*.jpg',
|
|
25
|
+
'*.jpeg',
|
|
26
|
+
'*.gif',
|
|
27
|
+
'*.ico',
|
|
28
|
+
'*.webp',
|
|
29
|
+
'*.aco',
|
|
30
|
+
'*.psd',
|
|
31
|
+
'*.ai',
|
|
32
|
+
'*.ase',
|
|
33
|
+
'*.sh',
|
|
34
|
+
'*.bat',
|
|
35
|
+
'*.cmd',
|
|
36
|
+
'package-lock.json',
|
|
37
|
+
'yarn.lock',
|
|
38
|
+
'pnpm-lock.yaml',
|
|
39
|
+
'LICENSE',
|
|
40
|
+
'CNAME',
|
|
41
|
+
'*.min.js',
|
|
42
|
+
'*.min.css',
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
// Base configuration
|
|
47
|
+
baseConfig,
|
|
48
|
+
];
|
package/index.js
CHANGED
|
@@ -1,176 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import boundariesPlugin from 'eslint-plugin-boundaries';
|
|
4
|
-
import compatPlugin from 'eslint-plugin-compat';
|
|
5
|
-
import cssModules from 'eslint-plugin-css-modules';
|
|
6
|
-
import importPlugin from 'eslint-plugin-import';
|
|
7
|
-
import nPlugin from 'eslint-plugin-n';
|
|
8
|
-
import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests';
|
|
9
|
-
import noSecretsPlugin from 'eslint-plugin-no-secrets';
|
|
10
|
-
import onlyWarn from 'eslint-plugin-only-warn';
|
|
11
|
-
import optimizeRegexPlugin from 'eslint-plugin-optimize-regex';
|
|
12
|
-
import perfectionistPlugin from 'eslint-plugin-perfectionist';
|
|
13
|
-
import eslintPluginPrettier from 'eslint-plugin-prettier';
|
|
14
|
-
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
15
|
-
import promisePlugin from 'eslint-plugin-promise';
|
|
16
|
-
import regexpPlugin from 'eslint-plugin-regexp';
|
|
17
|
-
import securityPlugin from 'eslint-plugin-security';
|
|
18
|
-
import importSortPlugin from 'eslint-plugin-simple-import-sort';
|
|
19
|
-
import sonarjsPlugin from 'eslint-plugin-sonarjs';
|
|
20
|
-
import sortDestructureKeysPlugin from 'eslint-plugin-sort-destructure-keys';
|
|
21
|
-
import unicorn from 'eslint-plugin-unicorn';
|
|
22
|
-
import writeGoodCommentsPlugin from 'eslint-plugin-write-good-comments';
|
|
23
|
-
import globals from 'globals';
|
|
1
|
+
// Modern ESLint 9 configuration for Mikey Pro
|
|
2
|
+
// This is the main entry point that exports the flat config
|
|
24
3
|
|
|
4
|
+
import { baseConfig } from './base-config.js';
|
|
25
5
|
import { baseOverrides } from './overrides.js';
|
|
26
|
-
import { baseRules } from './rules.js';
|
|
27
6
|
|
|
28
|
-
|
|
7
|
+
// Export the modern flat configuration
|
|
8
|
+
export default [
|
|
9
|
+
// Global ignores
|
|
29
10
|
{
|
|
30
11
|
ignores: [
|
|
31
12
|
'**/dist/**/*',
|
|
32
13
|
'**/vendor/**/*',
|
|
14
|
+
'**/node_modules/**/*',
|
|
15
|
+
'**/coverage/**/*',
|
|
16
|
+
'**/.next/**/*',
|
|
17
|
+
'**/.nuxt/**/*',
|
|
18
|
+
'**/.output/**/*',
|
|
19
|
+
'**/.vite/**/*',
|
|
20
|
+
'**/build/**/*',
|
|
21
|
+
'**/out/**/*',
|
|
33
22
|
'*.properties',
|
|
34
23
|
'*.cclibs',
|
|
35
24
|
'*.svg',
|
|
36
25
|
'*.png',
|
|
26
|
+
'*.jpg',
|
|
27
|
+
'*.jpeg',
|
|
28
|
+
'*.gif',
|
|
29
|
+
'*.ico',
|
|
30
|
+
'*.webp',
|
|
37
31
|
'*.aco',
|
|
38
32
|
'*.psd',
|
|
39
33
|
'*.ai',
|
|
40
34
|
'*.ase',
|
|
41
35
|
'*.sh',
|
|
42
|
-
'*.
|
|
36
|
+
'*.bat',
|
|
37
|
+
'*.cmd',
|
|
43
38
|
'package-lock.json',
|
|
39
|
+
'yarn.lock',
|
|
40
|
+
'pnpm-lock.yaml',
|
|
44
41
|
'LICENSE',
|
|
45
42
|
'CNAME',
|
|
43
|
+
'*.min.js',
|
|
44
|
+
'*.min.css',
|
|
46
45
|
],
|
|
47
46
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
ecmaVersion: 'latest',
|
|
54
|
-
globals: {
|
|
55
|
-
...globals.browser,
|
|
56
|
-
...globals.commonjs,
|
|
57
|
-
...globals.es2022,
|
|
58
|
-
...globals.es6,
|
|
59
|
-
...globals.node,
|
|
60
|
-
},
|
|
61
|
-
sourceType: 'module',
|
|
62
|
-
},
|
|
63
|
-
linterOptions: {
|
|
64
|
-
noInlineConfig: true,
|
|
65
|
-
reportUnusedDisableDirectives: true,
|
|
66
|
-
},
|
|
67
|
-
plugins: {
|
|
68
|
-
'@cypress/json': cypressJson,
|
|
69
|
-
boundaries: boundariesPlugin,
|
|
70
|
-
compat: compatPlugin,
|
|
71
|
-
'css-modules': cssModules,
|
|
72
|
-
import: importPlugin,
|
|
73
|
-
n: nPlugin,
|
|
74
|
-
'no-only-tests': noOnlyTestsPlugin,
|
|
75
|
-
'no-secrets': noSecretsPlugin,
|
|
76
|
-
'only-warn': onlyWarn,
|
|
77
|
-
'optimize-regex': optimizeRegexPlugin,
|
|
78
|
-
perfectionist: perfectionistPlugin,
|
|
79
|
-
prettier: eslintPluginPrettier,
|
|
80
|
-
promise: promisePlugin,
|
|
81
|
-
regexp: regexpPlugin,
|
|
82
|
-
security: securityPlugin,
|
|
83
|
-
'simple-import-sort': importSortPlugin,
|
|
84
|
-
sonarjs: sonarjsPlugin,
|
|
85
|
-
'sort-destructure-keys': sortDestructureKeysPlugin,
|
|
86
|
-
unicorn,
|
|
87
|
-
'write-good-comments': writeGoodCommentsPlugin,
|
|
88
|
-
},
|
|
89
|
-
rules: {
|
|
90
|
-
...baseRules,
|
|
91
|
-
...unicorn.configs.all.rules,
|
|
92
|
-
...compatPlugin.configs.recommended.rules,
|
|
93
|
-
...cssModules.configs.recommended.rules,
|
|
94
|
-
...importPlugin.configs.recommended.rules,
|
|
95
|
-
...sonarjsPlugin.configs.recommended.rules,
|
|
96
|
-
'import/no-anonymous-default-export': 'warn',
|
|
97
|
-
'import/no-cycle': 'warn',
|
|
98
|
-
'import/no-useless-path-segments': 'warn',
|
|
99
|
-
'no-only-tests/no-only-tests': 'warn',
|
|
100
|
-
'no-secrets/no-secrets': ['warn', { tolerance: 4.5 }],
|
|
101
|
-
'perfectionist/sort-named-imports': 'warn',
|
|
102
|
-
'perfectionist/sort-objects': [
|
|
103
|
-
'warn',
|
|
104
|
-
{
|
|
105
|
-
order: 'asc',
|
|
106
|
-
type: 'natural',
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
'prettier/prettier': [
|
|
110
|
-
'warn',
|
|
111
|
-
{
|
|
112
|
-
endOfLine: 'lf',
|
|
113
|
-
parser: 'babel',
|
|
114
|
-
singleQuote: true,
|
|
115
|
-
trailingComma: 'all',
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
'promise/always-return': 'warn',
|
|
119
|
-
'promise/catch-or-return': 'warn',
|
|
120
|
-
'promise/no-return-wrap': 'warn',
|
|
121
|
-
'promise/param-names': 'error',
|
|
122
|
-
'security/detect-non-literal-regexp': 'warn',
|
|
123
|
-
'security/detect-object-injection': 'warn',
|
|
124
|
-
'security/detect-possible-timing-attacks': 'warn',
|
|
125
|
-
'simple-import-sort/exports': 'warn',
|
|
126
|
-
'simple-import-sort/imports': 'warn',
|
|
127
|
-
'sonarjs/cognitive-complexity': ['error', 15],
|
|
128
|
-
'sonarjs/max-switch-cases': ['warn', 10],
|
|
129
|
-
'sonarjs/no-duplicate-string': ['error', { threshold: 5 }],
|
|
130
|
-
'sonarjs/no-duplicated-branches': 'error',
|
|
131
|
-
'sonarjs/no-redundant-boolean': 'error',
|
|
132
|
-
'sonarjs/no-small-switch': 'warn',
|
|
133
|
-
'sonarjs/prefer-immediate-return': 'error',
|
|
134
|
-
'unicorn/expiring-todo-comments': 'off',
|
|
135
|
-
},
|
|
136
|
-
settings: {
|
|
137
|
-
boundaries: {
|
|
138
|
-
elements: [
|
|
139
|
-
{ pattern: 'app/*', type: 'app' },
|
|
140
|
-
{ pattern: 'pages/*', type: 'pages' },
|
|
141
|
-
{ pattern: 'components/*', type: 'components' },
|
|
142
|
-
{ pattern: 'hooks/*', type: 'hooks' },
|
|
143
|
-
{ pattern: 'utils/*', type: 'utils' },
|
|
144
|
-
{ pattern: 'services/*', type: 'services' },
|
|
145
|
-
{ pattern: 'types/*', type: 'types' },
|
|
146
|
-
{ pattern: 'config/*', type: 'config' },
|
|
147
|
-
],
|
|
148
|
-
},
|
|
149
|
-
'import/extensions': ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs'],
|
|
150
|
-
'import/parsers': {
|
|
151
|
-
'@typescript-eslint/parser': ['.ts', '.tsx', '.mts', '.cts'],
|
|
152
|
-
},
|
|
153
|
-
'import/resolver': {
|
|
154
|
-
node: {
|
|
155
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs'],
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
jest: {
|
|
159
|
-
version: 29,
|
|
160
|
-
},
|
|
161
|
-
'json/json-with-comments-files': [],
|
|
162
|
-
polyfills: [
|
|
163
|
-
'Promise',
|
|
164
|
-
'fetch',
|
|
165
|
-
'URLSearchParams',
|
|
166
|
-
'Array.prototype.includes',
|
|
167
|
-
],
|
|
168
|
-
},
|
|
169
|
-
},
|
|
47
|
+
|
|
48
|
+
// Base configuration
|
|
49
|
+
baseConfig,
|
|
50
|
+
|
|
51
|
+
// File-specific overrides
|
|
170
52
|
...baseOverrides,
|
|
171
53
|
];
|
|
172
54
|
|
|
173
|
-
|
|
174
|
-
|
|
55
|
+
// Export individual components for advanced usage
|
|
56
|
+
export { baseConfig } from './base-config.js';
|
|
175
57
|
export { baseOverrides } from './overrides.js';
|
|
176
58
|
export { baseRules } from './rules.js';
|
package/overrides.js
CHANGED
|
@@ -1,33 +1,46 @@
|
|
|
1
|
+
// Modern overrides for different file types and frameworks
|
|
1
2
|
import path from 'node:path';
|
|
2
3
|
import { fileURLToPath } from 'node:url';
|
|
3
4
|
|
|
4
|
-
import
|
|
5
|
+
import html from '@html-eslint/eslint-plugin';
|
|
6
|
+
import htmlParser from '@html-eslint/parser';
|
|
7
|
+
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
|
8
|
+
import tsParser from '@typescript-eslint/parser';
|
|
9
|
+
import cypress from 'eslint-plugin-cypress';
|
|
5
10
|
import importPlugin from 'eslint-plugin-import';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
11
|
+
import jest from 'eslint-plugin-jest';
|
|
12
|
+
import markdownlint from 'eslint-plugin-markdownlint';
|
|
13
|
+
import jsoncParser from 'jsonc-eslint-parser';
|
|
14
|
+
import tomlParser from 'toml-eslint-parser';
|
|
15
|
+
import yamlParser from 'yaml-eslint-parser';
|
|
8
16
|
|
|
9
|
-
const currentDirectory =
|
|
17
|
+
const currentDirectory = import.meta.dirname;
|
|
10
18
|
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
// TypeScript configuration
|
|
20
|
+
export const ts = {
|
|
21
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
13
22
|
languageOptions: {
|
|
14
|
-
ecmaFeatures: {
|
|
15
|
-
jsx: true,
|
|
16
|
-
},
|
|
17
23
|
ecmaVersion: 'latest',
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
parser: tsParser,
|
|
25
|
+
parserOptions: {
|
|
26
|
+
ecmaFeatures: { jsx: true },
|
|
27
|
+
extraFileExtensions: ['.vue', '.svelte'],
|
|
28
|
+
project: path.join(currentDirectory, '../../tsconfig.json'),
|
|
29
|
+
tsconfigRootDir: path.join(currentDirectory, '../..'),
|
|
30
|
+
},
|
|
20
31
|
sourceType: 'module',
|
|
21
|
-
tsconfigRootDir: path.join(currentDirectory, '../../..'),
|
|
22
32
|
},
|
|
23
33
|
plugins: {
|
|
24
|
-
'@typescript-eslint':
|
|
34
|
+
'@typescript-eslint': tsPlugin,
|
|
25
35
|
import: importPlugin,
|
|
26
36
|
},
|
|
27
37
|
rules: {
|
|
28
|
-
|
|
29
|
-
...
|
|
38
|
+
// TypeScript-specific rules
|
|
39
|
+
...tsPlugin.configs.all.rules,
|
|
40
|
+
...tsPlugin.configs['recommended-requiring-type-checking'].rules,
|
|
30
41
|
...importPlugin.configs.typescript.rules,
|
|
42
|
+
|
|
43
|
+
// Override some rules for better developer experience
|
|
31
44
|
'@typescript-eslint/class-methods-use-this': 'off',
|
|
32
45
|
'@typescript-eslint/consistent-generic-constructors': [
|
|
33
46
|
'error',
|
|
@@ -36,10 +49,7 @@ const ts = {
|
|
|
36
49
|
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
|
|
37
50
|
'@typescript-eslint/consistent-type-assertions': [
|
|
38
51
|
'error',
|
|
39
|
-
{
|
|
40
|
-
assertionStyle: 'as',
|
|
41
|
-
objectLiteralTypeAssertions: 'never',
|
|
42
|
-
},
|
|
52
|
+
{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' },
|
|
43
53
|
],
|
|
44
54
|
'@typescript-eslint/consistent-type-exports': [
|
|
45
55
|
'error',
|
|
@@ -55,10 +65,7 @@ const ts = {
|
|
|
55
65
|
],
|
|
56
66
|
'@typescript-eslint/explicit-function-return-type': [
|
|
57
67
|
'warn',
|
|
58
|
-
{
|
|
59
|
-
allowExpressions: true,
|
|
60
|
-
allowTypedFunctionExpressions: true,
|
|
61
|
-
},
|
|
68
|
+
{ allowExpressions: true, allowTypedFunctionExpressions: true },
|
|
62
69
|
],
|
|
63
70
|
'@typescript-eslint/explicit-member-accessibility': [
|
|
64
71
|
'warn',
|
|
@@ -100,19 +107,11 @@ const ts = {
|
|
|
100
107
|
'@typescript-eslint/method-signature-style': ['error', 'property'],
|
|
101
108
|
'@typescript-eslint/naming-convention': [
|
|
102
109
|
'error',
|
|
103
|
-
{
|
|
104
|
-
|
|
105
|
-
selector: ['typeLike'],
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
format: ['PascalCase'],
|
|
109
|
-
prefix: ['T'],
|
|
110
|
-
selector: ['typeParameter'],
|
|
111
|
-
},
|
|
110
|
+
{ format: ['PascalCase'], selector: ['typeLike'] },
|
|
111
|
+
{ format: ['PascalCase'], prefix: ['T'], selector: ['typeParameter'] },
|
|
112
112
|
{
|
|
113
113
|
custom: {
|
|
114
114
|
match: false,
|
|
115
|
-
message: 'Interface name should not be prefixed with "I"',
|
|
116
115
|
regex: '^I[A-Z]',
|
|
117
116
|
},
|
|
118
117
|
format: ['PascalCase'],
|
|
@@ -140,9 +139,7 @@ const ts = {
|
|
|
140
139
|
'@typescript-eslint/no-magic-numbers': 'off',
|
|
141
140
|
'@typescript-eslint/no-misused-promises': [
|
|
142
141
|
'error',
|
|
143
|
-
{
|
|
144
|
-
checksVoidReturn: false,
|
|
145
|
-
},
|
|
142
|
+
{ checksVoidReturn: false },
|
|
146
143
|
],
|
|
147
144
|
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
|
|
148
145
|
'@typescript-eslint/no-redundant-type-constituents': 'error',
|
|
@@ -156,7 +153,6 @@ const ts = {
|
|
|
156
153
|
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
|
|
157
154
|
'@typescript-eslint/no-unsafe-member-access': 'error',
|
|
158
155
|
'@typescript-eslint/no-unsafe-unary-minus': 'error',
|
|
159
|
-
'@typescript-eslint/no-useless-template-literals': 'error',
|
|
160
156
|
'@typescript-eslint/parameter-properties': [
|
|
161
157
|
'error',
|
|
162
158
|
{ prefer: 'parameter-property' },
|
|
@@ -209,76 +205,81 @@ const ts = {
|
|
|
209
205
|
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
210
206
|
'@typescript-eslint/unbound-method': 'off',
|
|
211
207
|
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'off',
|
|
212
|
-
'deprecation/deprecation': 'warn',
|
|
213
|
-
'prettier/prettier': ['warn', { parser: 'typescript' }],
|
|
214
208
|
},
|
|
215
209
|
settings: {
|
|
216
210
|
'import/parsers': {
|
|
217
211
|
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
|
|
218
212
|
},
|
|
219
213
|
'import/resolver': {
|
|
220
|
-
typescript: {
|
|
221
|
-
alwaysTryTypes: true,
|
|
222
|
-
},
|
|
214
|
+
typescript: { alwaysTryTypes: true },
|
|
223
215
|
},
|
|
224
216
|
},
|
|
225
217
|
};
|
|
226
218
|
|
|
227
|
-
|
|
228
|
-
|
|
219
|
+
// CSS files
|
|
220
|
+
export const css = {
|
|
221
|
+
files: ['**/*.css'],
|
|
229
222
|
rules: {
|
|
230
223
|
'prettier/prettier': ['warn', { parser: 'css' }],
|
|
231
224
|
},
|
|
232
225
|
};
|
|
233
226
|
|
|
234
|
-
|
|
235
|
-
|
|
227
|
+
// SCSS files
|
|
228
|
+
export const scss = {
|
|
229
|
+
files: ['**/*.scss'],
|
|
236
230
|
rules: {
|
|
237
231
|
'prettier/prettier': ['warn', { parser: 'scss' }],
|
|
238
232
|
},
|
|
239
233
|
};
|
|
240
234
|
|
|
241
|
-
|
|
242
|
-
|
|
235
|
+
// Less files
|
|
236
|
+
export const less = {
|
|
237
|
+
files: ['**/*.less'],
|
|
243
238
|
rules: {
|
|
244
239
|
'prettier/prettier': ['warn', { parser: 'less' }],
|
|
245
240
|
},
|
|
246
241
|
};
|
|
247
242
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
files: ['
|
|
251
|
-
|
|
243
|
+
// YAML files
|
|
244
|
+
export const yaml = {
|
|
245
|
+
files: ['**/*.yaml', '**/*.yml'],
|
|
246
|
+
languageOptions: {
|
|
247
|
+
parser: yamlParser,
|
|
248
|
+
},
|
|
252
249
|
rules: {
|
|
253
250
|
'prettier/prettier': ['warn', { parser: 'yaml', singleQuote: false }],
|
|
254
251
|
'yml/quotes': ['warn', { avoidEscape: true, prefer: 'double' }],
|
|
255
252
|
},
|
|
256
253
|
};
|
|
257
254
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
files: ['
|
|
261
|
-
|
|
255
|
+
// TOML files
|
|
256
|
+
export const toml = {
|
|
257
|
+
files: ['**/*.toml'],
|
|
258
|
+
languageOptions: {
|
|
259
|
+
parser: tomlParser,
|
|
260
|
+
},
|
|
262
261
|
rules: {
|
|
263
262
|
'prettier/prettier': 'off',
|
|
264
263
|
},
|
|
265
264
|
};
|
|
266
265
|
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
// Markdown files
|
|
267
|
+
export const md = {
|
|
268
|
+
files: ['**/*.md'],
|
|
269
269
|
plugins: {
|
|
270
|
-
markdownlint
|
|
270
|
+
markdownlint,
|
|
271
271
|
},
|
|
272
272
|
rules: {
|
|
273
|
-
...
|
|
273
|
+
...markdownlint.configs.recommended.rules,
|
|
274
274
|
'markdownlint/md033': 'off',
|
|
275
275
|
'markdownlint/md041': 'off',
|
|
276
276
|
'prettier/prettier': ['warn', { parser: 'markdown' }],
|
|
277
277
|
},
|
|
278
278
|
};
|
|
279
279
|
|
|
280
|
-
|
|
281
|
-
|
|
280
|
+
// Package.json files
|
|
281
|
+
export const packageJson = {
|
|
282
|
+
files: ['**/package.json'],
|
|
282
283
|
rules: {
|
|
283
284
|
'prettier/prettier': ['warn', { parser: 'json' }],
|
|
284
285
|
},
|
|
@@ -314,106 +315,101 @@ const packageJson = {
|
|
|
314
315
|
},
|
|
315
316
|
};
|
|
316
317
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
318
|
+
// HTML files
|
|
319
|
+
export const htmlConfig = {
|
|
320
|
+
files: ['**/*.html'],
|
|
321
|
+
languageOptions: {
|
|
322
|
+
parser: htmlParser,
|
|
323
|
+
},
|
|
324
|
+
plugins: {
|
|
325
|
+
'@html-eslint': html,
|
|
321
326
|
},
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
const html = {
|
|
325
|
-
extends: ['plugin:@html-eslint/recommended'],
|
|
326
|
-
files: ['*.html'],
|
|
327
|
-
parser: '@html-eslint/parser',
|
|
328
|
-
plugins: ['@html-eslint'],
|
|
329
327
|
rules: {
|
|
328
|
+
...html.configs.recommended.rules,
|
|
330
329
|
'@html-eslint/element-newline': 'off',
|
|
331
330
|
'@html-eslint/indent': 'off',
|
|
332
331
|
'@html-eslint/no-extra-spacing-attrs': 'off',
|
|
333
332
|
'@html-eslint/require-closing-tags': 'off',
|
|
334
|
-
'disable-autofix/@html-eslint/require-closing-tags': [
|
|
335
|
-
'warn',
|
|
336
|
-
{ selfClosing: 'always' },
|
|
337
|
-
],
|
|
338
333
|
'prettier/prettier': ['warn', { parser: 'html' }],
|
|
339
334
|
'spaced-comment': 'off',
|
|
340
335
|
strict: 'off',
|
|
341
336
|
},
|
|
342
337
|
};
|
|
343
338
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
files: ['
|
|
347
|
-
|
|
339
|
+
// JSONC files
|
|
340
|
+
export const jsonc = {
|
|
341
|
+
files: ['**/*.jsonc', '**/*rc'],
|
|
342
|
+
languageOptions: {
|
|
343
|
+
parser: jsoncParser,
|
|
344
|
+
},
|
|
348
345
|
rules: {
|
|
349
346
|
'prettier/prettier': ['warn', { parser: 'json' }],
|
|
350
347
|
},
|
|
351
348
|
};
|
|
352
349
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
files: ['
|
|
356
|
-
|
|
350
|
+
// JSON5 files
|
|
351
|
+
export const json5 = {
|
|
352
|
+
files: ['**/*.json5'],
|
|
353
|
+
languageOptions: {
|
|
354
|
+
parser: jsoncParser,
|
|
355
|
+
},
|
|
357
356
|
rules: {
|
|
358
357
|
'prettier/prettier': ['warn', { parser: 'json5' }],
|
|
359
358
|
},
|
|
360
359
|
};
|
|
361
360
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
361
|
+
// Jest JavaScript files
|
|
362
|
+
export const jestJs = {
|
|
363
|
+
files: ['**/*.test.js', '**/__tests__/**/*.js'],
|
|
364
|
+
languageOptions: {
|
|
365
|
+
globals: { jest: true },
|
|
365
366
|
},
|
|
366
|
-
extends: ['plugin:jest/all'],
|
|
367
|
-
files: ['*.test.js', '**/__tests__/**/*.js'],
|
|
368
367
|
plugins: {
|
|
369
|
-
jest
|
|
368
|
+
jest,
|
|
370
369
|
},
|
|
371
370
|
rules: {
|
|
371
|
+
...jest.configs.all.rules,
|
|
372
372
|
'jest/prefer-spy-on': 'warn',
|
|
373
373
|
'jest/require-top-level-describe': 'error',
|
|
374
374
|
'jest/unbound-method': 'off',
|
|
375
375
|
'unicorn/no-array-callback-reference': 'off',
|
|
376
|
-
'unicorn/prevent-abbreviations': [
|
|
377
|
-
'warn',
|
|
378
|
-
{
|
|
379
|
-
ignore: [/e2e/],
|
|
380
|
-
},
|
|
381
|
-
],
|
|
376
|
+
'unicorn/prevent-abbreviations': ['warn', { ignore: [/e2e/] }],
|
|
382
377
|
},
|
|
383
378
|
};
|
|
384
379
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
380
|
+
// Jest TypeScript files
|
|
381
|
+
export const jestTs = {
|
|
382
|
+
files: ['**/*.test.ts', '**/__tests__/**/*.ts'],
|
|
383
|
+
languageOptions: {
|
|
384
|
+
globals: { jest: true },
|
|
385
|
+
parser: tsParser,
|
|
388
386
|
},
|
|
389
|
-
extends: ['plugin:jest/all'],
|
|
390
|
-
files: ['*.test.ts', '**/__tests__/**/*.ts'],
|
|
391
|
-
parser: '@typescript-eslint/parser',
|
|
392
387
|
plugins: {
|
|
393
|
-
'@typescript-eslint':
|
|
394
|
-
jest
|
|
388
|
+
'@typescript-eslint': tsPlugin,
|
|
389
|
+
jest,
|
|
395
390
|
},
|
|
396
391
|
rules: {
|
|
392
|
+
...jest.configs.all.rules,
|
|
397
393
|
'jest/prefer-spy-on': 'warn',
|
|
398
394
|
'jest/require-top-level-describe': 'error',
|
|
399
395
|
'jest/unbound-method': 'off',
|
|
400
396
|
'unicorn/no-array-callback-reference': 'off',
|
|
401
|
-
'unicorn/prevent-abbreviations': [
|
|
402
|
-
'warn',
|
|
403
|
-
{
|
|
404
|
-
ignore: [/e2e/],
|
|
405
|
-
},
|
|
406
|
-
],
|
|
397
|
+
'unicorn/prevent-abbreviations': ['warn', { ignore: [/e2e/] }],
|
|
407
398
|
},
|
|
408
399
|
};
|
|
409
400
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
files: ['
|
|
413
|
-
|
|
414
|
-
|
|
401
|
+
// Cypress files
|
|
402
|
+
export const cypressConfig = {
|
|
403
|
+
files: ['**/*.cy.*'],
|
|
404
|
+
plugins: {
|
|
405
|
+
cypress,
|
|
406
|
+
},
|
|
407
|
+
rules: {
|
|
408
|
+
...cypress.configs.recommended.rules,
|
|
409
|
+
},
|
|
415
410
|
};
|
|
416
411
|
|
|
412
|
+
// Export all overrides
|
|
417
413
|
export const baseOverrides = [
|
|
418
414
|
ts,
|
|
419
415
|
css,
|
|
@@ -423,11 +419,10 @@ export const baseOverrides = [
|
|
|
423
419
|
toml,
|
|
424
420
|
md,
|
|
425
421
|
packageJson,
|
|
426
|
-
|
|
427
|
-
html,
|
|
422
|
+
htmlConfig,
|
|
428
423
|
jsonc,
|
|
429
424
|
json5,
|
|
430
425
|
jestJs,
|
|
431
426
|
jestTs,
|
|
432
|
-
|
|
427
|
+
cypressConfig,
|
|
433
428
|
];
|