@wkovacs64/eslint-config 7.0.2 → 7.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +7 -11
- package/index.js +30 -23
- package/package.json +3 -3
package/README.md
CHANGED
@@ -11,14 +11,13 @@ This is my personal [ESLint][eslint] configuration.
|
|
11
11
|
npm install --save-dev @wkovacs64/eslint-config
|
12
12
|
```
|
13
13
|
|
14
|
-
> Be sure to install the appropriately versioned `eslint` peer dependency as
|
15
|
-
> well.
|
14
|
+
> Be sure to install the appropriately versioned `eslint` peer dependency as well.
|
16
15
|
|
17
16
|
### Usage
|
18
17
|
|
19
|
-
Follow the ESLint documentation on [shared configurations][eslint-sharing]. See
|
20
|
-
|
21
|
-
|
18
|
+
Follow the ESLint documentation on [shared configurations][eslint-sharing]. See the documentation on
|
19
|
+
[ignoring files][eslint-ignores] if you need to ignore anything the config doesn't already ignore by
|
20
|
+
default.
|
22
21
|
|
23
22
|
### Examples
|
24
23
|
|
@@ -48,17 +47,14 @@ export default config;
|
|
48
47
|
}
|
49
48
|
```
|
50
49
|
|
51
|
-
[npm-image]:
|
52
|
-
https://img.shields.io/npm/v/@wkovacs64/eslint-config.svg?style=flat-square
|
50
|
+
[npm-image]: https://img.shields.io/npm/v/@wkovacs64/eslint-config.svg?style=flat-square
|
53
51
|
[npm-url]: https://www.npmjs.com/package/@wkovacs64/eslint-config
|
54
52
|
[ci-image]:
|
55
53
|
https://img.shields.io/github/actions/workflow/status/wKovacs64/eslint-config/ci.yml?logo=github&style=flat-square
|
56
54
|
[ci-url]: https://github.com/wKovacs64/eslint-config/actions?query=workflow%3Aci
|
57
|
-
[changesets-image]:
|
58
|
-
https://img.shields.io/badge/maintained%20with-changesets-blue?style=flat-square
|
55
|
+
[changesets-image]: https://img.shields.io/badge/maintained%20with-changesets-blue?style=flat-square
|
59
56
|
[changesets-url]: https://github.com/changesets/changesets
|
60
57
|
[eslint]: https://eslint.org/
|
61
58
|
[eslint-sharing]:
|
62
59
|
https://eslint.org/docs/latest/use/configure/configuration-files#using-a-shareable-configuration-package
|
63
|
-
[eslint-ignores]:
|
64
|
-
https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files
|
60
|
+
[eslint-ignores]: https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files
|
package/index.js
CHANGED
@@ -5,6 +5,8 @@
|
|
5
5
|
import globals from 'globals';
|
6
6
|
import eslint from '@eslint/js';
|
7
7
|
import tseslint from 'typescript-eslint';
|
8
|
+
import reactPlugin from 'eslint-plugin-react';
|
9
|
+
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
|
8
10
|
import playwright from 'eslint-plugin-playwright';
|
9
11
|
|
10
12
|
const ERROR = 'error';
|
@@ -26,7 +28,7 @@ const hasPlaywright = await has('playwright');
|
|
26
28
|
|
27
29
|
const vitestFiles = ['**/__tests__/**/*', '**/*.test.*'];
|
28
30
|
const testFiles = ['**/tests/**', '**/#tests/**', ...vitestFiles];
|
29
|
-
const playwrightFiles = ['**/playwright
|
31
|
+
const playwrightFiles = ['**/playwright/**/*.(spec|test).*'];
|
30
32
|
|
31
33
|
export const config = [
|
32
34
|
{
|
@@ -66,14 +68,7 @@ export const config = [
|
|
66
68
|
{ pattern: '#*/**', group: 'internal' },
|
67
69
|
{ pattern: '~/**', group: 'internal' },
|
68
70
|
],
|
69
|
-
groups: [
|
70
|
-
'builtin',
|
71
|
-
'external',
|
72
|
-
'internal',
|
73
|
-
'parent',
|
74
|
-
'sibling',
|
75
|
-
'index',
|
76
|
-
],
|
71
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
77
72
|
},
|
78
73
|
],
|
79
74
|
},
|
@@ -82,10 +77,10 @@ export const config = [
|
|
82
77
|
// JSX/TSX files
|
83
78
|
hasReact
|
84
79
|
? {
|
85
|
-
files: ['**/*.tsx', '**/*.jsx']
|
80
|
+
files: ['**/*.tsx', '**/*.jsx'],
|
86
81
|
plugins: {
|
87
|
-
react:
|
88
|
-
'jsx-a11y':
|
82
|
+
react: reactPlugin,
|
83
|
+
'jsx-a11y': jsxA11yPlugin,
|
89
84
|
},
|
90
85
|
languageOptions: {
|
91
86
|
parserOptions: {
|
@@ -95,6 +90,8 @@ export const config = [
|
|
95
90
|
},
|
96
91
|
},
|
97
92
|
rules: {
|
93
|
+
...reactPlugin.configs.recommended.rules,
|
94
|
+
...jsxA11yPlugin.configs.recommended.rules,
|
98
95
|
'react/function-component-definition': [
|
99
96
|
'error',
|
100
97
|
{
|
@@ -102,7 +99,8 @@ export const config = [
|
|
102
99
|
unnamedComponents: 'arrow-function',
|
103
100
|
},
|
104
101
|
],
|
105
|
-
'react/jsx-
|
102
|
+
'react/react-in-jsx-scope': OFF,
|
103
|
+
'react/prop-types': OFF,
|
106
104
|
'jsx-a11y/label-has-associated-control': [
|
107
105
|
ERROR,
|
108
106
|
{
|
@@ -118,8 +116,7 @@ export const config = [
|
|
118
116
|
}
|
119
117
|
: null,
|
120
118
|
|
121
|
-
// react-hook rules are applicable in ts/js/tsx/jsx, but only with React as a
|
122
|
-
// dep
|
119
|
+
// react-hook rules are applicable in ts/js/tsx/jsx, but only with React as a dep
|
123
120
|
hasReact
|
124
121
|
? {
|
125
122
|
files: ['**/*.ts?(x)', '**/*.js?(x)'],
|
@@ -133,14 +130,18 @@ export const config = [
|
|
133
130
|
}
|
134
131
|
: null,
|
135
132
|
|
136
|
-
// JS and
|
133
|
+
// JS, JSX, and CJS files
|
137
134
|
{
|
138
|
-
files: ['**/*.js
|
135
|
+
files: ['**/*.{js,jsx,cjs}'],
|
136
|
+
// most of these rules are useful for JS but not TS because TS handles these better
|
139
137
|
rules: {
|
140
|
-
//
|
141
|
-
//
|
142
|
-
//
|
143
|
-
//
|
138
|
+
// Blocked by https://github.com/import-js/eslint-plugin-import/issues/2132
|
139
|
+
// 'import/no-unresolved': [
|
140
|
+
// ERROR,
|
141
|
+
// {
|
142
|
+
// ignore: ['^#icons/icon', '^~/icons/icon', './icons-sprite.svg'],
|
143
|
+
// },
|
144
|
+
// ],
|
144
145
|
'no-unused-vars': [
|
145
146
|
WARN,
|
146
147
|
{
|
@@ -252,6 +253,13 @@ export const config = [
|
|
252
253
|
'@typescript-eslint/require-await': OFF,
|
253
254
|
'@typescript-eslint/unified-signatures': 'warn',
|
254
255
|
},
|
256
|
+
settings: {
|
257
|
+
'import/resolver': {
|
258
|
+
typescript: {
|
259
|
+
alwaysTryTypes: true,
|
260
|
+
},
|
261
|
+
},
|
262
|
+
},
|
255
263
|
}
|
256
264
|
: null,
|
257
265
|
|
@@ -281,8 +289,7 @@ export const config = [
|
|
281
289
|
files: testFiles,
|
282
290
|
ignores: [...playwrightFiles],
|
283
291
|
plugins: {
|
284
|
-
'testing-library': (await import('eslint-plugin-testing-library'))
|
285
|
-
.default,
|
292
|
+
'testing-library': (await import('eslint-plugin-testing-library')).default,
|
286
293
|
},
|
287
294
|
rules: {
|
288
295
|
// 'testing-library/await-async-events': ERROR,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wkovacs64/eslint-config",
|
3
|
-
"version": "7.0
|
3
|
+
"version": "7.2.0",
|
4
4
|
"description": "@wKovacs64 ESLint config",
|
5
5
|
"keywords": [
|
6
6
|
"eslint",
|
@@ -65,10 +65,10 @@
|
|
65
65
|
"@changesets/changelog-github": "0.5.0",
|
66
66
|
"@changesets/cli": "2.27.5",
|
67
67
|
"@types/eslint__js": "8.42.3",
|
68
|
-
"@types/node": "20.
|
68
|
+
"@types/node": "20.14.1",
|
69
69
|
"@types/react": "18.3.3",
|
70
70
|
"@types/react-dom": "18.3.0",
|
71
|
-
"@wkovacs64/prettier-config": "4.
|
71
|
+
"@wkovacs64/prettier-config": "4.1.0",
|
72
72
|
"eslint": "8.57.0",
|
73
73
|
"prettier": "3.3.0",
|
74
74
|
"typescript": "5.4.5"
|