@bfra.me/eslint-config 0.50.3 → 0.51.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/lib/index.d.ts +3311 -3278
- package/lib/index.js +8 -78
- package/package.json +13 -13
- package/src/configs/react.ts +7 -82
- package/src/rules.d.ts +3311 -3278
package/lib/index.js
CHANGED
|
@@ -147,7 +147,7 @@ var GLOB_EXCLUDE = [
|
|
|
147
147
|
import { fileURLToPath } from "url";
|
|
148
148
|
|
|
149
149
|
// package.json
|
|
150
|
-
var version = "0.
|
|
150
|
+
var version = "0.51.0";
|
|
151
151
|
|
|
152
152
|
// src/parsers/any-parser.ts
|
|
153
153
|
var lineBreakPattern = /\r\n|[\n\r\u2028\u2029]/u;
|
|
@@ -1381,8 +1381,8 @@ var ReactRouterPackages = [
|
|
|
1381
1381
|
];
|
|
1382
1382
|
var NextJsPackages = ["next"];
|
|
1383
1383
|
var ReactTypeAwareRules = {
|
|
1384
|
-
"react/no-implicit-key": "warn",
|
|
1385
|
-
"react/no-leaked-conditional-rendering": "warn"
|
|
1384
|
+
"@eslint-react/no-implicit-key": "warn",
|
|
1385
|
+
"@eslint-react/no-leaked-conditional-rendering": "warn"
|
|
1386
1386
|
};
|
|
1387
1387
|
async function react(options = {}) {
|
|
1388
1388
|
const {
|
|
@@ -1396,11 +1396,10 @@ async function react(options = {}) {
|
|
|
1396
1396
|
} = options;
|
|
1397
1397
|
const isTypeAware = typeof tsconfigPath === "string" && tsconfigPath.trim().length > 0;
|
|
1398
1398
|
return requireOf(
|
|
1399
|
-
["@eslint-react/eslint-plugin", "eslint-plugin-react-
|
|
1399
|
+
["@eslint-react/eslint-plugin", "eslint-plugin-react-refresh"],
|
|
1400
1400
|
async () => {
|
|
1401
|
-
const [pluginReact,
|
|
1401
|
+
const [pluginReact, pluginReactRefresh] = await Promise.all([
|
|
1402
1402
|
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
1403
|
-
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1404
1403
|
import("eslint-plugin-react-refresh").then((m) => m.reactRefresh)
|
|
1405
1404
|
]);
|
|
1406
1405
|
const plugins = pluginReact.configs.all.plugins;
|
|
@@ -1414,13 +1413,8 @@ async function react(options = {}) {
|
|
|
1414
1413
|
{
|
|
1415
1414
|
name: "@bfra.me/react/setup",
|
|
1416
1415
|
plugins: {
|
|
1417
|
-
|
|
1418
|
-
"react-
|
|
1419
|
-
"react-hooks": pluginReactHooks,
|
|
1420
|
-
"react-hooks-extra": plugins["@eslint-react/hooks-extra"],
|
|
1421
|
-
"react-naming-convention": plugins["@eslint-react/naming-convention"],
|
|
1422
|
-
"react-refresh": pluginReactRefresh.plugin,
|
|
1423
|
-
"react-web-api": plugins["@eslint-react/web-api"]
|
|
1416
|
+
...plugins,
|
|
1417
|
+
"react-refresh": pluginReactRefresh.plugin
|
|
1424
1418
|
}
|
|
1425
1419
|
},
|
|
1426
1420
|
{
|
|
@@ -1435,26 +1429,7 @@ async function react(options = {}) {
|
|
|
1435
1429
|
sourceType: "module"
|
|
1436
1430
|
},
|
|
1437
1431
|
rules: {
|
|
1438
|
-
|
|
1439
|
-
"react-dom/no-namespace": "error",
|
|
1440
|
-
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
1441
|
-
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
1442
|
-
"react-dom/no-find-dom-node": "error",
|
|
1443
|
-
"react-dom/no-flush-sync": "error",
|
|
1444
|
-
"react-dom/no-hydrate": "error",
|
|
1445
|
-
"react-dom/no-missing-button-type": "warn",
|
|
1446
|
-
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
1447
|
-
"react-dom/no-render": "error",
|
|
1448
|
-
"react-dom/no-render-return-value": "error",
|
|
1449
|
-
"react-dom/no-script-url": "warn",
|
|
1450
|
-
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
1451
|
-
"react-dom/no-unsafe-target-blank": "warn",
|
|
1452
|
-
"react-dom/no-use-form-state": "error",
|
|
1453
|
-
"react-dom/no-void-elements-with-children": "error",
|
|
1454
|
-
// recommended rules from eslint-plugin-react-hooks-extra https://eslint-react.xyz/docs/rules/overview#hooks-extra-rules
|
|
1455
|
-
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
1456
|
-
// recommended rules eslint-plugin-react-hooks https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks/src/rules
|
|
1457
|
-
...pluginReactHooks.configs.recommended.rules,
|
|
1432
|
+
...pluginReact.configs.recommended.rules,
|
|
1458
1433
|
// preconfigured rules from eslint-plugin-react-refresh https://github.com/ArnaudBarre/eslint-plugin-react-refresh/tree/main/src
|
|
1459
1434
|
"react-refresh/only-export-components": [
|
|
1460
1435
|
"warn",
|
|
@@ -1490,51 +1465,6 @@ async function react(options = {}) {
|
|
|
1490
1465
|
]
|
|
1491
1466
|
}
|
|
1492
1467
|
],
|
|
1493
|
-
// recommended rules from eslint-plugin-react-web-api https://eslint-react.xyz/docs/rules/overview#web-api-rules
|
|
1494
|
-
"react-web-api/no-leaked-event-listener": "warn",
|
|
1495
|
-
"react-web-api/no-leaked-interval": "warn",
|
|
1496
|
-
"react-web-api/no-leaked-resize-observer": "warn",
|
|
1497
|
-
"react-web-api/no-leaked-timeout": "warn",
|
|
1498
|
-
// recommended rules from eslint-plugin-react-x https://eslint-react.xyz/docs/rules/overview#core-rules
|
|
1499
|
-
"react/jsx-no-comment-textnodes": "warn",
|
|
1500
|
-
"react/jsx-no-duplicate-props": "warn",
|
|
1501
|
-
"react/jsx-uses-vars": "warn",
|
|
1502
|
-
"react/no-access-state-in-setstate": "error",
|
|
1503
|
-
"react/no-array-index-key": "warn",
|
|
1504
|
-
"react/no-children-count": "warn",
|
|
1505
|
-
"react/no-children-for-each": "warn",
|
|
1506
|
-
"react/no-children-map": "warn",
|
|
1507
|
-
"react/no-children-only": "warn",
|
|
1508
|
-
"react/no-children-to-array": "warn",
|
|
1509
|
-
"react/no-clone-element": "warn",
|
|
1510
|
-
"react/no-component-will-mount": "error",
|
|
1511
|
-
"react/no-component-will-receive-props": "error",
|
|
1512
|
-
"react/no-component-will-update": "error",
|
|
1513
|
-
"react/no-context-provider": "warn",
|
|
1514
|
-
"react/no-create-ref": "error",
|
|
1515
|
-
"react/no-default-props": "error",
|
|
1516
|
-
"react/no-direct-mutation-state": "error",
|
|
1517
|
-
"react/no-duplicate-key": "warn",
|
|
1518
|
-
"react/no-forward-ref": "warn",
|
|
1519
|
-
"react/no-missing-key": "error",
|
|
1520
|
-
"react/no-nested-component-definitions": "error",
|
|
1521
|
-
"react/no-prop-types": "error",
|
|
1522
|
-
"react/no-redundant-should-component-update": "error",
|
|
1523
|
-
"react/no-set-state-in-component-did-mount": "warn",
|
|
1524
|
-
"react/no-set-state-in-component-did-update": "warn",
|
|
1525
|
-
"react/no-set-state-in-component-will-update": "warn",
|
|
1526
|
-
"react/no-string-refs": "error",
|
|
1527
|
-
"react/no-unnecessary-use-prefix": "warn",
|
|
1528
|
-
"react/no-unsafe-component-will-mount": "warn",
|
|
1529
|
-
"react/no-unsafe-component-will-receive-props": "warn",
|
|
1530
|
-
"react/no-unsafe-component-will-update": "warn",
|
|
1531
|
-
"react/no-unstable-context-value": "warn",
|
|
1532
|
-
"react/no-unstable-default-props": "warn",
|
|
1533
|
-
"react/no-unused-class-component-members": "warn",
|
|
1534
|
-
"react/no-unused-state": "warn",
|
|
1535
|
-
"react/no-use-context": "warn",
|
|
1536
|
-
"react/no-useless-forward-ref": "warn",
|
|
1537
|
-
"react/prefer-use-state-lazy-initialization": "warn",
|
|
1538
1468
|
...overrides
|
|
1539
1469
|
}
|
|
1540
1470
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bfra.me/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"description": "Shared ESLint configuration for bfra.me",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bfra.me",
|
|
@@ -55,27 +55,27 @@
|
|
|
55
55
|
"eslint-plugin-unicorn": "64.0.0",
|
|
56
56
|
"eslint-plugin-unused-imports": "4.4.1",
|
|
57
57
|
"eslint-plugin-yml": "3.3.1",
|
|
58
|
-
"globals": "17.
|
|
58
|
+
"globals": "17.5.0",
|
|
59
59
|
"is-in-ci": "2.0.0",
|
|
60
60
|
"local-pkg": "1.1.2",
|
|
61
61
|
"package-manager-detector": "1.6.0",
|
|
62
62
|
"sort-package-json": "3.6.1",
|
|
63
|
-
"typescript-eslint": "8.58.
|
|
63
|
+
"typescript-eslint": "8.58.1",
|
|
64
64
|
"@bfra.me/es": "0.1.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@eslint-react/eslint-plugin": "2.
|
|
67
|
+
"@eslint-react/eslint-plugin": "4.2.3",
|
|
68
68
|
"@eslint/config-inspector": "1.5.0",
|
|
69
|
-
"@eslint/core": "1.2.
|
|
70
|
-
"@next/eslint-plugin-next": "16.2.
|
|
69
|
+
"@eslint/core": "1.2.1",
|
|
70
|
+
"@next/eslint-plugin-next": "16.2.3",
|
|
71
71
|
"@types/eslint-config-prettier": "6.11.3",
|
|
72
72
|
"@types/eslint-plugin-jsx-a11y": "6.10.1",
|
|
73
|
-
"@typescript-eslint/types": "8.58.
|
|
74
|
-
"@vitest/eslint-plugin": "1.6.
|
|
73
|
+
"@typescript-eslint/types": "8.58.1",
|
|
74
|
+
"@vitest/eslint-plugin": "1.6.15",
|
|
75
75
|
"astro-eslint-parser": "1.4.0",
|
|
76
76
|
"eslint": "10.2.0",
|
|
77
77
|
"eslint-config-prettier": "10.1.8",
|
|
78
|
-
"eslint-plugin-astro": "1.
|
|
78
|
+
"eslint-plugin-astro": "1.7.0",
|
|
79
79
|
"eslint-plugin-erasable-syntax-only": "0.4.0",
|
|
80
80
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
81
81
|
"eslint-plugin-node-dependencies": "2.2.0",
|
|
@@ -84,12 +84,12 @@
|
|
|
84
84
|
"eslint-plugin-react-hooks": "7.0.1",
|
|
85
85
|
"eslint-plugin-react-refresh": "0.5.2",
|
|
86
86
|
"eslint-typegen": "2.3.1",
|
|
87
|
-
"@bfra.me/
|
|
88
|
-
"@bfra.me/
|
|
89
|
-
"@bfra.me/
|
|
87
|
+
"@bfra.me/tsconfig": "0.13.0",
|
|
88
|
+
"@bfra.me/prettier-config": "0.16.8",
|
|
89
|
+
"@bfra.me/works": "0.0.0-development"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
|
-
"@eslint-react/eslint-plugin": "^
|
|
92
|
+
"@eslint-react/eslint-plugin": "^4.2.3",
|
|
93
93
|
"@next/eslint-plugin-next": ">=15.5.3",
|
|
94
94
|
"@vitest/eslint-plugin": "^1.1.21",
|
|
95
95
|
"astro-eslint-parser": "^1.2.2",
|
package/src/configs/react.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type {Plugin} from '@eslint/core'
|
|
2
1
|
import type {Config} from '../config'
|
|
3
2
|
import type {
|
|
4
3
|
Flatten,
|
|
@@ -25,8 +24,8 @@ const ReactRouterPackages = [
|
|
|
25
24
|
const NextJsPackages = ['next']
|
|
26
25
|
|
|
27
26
|
const ReactTypeAwareRules: Config['rules'] = {
|
|
28
|
-
'react/no-implicit-key': 'warn',
|
|
29
|
-
'react/no-leaked-conditional-rendering': 'warn',
|
|
27
|
+
'@eslint-react/no-implicit-key': 'warn',
|
|
28
|
+
'@eslint-react/no-leaked-conditional-rendering': 'warn',
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
/**
|
|
@@ -77,15 +76,14 @@ export async function react(options: ReactOptions = {}): Promise<Config[]> {
|
|
|
77
76
|
const isTypeAware = typeof tsconfigPath === 'string' && tsconfigPath.trim().length > 0
|
|
78
77
|
|
|
79
78
|
return requireOf(
|
|
80
|
-
['@eslint-react/eslint-plugin', 'eslint-plugin-react-
|
|
79
|
+
['@eslint-react/eslint-plugin', 'eslint-plugin-react-refresh'],
|
|
81
80
|
async () => {
|
|
82
|
-
const [pluginReact,
|
|
81
|
+
const [pluginReact, pluginReactRefresh] = await Promise.all([
|
|
83
82
|
interopDefault(import('@eslint-react/eslint-plugin')),
|
|
84
|
-
interopDefault(import('eslint-plugin-react-hooks')),
|
|
85
83
|
import('eslint-plugin-react-refresh').then(m => m.reactRefresh),
|
|
86
84
|
] as const)
|
|
87
85
|
|
|
88
|
-
const plugins =
|
|
86
|
+
const plugins = pluginReact.configs.all.plugins as NonNullable<Config['plugins']>
|
|
89
87
|
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(i =>
|
|
90
88
|
isPackageExists(i),
|
|
91
89
|
)
|
|
@@ -97,13 +95,8 @@ export async function react(options: ReactOptions = {}): Promise<Config[]> {
|
|
|
97
95
|
{
|
|
98
96
|
name: '@bfra.me/react/setup',
|
|
99
97
|
plugins: {
|
|
100
|
-
|
|
101
|
-
'react-dom': plugins['@eslint-react/dom'],
|
|
102
|
-
'react-hooks': pluginReactHooks,
|
|
103
|
-
'react-hooks-extra': plugins['@eslint-react/hooks-extra'],
|
|
104
|
-
'react-naming-convention': plugins['@eslint-react/naming-convention'],
|
|
98
|
+
...plugins,
|
|
105
99
|
'react-refresh': pluginReactRefresh.plugin,
|
|
106
|
-
'react-web-api': plugins['@eslint-react/web-api'],
|
|
107
100
|
} as Config['plugins'],
|
|
108
101
|
},
|
|
109
102
|
{
|
|
@@ -118,28 +111,7 @@ export async function react(options: ReactOptions = {}): Promise<Config[]> {
|
|
|
118
111
|
sourceType: 'module',
|
|
119
112
|
},
|
|
120
113
|
rules: {
|
|
121
|
-
|
|
122
|
-
'react-dom/no-namespace': 'error',
|
|
123
|
-
'react-dom/no-dangerously-set-innerhtml': 'warn',
|
|
124
|
-
'react-dom/no-dangerously-set-innerhtml-with-children': 'error',
|
|
125
|
-
'react-dom/no-find-dom-node': 'error',
|
|
126
|
-
'react-dom/no-flush-sync': 'error',
|
|
127
|
-
'react-dom/no-hydrate': 'error',
|
|
128
|
-
'react-dom/no-missing-button-type': 'warn',
|
|
129
|
-
'react-dom/no-missing-iframe-sandbox': 'warn',
|
|
130
|
-
'react-dom/no-render': 'error',
|
|
131
|
-
'react-dom/no-render-return-value': 'error',
|
|
132
|
-
'react-dom/no-script-url': 'warn',
|
|
133
|
-
'react-dom/no-unsafe-iframe-sandbox': 'warn',
|
|
134
|
-
'react-dom/no-unsafe-target-blank': 'warn',
|
|
135
|
-
'react-dom/no-use-form-state': 'error',
|
|
136
|
-
'react-dom/no-void-elements-with-children': 'error',
|
|
137
|
-
|
|
138
|
-
// recommended rules from eslint-plugin-react-hooks-extra https://eslint-react.xyz/docs/rules/overview#hooks-extra-rules
|
|
139
|
-
'react-hooks-extra/no-direct-set-state-in-use-effect': 'warn',
|
|
140
|
-
|
|
141
|
-
// recommended rules eslint-plugin-react-hooks https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks/src/rules
|
|
142
|
-
...pluginReactHooks.configs.recommended.rules,
|
|
114
|
+
...pluginReact.configs.recommended.rules,
|
|
143
115
|
|
|
144
116
|
// preconfigured rules from eslint-plugin-react-refresh https://github.com/ArnaudBarre/eslint-plugin-react-refresh/tree/main/src
|
|
145
117
|
'react-refresh/only-export-components': [
|
|
@@ -181,53 +153,6 @@ export async function react(options: ReactOptions = {}): Promise<Config[]> {
|
|
|
181
153
|
},
|
|
182
154
|
],
|
|
183
155
|
|
|
184
|
-
// recommended rules from eslint-plugin-react-web-api https://eslint-react.xyz/docs/rules/overview#web-api-rules
|
|
185
|
-
'react-web-api/no-leaked-event-listener': 'warn',
|
|
186
|
-
'react-web-api/no-leaked-interval': 'warn',
|
|
187
|
-
'react-web-api/no-leaked-resize-observer': 'warn',
|
|
188
|
-
'react-web-api/no-leaked-timeout': 'warn',
|
|
189
|
-
|
|
190
|
-
// recommended rules from eslint-plugin-react-x https://eslint-react.xyz/docs/rules/overview#core-rules
|
|
191
|
-
'react/jsx-no-comment-textnodes': 'warn',
|
|
192
|
-
'react/jsx-no-duplicate-props': 'warn',
|
|
193
|
-
'react/jsx-uses-vars': 'warn',
|
|
194
|
-
'react/no-access-state-in-setstate': 'error',
|
|
195
|
-
'react/no-array-index-key': 'warn',
|
|
196
|
-
'react/no-children-count': 'warn',
|
|
197
|
-
'react/no-children-for-each': 'warn',
|
|
198
|
-
'react/no-children-map': 'warn',
|
|
199
|
-
'react/no-children-only': 'warn',
|
|
200
|
-
'react/no-children-to-array': 'warn',
|
|
201
|
-
'react/no-clone-element': 'warn',
|
|
202
|
-
'react/no-component-will-mount': 'error',
|
|
203
|
-
'react/no-component-will-receive-props': 'error',
|
|
204
|
-
'react/no-component-will-update': 'error',
|
|
205
|
-
'react/no-context-provider': 'warn',
|
|
206
|
-
'react/no-create-ref': 'error',
|
|
207
|
-
'react/no-default-props': 'error',
|
|
208
|
-
'react/no-direct-mutation-state': 'error',
|
|
209
|
-
'react/no-duplicate-key': 'warn',
|
|
210
|
-
'react/no-forward-ref': 'warn',
|
|
211
|
-
'react/no-missing-key': 'error',
|
|
212
|
-
'react/no-nested-component-definitions': 'error',
|
|
213
|
-
'react/no-prop-types': 'error',
|
|
214
|
-
'react/no-redundant-should-component-update': 'error',
|
|
215
|
-
'react/no-set-state-in-component-did-mount': 'warn',
|
|
216
|
-
'react/no-set-state-in-component-did-update': 'warn',
|
|
217
|
-
'react/no-set-state-in-component-will-update': 'warn',
|
|
218
|
-
'react/no-string-refs': 'error',
|
|
219
|
-
'react/no-unnecessary-use-prefix': 'warn',
|
|
220
|
-
'react/no-unsafe-component-will-mount': 'warn',
|
|
221
|
-
'react/no-unsafe-component-will-receive-props': 'warn',
|
|
222
|
-
'react/no-unsafe-component-will-update': 'warn',
|
|
223
|
-
'react/no-unstable-context-value': 'warn',
|
|
224
|
-
'react/no-unstable-default-props': 'warn',
|
|
225
|
-
'react/no-unused-class-component-members': 'warn',
|
|
226
|
-
'react/no-unused-state': 'warn',
|
|
227
|
-
'react/no-use-context': 'warn',
|
|
228
|
-
'react/no-useless-forward-ref': 'warn',
|
|
229
|
-
'react/prefer-use-state-lazy-initialization': 'warn',
|
|
230
|
-
|
|
231
156
|
...overrides,
|
|
232
157
|
},
|
|
233
158
|
},
|