@dr.pogodin/eslint-configs 0.0.5 → 0.0.6
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 +8 -5
- package/config/javascript.js +3 -1
- package/config/jest.js +2 -0
- package/config/react.js +17 -5
- package/config/typescript.js +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -146,12 +146,15 @@ and it applies to them the following rule sets:
|
|
|
146
146
|
the `recommended` rule set, with minor overrides, and many additional rules
|
|
147
147
|
enabled.
|
|
148
148
|
|
|
149
|
-
- [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks) —
|
|
150
|
-
all rules enabled.
|
|
151
|
-
|
|
152
149
|
Additionally, it applies to all other files matched by any other [ESLint]
|
|
153
|
-
configuration object
|
|
154
|
-
|
|
150
|
+
configuration object; and it applies to them the following rule sets:
|
|
151
|
+
|
|
152
|
+
- [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)
|
|
153
|
+
— all rules enabled (it has to apply to all files, as hooks do not have
|
|
154
|
+
to live ony inside JSX or TSX files exclusively).
|
|
155
|
+
|
|
156
|
+
- the rule that forbids using JSX syntax in files with extensions different from
|
|
157
|
+
`.jsx` or `.tsx`.
|
|
155
158
|
|
|
156
159
|
### `configs.typescript`
|
|
157
160
|
[`configs.typescript`]: #configstypescript
|
package/config/javascript.js
CHANGED
|
@@ -212,7 +212,9 @@ export default defineConfig([{
|
|
|
212
212
|
'no-new-wrappers': 'error',
|
|
213
213
|
'no-object-constructor': 'error',
|
|
214
214
|
'no-octal-escape': 'error',
|
|
215
|
-
'no-param-reassign': 'error',
|
|
215
|
+
'no-param-reassign': ['error', {
|
|
216
|
+
props: true,
|
|
217
|
+
}],
|
|
216
218
|
'no-promise-executor-return': 'error',
|
|
217
219
|
'no-proto': 'error',
|
|
218
220
|
'no-return-assign': 'error',
|
package/config/jest.js
CHANGED
package/config/react.js
CHANGED
|
@@ -18,7 +18,6 @@ export default defineConfig([{
|
|
|
18
18
|
},
|
|
19
19
|
plugins: {
|
|
20
20
|
react,
|
|
21
|
-
'react-hooks': reactHooks,
|
|
22
21
|
},
|
|
23
22
|
settings: {
|
|
24
23
|
react: {
|
|
@@ -101,20 +100,33 @@ export default defineConfig([{
|
|
|
101
100
|
'react/sort-comp': 'error',
|
|
102
101
|
'react/style-prop-object': 'error',
|
|
103
102
|
'react/void-dom-elements-no-children': 'error',
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
},
|
|
104
|
+
}, {
|
|
105
|
+
files: ['**/*.jsx'],
|
|
106
|
+
name: 'dr.pogodin/react/jsx',
|
|
107
|
+
rules: {
|
|
108
|
+
// This is our preferred naming scheme for pure JSX code (i.e., non-TypeScript).
|
|
109
|
+
'react/function-component-definition': ['error', {
|
|
110
|
+
namedComponents: 'function-declaration',
|
|
111
|
+
unnamedComponents: 'arrow-function',
|
|
112
|
+
}],
|
|
108
113
|
},
|
|
109
114
|
}, {
|
|
110
115
|
name: 'dr.pogodin/react/global',
|
|
111
116
|
plugins: {
|
|
112
117
|
react,
|
|
118
|
+
'react-hooks': reactHooks,
|
|
113
119
|
},
|
|
114
120
|
rules: {
|
|
115
121
|
'react/jsx-filename-extension': ['error', {
|
|
116
122
|
allow: 'as-needed',
|
|
117
123
|
extensions: ['.jsx', '.tsx'],
|
|
118
124
|
}],
|
|
125
|
+
|
|
126
|
+
// Rules provided by eslint-plugin-react-hooks; they should be applied to
|
|
127
|
+
// all files, as hooks do not have to live exclusively in .jsx / .tsx files
|
|
128
|
+
// alongside JSX syntax!
|
|
129
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
130
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
119
131
|
},
|
|
120
132
|
}]);
|
package/config/typescript.js
CHANGED
|
@@ -52,6 +52,7 @@ export default tsEsLint.config(
|
|
|
52
52
|
'@typescript-eslint/no-mixed-enums': 'error',
|
|
53
53
|
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
|
|
54
54
|
'@typescript-eslint/no-redeclare': 'error',
|
|
55
|
+
'@typescript-eslint/no-unnecessary-type-conversion': 'error',
|
|
55
56
|
|
|
56
57
|
// NOTE: The core rule variant reports incorrect errors on TypeScript
|
|
57
58
|
// code, thus disabled.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dr.pogodin/eslint-configs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "ESLint configurations for TypeScript and/or React projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./config/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/eslint-parser": "^7.27.1",
|
|
33
33
|
"@babel/eslint-plugin": "^7.27.1",
|
|
34
|
-
"@babel/preset-env": "^7.27.
|
|
34
|
+
"@babel/preset-env": "^7.27.2",
|
|
35
35
|
"@babel/preset-react": "^7.27.1",
|
|
36
36
|
"@babel/preset-typescript": "^7.27.1",
|
|
37
37
|
"@eslint/js": "^9.26.0",
|
|
@@ -44,6 +44,6 @@
|
|
|
44
44
|
"eslint-plugin-react": "^7.37.4",
|
|
45
45
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
46
46
|
"typescript": "^5.7.0",
|
|
47
|
-
"typescript-eslint": "^8.
|
|
47
|
+
"typescript-eslint": "^8.32.0"
|
|
48
48
|
}
|
|
49
49
|
}
|