@willbooster/eslint-config-js-react 11.6.0 → 12.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 +4 -3
- package/eslint.config.js +158 -18
- package/package.json +17 -18
package/README.md
CHANGED
|
@@ -6,16 +6,17 @@ Install the package and its peer dependencies.
|
|
|
6
6
|
```sh
|
|
7
7
|
yarn add -D @willbooster/eslint-config-js-react \
|
|
8
8
|
@eslint/js \
|
|
9
|
+
@eslint-react/eslint-plugin \
|
|
9
10
|
eslint \
|
|
10
11
|
eslint-config-flat-gitignore \
|
|
11
12
|
eslint-config-prettier \
|
|
12
13
|
eslint-plugin-import-x \
|
|
13
|
-
eslint-plugin-
|
|
14
|
+
eslint-plugin-perfectionist \
|
|
14
15
|
eslint-plugin-react-compiler \
|
|
15
|
-
eslint-plugin-react-hooks \
|
|
16
16
|
eslint-plugin-sort-class-members \
|
|
17
17
|
eslint-plugin-sort-destructure-keys \
|
|
18
18
|
eslint-plugin-unicorn \
|
|
19
19
|
eslint-plugin-unused-imports \
|
|
20
|
-
globals
|
|
20
|
+
globals \
|
|
21
|
+
typescript
|
|
21
22
|
```
|
package/eslint.config.js
CHANGED
|
@@ -1,46 +1,186 @@
|
|
|
1
|
-
import
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import eslintPluginReact from '@eslint-react/eslint-plugin';
|
|
2
3
|
import eslintConfigFlatGitignore from 'eslint-config-flat-gitignore';
|
|
3
4
|
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
4
|
-
import
|
|
5
|
+
import eslintPluginImportX from 'eslint-plugin-import-x';
|
|
6
|
+
import eslintPluginPerfectionist from 'eslint-plugin-perfectionist';
|
|
5
7
|
import eslintPluginReactCompiler from 'eslint-plugin-react-compiler';
|
|
6
|
-
import
|
|
8
|
+
import eslintPluginSortClassMembers from 'eslint-plugin-sort-class-members';
|
|
9
|
+
import eslintPluginSortDestructureKeys from 'eslint-plugin-sort-destructure-keys';
|
|
10
|
+
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
|
|
11
|
+
import eslintPluginUnusedImports from 'eslint-plugin-unused-imports';
|
|
12
|
+
import globals from 'globals';
|
|
7
13
|
|
|
8
|
-
|
|
14
|
+
/** Copied from `packages/eslint-config-js/eslint.config.js` to keep this published config self-contained. */
|
|
15
|
+
const jsConfig = [
|
|
16
|
+
// Note: don't merge the below two objects!
|
|
17
|
+
{
|
|
18
|
+
files: ['{,prisma/**/,src/**/,test/**/,scripts/**/}*.{cjs,js,mjs}'],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
ignores: [
|
|
22
|
+
// Directories
|
|
23
|
+
'**/.venv/**',
|
|
24
|
+
'**/.yarn/**',
|
|
25
|
+
'**/3rd-party/**',
|
|
26
|
+
'**/@types/**',
|
|
27
|
+
'**/__generated__/**',
|
|
28
|
+
'**/android/**',
|
|
29
|
+
'**/bin/**',
|
|
30
|
+
'**/build/**',
|
|
31
|
+
'**/coverage/**',
|
|
32
|
+
'**/dist/**',
|
|
33
|
+
'**/ios/**',
|
|
34
|
+
'**/no-format/**',
|
|
35
|
+
'**/node_modules/**',
|
|
36
|
+
'**/temp/**',
|
|
37
|
+
'**/test-fixtures/**',
|
|
38
|
+
'**/test/fixtures/**',
|
|
39
|
+
// Files
|
|
40
|
+
'**/*.d.ts',
|
|
41
|
+
'**/*.min.*js',
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
// cf. https://github.com/eslint/eslint/blob/main/packages/js/src/configs/eslint-recommended.js
|
|
45
|
+
js.configs.recommended,
|
|
46
|
+
// cf. https://github.com/un-ts/eslint-plugin-import-x#configuration-new-eslintconfigjs
|
|
47
|
+
// eslint-disable-next-line import-x/no-named-as-default-member
|
|
48
|
+
eslintPluginImportX.flatConfigs.recommended,
|
|
49
|
+
// cf. https://github.com/sindresorhus/eslint-plugin-unicorn#recommended-config
|
|
50
|
+
eslintPluginUnicorn.configs.recommended,
|
|
51
|
+
{
|
|
52
|
+
plugins: {
|
|
53
|
+
'sort-class-members': eslintPluginSortClassMembers,
|
|
54
|
+
'sort-destructure-keys': eslintPluginSortDestructureKeys,
|
|
55
|
+
},
|
|
56
|
+
languageOptions: {
|
|
57
|
+
ecmaVersion: 'latest',
|
|
58
|
+
globals: {
|
|
59
|
+
// for Web
|
|
60
|
+
...globals.browser,
|
|
61
|
+
...globals.serviceworker,
|
|
62
|
+
// for Node.js
|
|
63
|
+
...globals.node,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
rules: {
|
|
67
|
+
eqeqeq: 'warn',
|
|
68
|
+
'no-console': 'off', // Allow `console.log()`.
|
|
69
|
+
'no-unused-vars': ['warn', { ignoreRestSiblings: true }], // Allow unused vars in object destructuring.
|
|
70
|
+
'object-shorthand': 'error',
|
|
71
|
+
'one-var': ['error', 'never'], // We prefer one variable declaration per line.
|
|
72
|
+
'spaced-comment': 'error', // Enforce consistency of spacing after the start of a comment // or /*.
|
|
73
|
+
'import-x/newline-after-import': 'error',
|
|
74
|
+
'import-x/no-duplicates': 'error',
|
|
75
|
+
/** Because we faced false positives (e.g. fast-glob), */
|
|
76
|
+
'import-x/no-named-as-default-member': 'warn',
|
|
77
|
+
'import-x/order': [
|
|
78
|
+
'error',
|
|
79
|
+
{
|
|
80
|
+
'newlines-between': 'always',
|
|
81
|
+
alphabetize: {
|
|
82
|
+
order: 'asc',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
'sort-destructure-keys/sort-destructure-keys': 'error',
|
|
87
|
+
'unicorn/filename-case': [
|
|
88
|
+
'error',
|
|
89
|
+
{
|
|
90
|
+
cases: {
|
|
91
|
+
camelCase: true,
|
|
92
|
+
pascalCase: true,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
'unicorn/no-abusive-eslint-disable': 'off',
|
|
97
|
+
'unicorn/no-array-callback-reference': 'off',
|
|
98
|
+
'unicorn/no-array-reduce': 'warn',
|
|
99
|
+
'unicorn/no-null': 'warn',
|
|
100
|
+
'unicorn/no-process-exit': 'off',
|
|
101
|
+
'unicorn/no-useless-undefined': [
|
|
102
|
+
'error',
|
|
103
|
+
{
|
|
104
|
+
checkArguments: false,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
'unicorn/prefer-top-level-await': 'warn',
|
|
108
|
+
'unicorn/prevent-abbreviations': 'off',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
// cf. https://github.com/sweepline/eslint-plugin-unused-imports#usage
|
|
112
|
+
{
|
|
113
|
+
plugins: {
|
|
114
|
+
'unused-imports': eslintPluginUnusedImports,
|
|
115
|
+
},
|
|
116
|
+
rules: {
|
|
117
|
+
'no-unused-vars': 'off',
|
|
118
|
+
'unused-imports/no-unused-imports': 'error',
|
|
119
|
+
'unused-imports/no-unused-vars': [
|
|
120
|
+
'warn',
|
|
121
|
+
{
|
|
122
|
+
vars: 'all',
|
|
123
|
+
varsIgnorePattern: '^_',
|
|
124
|
+
args: 'after-used',
|
|
125
|
+
argsIgnorePattern: '^_',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
eslintConfigFlatGitignore(),
|
|
131
|
+
// cf. https://github.com/prettier/eslint-config-prettier#installation
|
|
132
|
+
eslintConfigPrettier,
|
|
133
|
+
];
|
|
9
134
|
|
|
10
135
|
export default [
|
|
11
136
|
...jsConfig,
|
|
137
|
+
/** React-specific rules copied from the previous `@willbooster/eslint-config-js-react` body. */
|
|
12
138
|
{
|
|
13
|
-
files: ['{,prisma/**/,src/**/,test/**/,scripts/**/}*.jsx'],
|
|
139
|
+
files: ['{,prisma/**/,src/**/,test/**/,scripts/**/}*.{cjs,js,jsx,mjs}'],
|
|
140
|
+
languageOptions: {
|
|
141
|
+
parserOptions: {
|
|
142
|
+
ecmaFeatures: {
|
|
143
|
+
jsx: true,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
14
147
|
},
|
|
15
|
-
// cf. https://
|
|
16
|
-
eslintPluginReact.configs.
|
|
17
|
-
eslintPluginReact.configs.flat['jsx-runtime'],
|
|
18
|
-
// cf. https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks#readme
|
|
19
|
-
reactHooksFlatRecommended,
|
|
148
|
+
// cf. https://eslint-react.xyz/docs/migrating-from-eslint-plugin-react
|
|
149
|
+
eslintPluginReact.configs.recommended,
|
|
20
150
|
// cf. https://www.npmjs.com/package/eslint-plugin-react-compiler
|
|
21
151
|
eslintPluginReactCompiler.configs.recommended,
|
|
22
152
|
{
|
|
153
|
+
plugins: {
|
|
154
|
+
perfectionist: eslintPluginPerfectionist,
|
|
155
|
+
},
|
|
23
156
|
settings: {
|
|
24
|
-
react: {
|
|
157
|
+
'react-x': {
|
|
25
158
|
version: 'detect',
|
|
26
159
|
},
|
|
27
160
|
},
|
|
28
161
|
rules: {
|
|
29
|
-
'react/
|
|
162
|
+
'@eslint-react/dom-no-unknown-property': [
|
|
30
163
|
'error',
|
|
31
164
|
{
|
|
32
|
-
|
|
33
|
-
shorthandFirst: true,
|
|
34
|
-
reservedFirst: true,
|
|
165
|
+
ignore: ['global', 'jsx'],
|
|
35
166
|
},
|
|
36
167
|
],
|
|
37
|
-
'
|
|
168
|
+
'perfectionist/sort-jsx-props': [
|
|
38
169
|
'error',
|
|
39
170
|
{
|
|
40
|
-
|
|
171
|
+
customGroups: [
|
|
172
|
+
{
|
|
173
|
+
groupName: 'reserved',
|
|
174
|
+
elementNamePattern: '^(children|dangerouslySetInnerHTML|key|ref)$',
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
groupName: 'callback',
|
|
178
|
+
elementNamePattern: '^on[A-Z]',
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
groups: ['reserved', 'shorthand-prop', 'unknown', 'callback'],
|
|
41
182
|
},
|
|
42
183
|
],
|
|
43
|
-
'react/prop-types': 'off',
|
|
44
184
|
},
|
|
45
185
|
},
|
|
46
186
|
eslintConfigFlatGitignore(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/eslint-config-js-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "ESLint flat config for JavaScript React projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,27 +20,24 @@
|
|
|
20
20
|
"cleanup": "yarn format && yarn lint-fix",
|
|
21
21
|
"format": "sort-package-json && yarn prettify",
|
|
22
22
|
"lint": "eslint --color",
|
|
23
|
-
"lint-fix": "yarn lint --fix --rule \"{ react
|
|
23
|
+
"lint-fix": "yarn lint --fix --rule \"{ '@eslint-react/exhaustive-deps': 0 }\"",
|
|
24
24
|
"prettify": "prettier --cache --color --write \"**/{.*/,}*.{cjs,css,cts,htm,html,java,js,json,json5,jsonc,jsx,md,mjs,mts,scss,ts,tsx,vue,yaml,yml}\" \"!**/test{-,/}fixtures/**\" || true",
|
|
25
25
|
"test": "yarn lint"
|
|
26
26
|
},
|
|
27
27
|
"prettier": "@willbooster/prettier-config",
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"@willbooster/eslint-config-js": "11.5.0"
|
|
30
|
-
},
|
|
31
28
|
"devDependencies": {
|
|
32
|
-
"@eslint/
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
35
|
-
"eslint
|
|
29
|
+
"@eslint-react/eslint-plugin": "4.2.3",
|
|
30
|
+
"@eslint/js": "10.0.1",
|
|
31
|
+
"@willbooster/prettier-config": "10.4.0",
|
|
32
|
+
"eslint": "10.2.0",
|
|
33
|
+
"eslint-config-flat-gitignore": "2.3.0",
|
|
36
34
|
"eslint-config-prettier": "10.1.8",
|
|
37
35
|
"eslint-plugin-import-x": "4.16.2",
|
|
38
|
-
"eslint-plugin-
|
|
36
|
+
"eslint-plugin-perfectionist": "5.8.0",
|
|
39
37
|
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
40
|
-
"eslint-plugin-react-hooks": "7.0.1",
|
|
41
38
|
"eslint-plugin-sort-class-members": "1.21.0",
|
|
42
39
|
"eslint-plugin-sort-destructure-keys": "3.0.0",
|
|
43
|
-
"eslint-plugin-unicorn": "
|
|
40
|
+
"eslint-plugin-unicorn": "64.0.0",
|
|
44
41
|
"eslint-plugin-unused-imports": "4.4.1",
|
|
45
42
|
"globals": "17.4.0",
|
|
46
43
|
"lint-staged": "16.4.0",
|
|
@@ -48,22 +45,24 @@
|
|
|
48
45
|
"prettier": "3.8.1",
|
|
49
46
|
"prettier-plugin-java": "2.8.1",
|
|
50
47
|
"react": "19.2.4",
|
|
51
|
-
"sort-package-json": "3.6.1"
|
|
48
|
+
"sort-package-json": "3.6.1",
|
|
49
|
+
"typescript": "6.0.2"
|
|
52
50
|
},
|
|
53
51
|
"peerDependencies": {
|
|
54
|
-
"@eslint/
|
|
55
|
-
"eslint": ">=
|
|
52
|
+
"@eslint-react/eslint-plugin": ">=4.2.3",
|
|
53
|
+
"@eslint/js": ">=10",
|
|
54
|
+
"eslint": ">=10",
|
|
56
55
|
"eslint-config-flat-gitignore": ">=2.1",
|
|
57
56
|
"eslint-config-prettier": ">=10",
|
|
58
57
|
"eslint-plugin-import-x": ">=4",
|
|
59
|
-
"eslint-plugin-
|
|
58
|
+
"eslint-plugin-perfectionist": ">=5.8",
|
|
60
59
|
"eslint-plugin-react-compiler": ">=19.1.0-rc.2",
|
|
61
|
-
"eslint-plugin-react-hooks": ">=6",
|
|
62
60
|
"eslint-plugin-sort-class-members": ">=1.21",
|
|
63
61
|
"eslint-plugin-sort-destructure-keys": ">=2",
|
|
64
62
|
"eslint-plugin-unicorn": ">=57",
|
|
65
63
|
"eslint-plugin-unused-imports": ">=4",
|
|
66
|
-
"globals": ">=16"
|
|
64
|
+
"globals": ">=16",
|
|
65
|
+
"typescript": ">=5"
|
|
67
66
|
},
|
|
68
67
|
"publishConfig": {
|
|
69
68
|
"access": "public"
|