@vinicunca/eslint-config 3.8.0 → 3.10.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/dist/index.d.ts +226 -180
- package/dist/index.js +112 -48
- package/package.json +16 -12
package/dist/index.js
CHANGED
|
@@ -1314,6 +1314,12 @@ var RemixPackages = [
|
|
|
1314
1314
|
"@remix-run/serve",
|
|
1315
1315
|
"@remix-run/dev"
|
|
1316
1316
|
];
|
|
1317
|
+
var ReactRouterPackages = [
|
|
1318
|
+
"@react-router/node",
|
|
1319
|
+
"@react-router/react",
|
|
1320
|
+
"@react-router/serve",
|
|
1321
|
+
"@react-router/dev"
|
|
1322
|
+
];
|
|
1317
1323
|
var NextJsPackages = [
|
|
1318
1324
|
"next"
|
|
1319
1325
|
];
|
|
@@ -1330,7 +1336,7 @@ async function react(options = {}) {
|
|
|
1330
1336
|
} = options;
|
|
1331
1337
|
const isTypeAware = !!tsconfigPath;
|
|
1332
1338
|
const typeAwareRules = {
|
|
1333
|
-
"react/no-leaked-conditional-rendering":
|
|
1339
|
+
"react/no-leaked-conditional-rendering": WARN
|
|
1334
1340
|
};
|
|
1335
1341
|
const [
|
|
1336
1342
|
pluginReact,
|
|
@@ -1343,6 +1349,7 @@ async function react(options = {}) {
|
|
|
1343
1349
|
]);
|
|
1344
1350
|
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists3(i));
|
|
1345
1351
|
const isUsingRemix = RemixPackages.some((i) => isPackageExists3(i));
|
|
1352
|
+
const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists3(i));
|
|
1346
1353
|
const isUsingNext = NextJsPackages.some((i) => isPackageExists3(i));
|
|
1347
1354
|
const plugins = pluginReact.configs.all.plugins;
|
|
1348
1355
|
return [
|
|
@@ -1354,7 +1361,8 @@ async function react(options = {}) {
|
|
|
1354
1361
|
"react-hooks": pluginReactHooks,
|
|
1355
1362
|
"react-hooks-extra": plugins["@eslint-react/hooks-extra"],
|
|
1356
1363
|
"react-naming-convention": plugins["@eslint-react/naming-convention"],
|
|
1357
|
-
"react-refresh": pluginReactRefresh
|
|
1364
|
+
"react-refresh": pluginReactRefresh,
|
|
1365
|
+
"react-web-api": plugins["@eslint-react/web-api"]
|
|
1358
1366
|
}
|
|
1359
1367
|
},
|
|
1360
1368
|
{
|
|
@@ -1369,28 +1377,86 @@ async function react(options = {}) {
|
|
|
1369
1377
|
},
|
|
1370
1378
|
name: "vinicunca/react/rules",
|
|
1371
1379
|
rules: {
|
|
1372
|
-
// recommended rules from
|
|
1373
|
-
"react
|
|
1380
|
+
// recommended rules from eslint-plugin-react-x https://eslint-react.xyz/docs/rules/overview#core-rules
|
|
1381
|
+
"react/no-access-state-in-setstate": ERROR,
|
|
1382
|
+
"react/no-array-index-key": WARN,
|
|
1383
|
+
"react/no-children-count": WARN,
|
|
1384
|
+
"react/no-children-for-each": WARN,
|
|
1385
|
+
"react/no-children-map": WARN,
|
|
1386
|
+
"react/no-children-only": WARN,
|
|
1387
|
+
"react/no-children-to-array": WARN,
|
|
1388
|
+
"react/no-clone-element": WARN,
|
|
1389
|
+
"react/no-comment-textnodes": WARN,
|
|
1390
|
+
"react/no-component-will-mount": ERROR,
|
|
1391
|
+
"react/no-component-will-receive-props": ERROR,
|
|
1392
|
+
"react/no-component-will-update": ERROR,
|
|
1393
|
+
"react/no-context-provider": WARN,
|
|
1394
|
+
"react/no-create-ref": ERROR,
|
|
1395
|
+
"react/no-default-props": ERROR,
|
|
1396
|
+
"react/no-direct-mutation-state": ERROR,
|
|
1397
|
+
"react/no-duplicate-jsx-props": WARN,
|
|
1398
|
+
"react/no-duplicate-key": WARN,
|
|
1399
|
+
"react/no-forward-ref": WARN,
|
|
1400
|
+
"react/no-implicit-key": WARN,
|
|
1401
|
+
"react/no-missing-key": ERROR,
|
|
1402
|
+
"react/no-nested-component-definitions": ERROR,
|
|
1403
|
+
"react/no-prop-types": ERROR,
|
|
1404
|
+
"react/no-redundant-should-component-update": ERROR,
|
|
1405
|
+
"react/no-set-state-in-component-did-mount": WARN,
|
|
1406
|
+
"react/no-set-state-in-component-did-update": WARN,
|
|
1407
|
+
"react/no-set-state-in-component-will-update": WARN,
|
|
1408
|
+
"react/no-string-refs": ERROR,
|
|
1409
|
+
"react/no-unsafe-component-will-mount": WARN,
|
|
1410
|
+
"react/no-unsafe-component-will-receive-props": WARN,
|
|
1411
|
+
"react/no-unsafe-component-will-update": WARN,
|
|
1412
|
+
"react/no-unstable-context-value": WARN,
|
|
1413
|
+
"react/no-unstable-default-props": WARN,
|
|
1414
|
+
"react/no-unused-class-component-members": WARN,
|
|
1415
|
+
"react/no-unused-state": WARN,
|
|
1416
|
+
"react/no-use-context": WARN,
|
|
1417
|
+
"react/no-useless-forward-ref": WARN,
|
|
1418
|
+
"react/use-jsx-vars": WARN,
|
|
1419
|
+
// recommended rules from eslint-plugin-react-dom https://eslint-react.xyz/docs/rules/overview#dom-rule
|
|
1374
1420
|
"react-dom/no-dangerously-set-innerhtml": WARN,
|
|
1375
1421
|
"react-dom/no-dangerously-set-innerhtml-with-children": ERROR,
|
|
1376
1422
|
"react-dom/no-find-dom-node": ERROR,
|
|
1423
|
+
"react-dom/no-flush-sync": "error",
|
|
1424
|
+
"react-dom/no-hydrate": "error",
|
|
1377
1425
|
"react-dom/no-missing-button-type": WARN,
|
|
1378
1426
|
"react-dom/no-missing-iframe-sandbox": WARN,
|
|
1379
1427
|
"react-dom/no-namespace": ERROR,
|
|
1428
|
+
"react-dom/no-render": "error",
|
|
1380
1429
|
"react-dom/no-render-return-value": ERROR,
|
|
1381
1430
|
"react-dom/no-script-url": WARN,
|
|
1382
1431
|
"react-dom/no-unsafe-iframe-sandbox": WARN,
|
|
1383
1432
|
"react-dom/no-unsafe-target-blank": WARN,
|
|
1384
|
-
|
|
1433
|
+
"react-dom/no-use-form-state": "error",
|
|
1434
|
+
"react-dom/no-void-elements-with-children": "error",
|
|
1435
|
+
// recommended rules eslint-plugin-react-hooks https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks/src/rules
|
|
1385
1436
|
"react-hooks/exhaustive-deps": WARN,
|
|
1386
1437
|
"react-hooks/rules-of-hooks": ERROR,
|
|
1387
|
-
// react
|
|
1438
|
+
// recommended rules from eslint-plugin-react-hooks-extra https://eslint-react.xyz/docs/rules/overview#hooks-extra-rules
|
|
1439
|
+
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
1440
|
+
"react-hooks-extra/no-unnecessary-use-prefix": "warn",
|
|
1441
|
+
// recommended rules from eslint-plugin-react-web-api https://eslint-react.xyz/docs/rules/overview#web-api-rules
|
|
1442
|
+
"react-web-api/no-leaked-event-listener": "warn",
|
|
1443
|
+
"react-web-api/no-leaked-interval": "warn",
|
|
1444
|
+
"react-web-api/no-leaked-resize-observer": "warn",
|
|
1445
|
+
"react-web-api/no-leaked-timeout": "warn",
|
|
1446
|
+
// preconfigured rules from eslint-plugin-react-refresh https://github.com/ArnaudBarre/eslint-plugin-react-refresh/tree/main/src
|
|
1388
1447
|
"react-refresh/only-export-components": [
|
|
1389
1448
|
WARN,
|
|
1390
1449
|
{
|
|
1391
1450
|
allowConstantExport: isAllowConstantExport,
|
|
1392
1451
|
allowExportNames: [
|
|
1393
1452
|
...isUsingNext ? [
|
|
1453
|
+
"dynamic",
|
|
1454
|
+
"dynamicParams",
|
|
1455
|
+
"revalidate",
|
|
1456
|
+
"fetchCache",
|
|
1457
|
+
"runtime",
|
|
1458
|
+
"preferredRegion",
|
|
1459
|
+
"maxDuration",
|
|
1394
1460
|
"config",
|
|
1395
1461
|
"generateStaticParams",
|
|
1396
1462
|
"metadata",
|
|
@@ -1398,7 +1464,7 @@ async function react(options = {}) {
|
|
|
1398
1464
|
"viewport",
|
|
1399
1465
|
"generateViewport"
|
|
1400
1466
|
] : [],
|
|
1401
|
-
...isUsingRemix ? [
|
|
1467
|
+
...isUsingRemix || isUsingReactRouter ? [
|
|
1402
1468
|
"meta",
|
|
1403
1469
|
"links",
|
|
1404
1470
|
"headers",
|
|
@@ -1408,43 +1474,6 @@ async function react(options = {}) {
|
|
|
1408
1474
|
]
|
|
1409
1475
|
}
|
|
1410
1476
|
],
|
|
1411
|
-
// recommended rules from @eslint-react
|
|
1412
|
-
"react/ensure-forward-ref-using-ref": WARN,
|
|
1413
|
-
"react/no-access-state-in-setstate": ERROR,
|
|
1414
|
-
"react/no-array-index-key": WARN,
|
|
1415
|
-
"react/no-children-count": WARN,
|
|
1416
|
-
"react/no-children-for-each": WARN,
|
|
1417
|
-
"react/no-children-map": WARN,
|
|
1418
|
-
"react/no-children-only": WARN,
|
|
1419
|
-
"react/no-children-prop": WARN,
|
|
1420
|
-
"react/no-children-to-array": WARN,
|
|
1421
|
-
"react/no-clone-element": WARN,
|
|
1422
|
-
"react/no-comment-textnodes": WARN,
|
|
1423
|
-
"react/no-component-will-mount": ERROR,
|
|
1424
|
-
"react/no-component-will-receive-props": ERROR,
|
|
1425
|
-
"react/no-component-will-update": ERROR,
|
|
1426
|
-
"react/no-create-ref": ERROR,
|
|
1427
|
-
"react/no-direct-mutation-state": ERROR,
|
|
1428
|
-
"react/no-duplicate-key": ERROR,
|
|
1429
|
-
"react/no-implicit-key": ERROR,
|
|
1430
|
-
"react/no-missing-key": ERROR,
|
|
1431
|
-
"react/no-nested-components": WARN,
|
|
1432
|
-
"react/no-redundant-should-component-update": ERROR,
|
|
1433
|
-
"react/no-set-state-in-component-did-mount": WARN,
|
|
1434
|
-
"react/no-set-state-in-component-did-update": WARN,
|
|
1435
|
-
"react/no-set-state-in-component-will-update": WARN,
|
|
1436
|
-
"react/no-string-refs": ERROR,
|
|
1437
|
-
"react/no-unsafe-component-will-mount": WARN,
|
|
1438
|
-
"react/no-unsafe-component-will-receive-props": WARN,
|
|
1439
|
-
"react/no-unsafe-component-will-update": WARN,
|
|
1440
|
-
"react/no-unstable-context-value": ERROR,
|
|
1441
|
-
"react/no-unstable-default-props": ERROR,
|
|
1442
|
-
"react/no-unused-class-component-members": WARN,
|
|
1443
|
-
"react/no-unused-state": WARN,
|
|
1444
|
-
"react/no-useless-fragment": WARN,
|
|
1445
|
-
"react/prefer-destructuring-assignment": WARN,
|
|
1446
|
-
"react/prefer-shorthand-boolean": WARN,
|
|
1447
|
-
"react/prefer-shorthand-fragment": WARN,
|
|
1448
1477
|
// overrides
|
|
1449
1478
|
...overrides
|
|
1450
1479
|
}
|
|
@@ -1727,6 +1756,7 @@ function sortTsconfig() {
|
|
|
1727
1756
|
"useDefineForClassFields",
|
|
1728
1757
|
"emitDecoratorMetadata",
|
|
1729
1758
|
"experimentalDecorators",
|
|
1759
|
+
"libReplacement",
|
|
1730
1760
|
/* Modules */
|
|
1731
1761
|
"baseUrl",
|
|
1732
1762
|
"rootDir",
|
|
@@ -1800,6 +1830,7 @@ function sortTsconfig() {
|
|
|
1800
1830
|
"isolatedModules",
|
|
1801
1831
|
"preserveSymlinks",
|
|
1802
1832
|
"verbatimModuleSyntax",
|
|
1833
|
+
"erasableSyntaxOnly",
|
|
1803
1834
|
/* Completeness */
|
|
1804
1835
|
"skipDefaultLibCheck",
|
|
1805
1836
|
"skipLibCheck"
|
|
@@ -2269,26 +2300,35 @@ async function vue(options = {}) {
|
|
|
2269
2300
|
const {
|
|
2270
2301
|
files = [GLOB_VUE],
|
|
2271
2302
|
overrides = {},
|
|
2272
|
-
stylistic: stylistic2 = true
|
|
2303
|
+
stylistic: stylistic2 = true,
|
|
2304
|
+
a11y = false
|
|
2273
2305
|
} = options;
|
|
2274
2306
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
2275
2307
|
const {
|
|
2276
2308
|
indent = 2
|
|
2277
2309
|
} = e2(stylistic2) ? {} : stylistic2;
|
|
2310
|
+
if (a11y) {
|
|
2311
|
+
await ensurePackages([
|
|
2312
|
+
"eslint-plugin-vuejs-accessibility"
|
|
2313
|
+
]);
|
|
2314
|
+
}
|
|
2278
2315
|
const [
|
|
2279
2316
|
pluginVue,
|
|
2280
2317
|
parserVue,
|
|
2281
|
-
processorVueBlocks
|
|
2318
|
+
processorVueBlocks,
|
|
2319
|
+
pluginVueA11y
|
|
2282
2320
|
] = await Promise.all([
|
|
2283
2321
|
interopDefault(import("eslint-plugin-vue")),
|
|
2284
2322
|
interopDefault(import("vue-eslint-parser")),
|
|
2285
|
-
interopDefault(import("eslint-processor-vue-blocks"))
|
|
2323
|
+
interopDefault(import("eslint-processor-vue-blocks")),
|
|
2324
|
+
...a11y ? [interopDefault(import("eslint-plugin-vuejs-accessibility"))] : []
|
|
2286
2325
|
]);
|
|
2287
2326
|
return [
|
|
2288
2327
|
{
|
|
2289
2328
|
name: "vinicunca/vue/setup",
|
|
2290
2329
|
plugins: {
|
|
2291
|
-
vue: pluginVue
|
|
2330
|
+
vue: pluginVue,
|
|
2331
|
+
...a11y ? { "vue-a11y": pluginVueA11y } : {}
|
|
2292
2332
|
},
|
|
2293
2333
|
// This allows Vue plugin to work with auto imports
|
|
2294
2334
|
// https://github.com/vuejs/eslint-plugin-vue/pull/2422
|
|
@@ -2428,6 +2468,30 @@ async function vue(options = {}) {
|
|
|
2428
2468
|
"vue/space-in-parens": [ERROR, NEVER],
|
|
2429
2469
|
"vue/template-curly-spacing": ERROR
|
|
2430
2470
|
} : {},
|
|
2471
|
+
...a11y ? {
|
|
2472
|
+
"vue-a11y/alt-text": ERROR,
|
|
2473
|
+
"vue-a11y/anchor-has-content": ERROR,
|
|
2474
|
+
"vue-a11y/aria-props": ERROR,
|
|
2475
|
+
"vue-a11y/aria-role": ERROR,
|
|
2476
|
+
"vue-a11y/aria-unsupported-elements": ERROR,
|
|
2477
|
+
"vue-a11y/click-events-have-key-events": ERROR,
|
|
2478
|
+
"vue-a11y/form-control-has-label": ERROR,
|
|
2479
|
+
"vue-a11y/heading-has-content": ERROR,
|
|
2480
|
+
"vue-a11y/iframe-has-title": ERROR,
|
|
2481
|
+
"vue-a11y/interactive-supports-focus": ERROR,
|
|
2482
|
+
"vue-a11y/label-has-for": ERROR,
|
|
2483
|
+
"vue-a11y/media-has-caption": WARN,
|
|
2484
|
+
"vue-a11y/mouse-events-have-key-events": ERROR,
|
|
2485
|
+
"vue-a11y/no-access-key": ERROR,
|
|
2486
|
+
"vue-a11y/no-aria-hidden-on-focusable": ERROR,
|
|
2487
|
+
"vue-a11y/no-autofocus": WARN,
|
|
2488
|
+
"vue-a11y/no-distracting-elements": ERROR,
|
|
2489
|
+
"vue-a11y/no-redundant-roles": ERROR,
|
|
2490
|
+
"vue-a11y/no-role-presentation-on-focusable": ERROR,
|
|
2491
|
+
"vue-a11y/no-static-element-interactions": ERROR,
|
|
2492
|
+
"vue-a11y/role-has-required-aria-props": ERROR,
|
|
2493
|
+
"vue-a11y/tabindex-no-positive": WARN
|
|
2494
|
+
} : {},
|
|
2431
2495
|
...overrides
|
|
2432
2496
|
}
|
|
2433
2497
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vinicunca/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.10.0",
|
|
5
5
|
"description": "Vinicunca ESLint config",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "praburangki",
|
|
@@ -58,10 +58,11 @@
|
|
|
58
58
|
"eslint": "^9.10.0",
|
|
59
59
|
"eslint-plugin-astro": "^1.2.0",
|
|
60
60
|
"eslint-plugin-format": ">=0.1.0",
|
|
61
|
-
"eslint-plugin-react-hooks": "^5.
|
|
62
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
61
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
62
|
+
"eslint-plugin-react-refresh": "^0.4.19",
|
|
63
63
|
"eslint-plugin-solid": "^0.14.3",
|
|
64
64
|
"eslint-plugin-svelte": ">=2.35.1",
|
|
65
|
+
"eslint-plugin-vuejs-accessibility": "^2.4.1",
|
|
65
66
|
"prettier-plugin-astro": "^0.14.0",
|
|
66
67
|
"prettier-plugin-slidev": "^1.0.5",
|
|
67
68
|
"svelte-eslint-parser": ">=0.37.0"
|
|
@@ -94,6 +95,9 @@
|
|
|
94
95
|
"eslint-plugin-svelte": {
|
|
95
96
|
"optional": true
|
|
96
97
|
},
|
|
98
|
+
"eslint-plugin-vuejs-accessibility": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
97
101
|
"prettier-plugin-astro": {
|
|
98
102
|
"optional": true
|
|
99
103
|
},
|
|
@@ -110,19 +114,19 @@
|
|
|
110
114
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
111
115
|
"@eslint/markdown": "^6.3.0",
|
|
112
116
|
"@stylistic/eslint-plugin": "^4.2.0",
|
|
113
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
114
|
-
"@typescript-eslint/parser": "^8.
|
|
115
|
-
"@unocss/eslint-plugin": "^66.0.
|
|
116
|
-
"@vitest/eslint-plugin": "^1.1.
|
|
117
|
+
"@typescript-eslint/eslint-plugin": "^8.28.0",
|
|
118
|
+
"@typescript-eslint/parser": "^8.28.0",
|
|
119
|
+
"@unocss/eslint-plugin": "^66.1.0-beta.7",
|
|
120
|
+
"@vitest/eslint-plugin": "^1.1.38",
|
|
117
121
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
118
122
|
"eslint-flat-config-utils": "^2.0.1",
|
|
119
123
|
"eslint-merge-processors": "^2.0.0",
|
|
120
124
|
"eslint-plugin-antfu": "^3.1.1",
|
|
121
|
-
"eslint-plugin-command": "^3.
|
|
125
|
+
"eslint-plugin-command": "^3.2.0",
|
|
122
126
|
"eslint-plugin-format": "^1.0.1",
|
|
123
|
-
"eslint-plugin-import-x": "^4.
|
|
124
|
-
"eslint-plugin-jsdoc": "^50.6.
|
|
125
|
-
"eslint-plugin-jsonc": "^2.
|
|
127
|
+
"eslint-plugin-import-x": "^4.9.2",
|
|
128
|
+
"eslint-plugin-jsdoc": "^50.6.9",
|
|
129
|
+
"eslint-plugin-jsonc": "^2.20.0",
|
|
126
130
|
"eslint-plugin-n": "^17.16.2",
|
|
127
131
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
128
132
|
"eslint-plugin-perfectionist": "^4.10.1",
|
|
@@ -130,7 +134,7 @@
|
|
|
130
134
|
"eslint-plugin-regexp": "^2.7.0",
|
|
131
135
|
"eslint-plugin-sonarjs": "^3.0.2",
|
|
132
136
|
"eslint-plugin-toml": "^0.12.0",
|
|
133
|
-
"eslint-plugin-unicorn": "^
|
|
137
|
+
"eslint-plugin-unicorn": "^58.0.0",
|
|
134
138
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
135
139
|
"eslint-plugin-vue": "^10.0.0",
|
|
136
140
|
"eslint-plugin-yml": "^1.17.0",
|