eslint-config-dolmios 2.0.13 → 2.1.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/eslint.config.js +2 -3
- package/package.json +15 -11
- package/rules.js +74 -4
package/eslint.config.js
CHANGED
|
@@ -9,7 +9,7 @@ import nextPlugin from '@next/eslint-plugin-next';
|
|
|
9
9
|
import react from 'eslint-plugin-react';
|
|
10
10
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
11
11
|
import perfectionist from 'eslint-plugin-perfectionist';
|
|
12
|
-
import customRules from './rules.js';
|
|
12
|
+
import customRules, { typescriptTypeAwareRules } from './rules.js';
|
|
13
13
|
import globals from 'globals';
|
|
14
14
|
|
|
15
15
|
export default [
|
|
@@ -80,7 +80,6 @@ export default [
|
|
|
80
80
|
tsconfigRootDir: process.cwd(),
|
|
81
81
|
},
|
|
82
82
|
},
|
|
83
|
-
rules:
|
|
84
|
-
},
|
|
83
|
+
rules: typescriptTypeAwareRules,
|
|
85
84
|
},
|
|
86
85
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-dolmios",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "A simple ESLint config with Prettier and a couple TSConfig setups",
|
|
5
5
|
"author": "Jackson Dolman <mail@dolmios.com>",
|
|
6
6
|
"bugs": {
|
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@eslint/js": "^9.39.2",
|
|
11
|
-
"@next/eslint-plugin-next": "^16.
|
|
12
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
13
|
-
"@typescript-eslint/parser": "^8.
|
|
11
|
+
"@next/eslint-plugin-next": "^16.1.4",
|
|
12
|
+
"@typescript-eslint/eslint-plugin": "^8.53.1",
|
|
13
|
+
"@typescript-eslint/parser": "^8.53.1",
|
|
14
14
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
15
|
-
"eslint-plugin-perfectionist": "^4.
|
|
15
|
+
"eslint-plugin-perfectionist": "^5.4.0",
|
|
16
16
|
"eslint-plugin-react": "^7.37.5",
|
|
17
17
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
18
|
-
"globals": "^
|
|
18
|
+
"globals": "^17.0.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"eslint": "^9.39.2",
|
|
22
|
-
"next": "^16.
|
|
23
|
-
"prettier": "^3.
|
|
22
|
+
"next": "^16.1.4",
|
|
23
|
+
"prettier": "^3.8.1",
|
|
24
24
|
"typescript": "^5.9.3"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
@@ -49,9 +49,13 @@
|
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"lint": "eslint ./test.js",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
52
|
+
"lint:ts": "eslint ./test.tsx",
|
|
53
|
+
"lint:all": "pnpm lint && pnpm lint:ts",
|
|
54
|
+
"prettier": "prettier --write ./test.js ./test.tsx",
|
|
55
|
+
"print": "eslint --print-config ./test.tsx > reference.txt",
|
|
56
|
+
"print:js": "eslint --print-config ./test.js > reference-js.txt",
|
|
57
|
+
"print:ts": "eslint --print-config ./test.tsx > reference-ts.txt",
|
|
58
|
+
"tidy": "pnpm lint:all && pnpm prettier"
|
|
55
59
|
},
|
|
56
60
|
"type": "module"
|
|
57
61
|
}
|
package/rules.js
CHANGED
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
// TypeScript specific rules
|
|
4
4
|
const typescriptRules = {
|
|
5
5
|
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': 'allow-with-description' }],
|
|
6
|
+
'@typescript-eslint/consistent-type-imports': ['warn', { prefer: 'type-imports' }],
|
|
6
7
|
'@typescript-eslint/explicit-function-return-type': 'warn',
|
|
7
8
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
9
|
+
'@typescript-eslint/no-empty-object-type': 'warn',
|
|
10
|
+
'@typescript-eslint/no-for-in-array': 'warn',
|
|
8
11
|
'@typescript-eslint/no-inferrable-types': 'warn',
|
|
9
12
|
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
10
13
|
'@typescript-eslint/no-unused-vars': [
|
|
@@ -15,9 +18,42 @@ const typescriptRules = {
|
|
|
15
18
|
'no-unused-vars': 'off',
|
|
16
19
|
};
|
|
17
20
|
|
|
21
|
+
// TypeScript type-aware rules (require project: './tsconfig.json' in parserOptions)
|
|
22
|
+
export const typescriptTypeAwareRules = {
|
|
23
|
+
'@typescript-eslint/await-thenable': 'error',
|
|
24
|
+
'@typescript-eslint/no-base-to-string': 'error',
|
|
25
|
+
'@typescript-eslint/no-confusing-void-expression': 'warn',
|
|
26
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
27
|
+
'@typescript-eslint/no-meaningless-void-operator': 'warn',
|
|
28
|
+
'@typescript-eslint/no-implied-eval': 'error',
|
|
29
|
+
'@typescript-eslint/no-misused-promises': 'error',
|
|
30
|
+
'@typescript-eslint/no-unsafe-argument': 'error',
|
|
31
|
+
'@typescript-eslint/no-unsafe-assignment': 'error',
|
|
32
|
+
'@typescript-eslint/no-unsafe-call': 'error',
|
|
33
|
+
'@typescript-eslint/no-unsafe-member-access': 'error',
|
|
34
|
+
'@typescript-eslint/no-unsafe-return': 'error',
|
|
35
|
+
'@typescript-eslint/no-redundant-type-constituents': 'warn',
|
|
36
|
+
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn',
|
|
37
|
+
'@typescript-eslint/no-unnecessary-condition': 'warn',
|
|
38
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
|
|
39
|
+
'@typescript-eslint/prefer-includes': 'warn',
|
|
40
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
|
|
41
|
+
'@typescript-eslint/prefer-optional-chain': 'warn',
|
|
42
|
+
'@typescript-eslint/prefer-regexp-exec': 'warn',
|
|
43
|
+
'@typescript-eslint/prefer-string-starts-ends-with': 'warn',
|
|
44
|
+
'@typescript-eslint/restrict-plus-operands': 'error',
|
|
45
|
+
'@typescript-eslint/restrict-template-expressions': 'error',
|
|
46
|
+
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
47
|
+
};
|
|
48
|
+
|
|
18
49
|
// Accessibility rules
|
|
19
50
|
const a11yRules = {
|
|
51
|
+
'jsx-a11y/alt-text': 'warn',
|
|
52
|
+
'jsx-a11y/anchor-is-valid': 'warn',
|
|
53
|
+
'jsx-a11y/aria-props': 'warn',
|
|
54
|
+
'jsx-a11y/aria-proptypes': 'warn',
|
|
20
55
|
'jsx-a11y/aria-role': 'warn',
|
|
56
|
+
'jsx-a11y/aria-unsupported-elements': 'warn',
|
|
21
57
|
'jsx-a11y/autocomplete-valid': 'warn',
|
|
22
58
|
'jsx-a11y/click-events-have-key-events': 'warn',
|
|
23
59
|
'jsx-a11y/heading-has-content': 'warn',
|
|
@@ -34,6 +70,8 @@ const a11yRules = {
|
|
|
34
70
|
'jsx-a11y/no-distracting-elements': 'warn',
|
|
35
71
|
'jsx-a11y/no-redundant-roles': 'warn',
|
|
36
72
|
'jsx-a11y/no-static-element-interactions': 'warn',
|
|
73
|
+
'jsx-a11y/role-has-required-aria-props': 'warn',
|
|
74
|
+
'jsx-a11y/role-supports-aria-props': 'warn',
|
|
37
75
|
'jsx-a11y/scope': 'warn',
|
|
38
76
|
};
|
|
39
77
|
|
|
@@ -46,10 +84,14 @@ const reactRules = {
|
|
|
46
84
|
'react/display-name': 'off',
|
|
47
85
|
'react/jsx-boolean-value': 'warn',
|
|
48
86
|
'react/jsx-handler-names': 'warn',
|
|
87
|
+
'react/jsx-key': 'error',
|
|
49
88
|
'react/jsx-no-bind': [
|
|
50
89
|
'warn',
|
|
51
90
|
{ allowArrowFunctions: true, ignoreRefs: true },
|
|
52
91
|
],
|
|
92
|
+
'react/jsx-no-constructed-context-values': 'warn',
|
|
93
|
+
'react/jsx-no-leaked-render': 'warn',
|
|
94
|
+
'react/jsx-no-target-blank': 'warn',
|
|
53
95
|
'react/jsx-no-useless-fragment': 'warn',
|
|
54
96
|
'react/jsx-pascal-case': 'warn',
|
|
55
97
|
'react/jsx-sort-props': [
|
|
@@ -64,13 +106,25 @@ const reactRules = {
|
|
|
64
106
|
}
|
|
65
107
|
],
|
|
66
108
|
'react/no-access-state-in-setstate': 'warn',
|
|
109
|
+
'react/no-array-index-key': 'warn',
|
|
67
110
|
'react/no-arrow-function-lifecycle': 'warn',
|
|
111
|
+
'react/no-children-prop': 'warn',
|
|
68
112
|
'react/no-danger': 'warn',
|
|
113
|
+
'react/no-danger-with-children': 'warn',
|
|
114
|
+
'react/no-deprecated': 'warn',
|
|
115
|
+
'react/no-direct-mutation-state': 'warn',
|
|
116
|
+
'react/no-find-dom-node': 'warn',
|
|
69
117
|
'react/no-invalid-html-attribute': 'warn',
|
|
118
|
+
'react/no-object-type-as-default-prop': 'warn',
|
|
119
|
+
'react/no-render-return-value': 'warn',
|
|
70
120
|
'react/no-set-state': 'warn',
|
|
121
|
+
'react/no-string-refs': 'warn',
|
|
71
122
|
'react/no-this-in-sfc': 'warn',
|
|
72
123
|
'react/no-typos': 'warn',
|
|
124
|
+
'react/no-unescaped-entities': 'warn',
|
|
125
|
+
'react/no-unknown-property': 'warn',
|
|
73
126
|
'react/no-unused-state': 'warn',
|
|
127
|
+
'react/no-unstable-nested-components': 'warn',
|
|
74
128
|
'react/self-closing-comp': 'warn',
|
|
75
129
|
'react/sort-comp': 'warn',
|
|
76
130
|
'react/style-prop-object': 'warn',
|
|
@@ -83,14 +137,17 @@ const nextRules = {
|
|
|
83
137
|
'@next/next/google-font-preconnect': 'warn',
|
|
84
138
|
'@next/next/next-script-for-ga': 'warn',
|
|
85
139
|
'@next/next/no-css-tags': 'warn',
|
|
140
|
+
'@next/next/no-head-element': 'warn',
|
|
141
|
+
'@next/next/no-head-import-in-document': 'warn',
|
|
86
142
|
'@next/next/no-html-link-for-pages': 'off',
|
|
87
143
|
'@next/next/no-img-element': 'warn',
|
|
88
144
|
'@next/next/no-page-custom-font': 'warn',
|
|
145
|
+
'@next/next/no-styled-jsx-in-document': 'warn',
|
|
89
146
|
'@next/next/no-sync-scripts': 'warn',
|
|
90
147
|
'@next/next/no-unwanted-polyfillio': 'warn',
|
|
91
148
|
};
|
|
92
149
|
|
|
93
|
-
// Perfectionist rules
|
|
150
|
+
// Perfectionist rules - takes priority for all sorting
|
|
94
151
|
const perfectionistRules = {
|
|
95
152
|
'perfectionist/sort-imports': ['warn', { order: 'asc', type: 'natural' }],
|
|
96
153
|
'perfectionist/sort-objects': ['warn', { order: 'asc', type: 'natural' }],
|
|
@@ -100,14 +157,16 @@ const perfectionistRules = {
|
|
|
100
157
|
const generalRules = {
|
|
101
158
|
'consistent-this': ['warn', 'self'],
|
|
102
159
|
'eqeqeq': 'warn',
|
|
103
|
-
'no-alert': '
|
|
160
|
+
'no-alert': 'error',
|
|
161
|
+
'no-await-in-loop': 'warn',
|
|
104
162
|
'no-console': 'warn',
|
|
105
163
|
'no-duplicate-imports': 'warn',
|
|
106
164
|
'no-empty': 'warn',
|
|
107
165
|
'no-eq-null': 'warn',
|
|
108
|
-
'no-eval': '
|
|
166
|
+
'no-eval': 'error',
|
|
109
167
|
'no-extra-bind': 'warn',
|
|
110
168
|
'no-extra-label': 'warn',
|
|
169
|
+
'no-implicit-coercion': 'warn',
|
|
111
170
|
'no-invalid-this': 'warn',
|
|
112
171
|
'no-iterator': 'warn',
|
|
113
172
|
'no-label-var': 'warn',
|
|
@@ -121,9 +180,16 @@ const generalRules = {
|
|
|
121
180
|
{ max: 1, maxBOF: 0, maxEOF: 0 },
|
|
122
181
|
],
|
|
123
182
|
'no-new': 'warn',
|
|
183
|
+
'no-new-wrappers': 'warn',
|
|
124
184
|
'no-octal-escape': 'warn',
|
|
185
|
+
'no-param-reassign': ['warn', { props: false }],
|
|
186
|
+
'no-promise-executor-return': 'warn',
|
|
125
187
|
'no-proto': 'warn',
|
|
188
|
+
// Note: no-restricted-imports and no-restricted-syntax require configuration to be effective
|
|
189
|
+
// They can be configured per-project to restrict specific imports or syntax patterns
|
|
190
|
+
// Removed from default config - add back per-project if needed with specific restrictions
|
|
126
191
|
'no-template-curly-in-string': 'warn',
|
|
192
|
+
'no-throw-literal': 'warn',
|
|
127
193
|
'no-unreachable-loop': 'warn',
|
|
128
194
|
'no-unused-expressions': 'warn',
|
|
129
195
|
'no-unused-labels': 'warn',
|
|
@@ -143,7 +209,10 @@ const generalRules = {
|
|
|
143
209
|
{ blankLine: 'always', next: '*', prev: ['const', 'let', 'var'] },
|
|
144
210
|
{ blankLine: 'any', next: ['const', 'let', 'var'], prev: ['const', 'let', 'var'] },
|
|
145
211
|
],
|
|
212
|
+
'prefer-const': 'warn',
|
|
146
213
|
'prefer-destructuring': ['warn', { array: true, object: true }],
|
|
214
|
+
'prefer-promise-reject-errors': 'warn',
|
|
215
|
+
'require-atomic-updates': 'warn',
|
|
147
216
|
'yoda': 'warn',
|
|
148
217
|
};
|
|
149
218
|
|
|
@@ -154,12 +223,13 @@ const prettierRules = {
|
|
|
154
223
|
};
|
|
155
224
|
|
|
156
225
|
// Export all rule groups combined
|
|
226
|
+
// Note: perfectionistRules should come after generalRules to take priority
|
|
157
227
|
export default {
|
|
158
228
|
...typescriptRules,
|
|
159
229
|
...a11yRules,
|
|
160
230
|
...reactRules,
|
|
161
231
|
...nextRules,
|
|
162
|
-
...perfectionistRules,
|
|
163
232
|
...generalRules,
|
|
164
233
|
...prettierRules,
|
|
234
|
+
...perfectionistRules, // Perfectionist takes priority for sorting
|
|
165
235
|
};
|