@oliver139/eslint-config 5.2.0 → 6.0.1
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 +11 -11
- package/dist/cli.mjs +9 -14
- package/dist/index.d.mts +528 -490
- package/dist/index.mjs +31 -126
- package/dist/{lib-D3Kr7UIJ.mjs → lib-zvCEClb6.mjs} +2875 -2324
- package/package.json +49 -53
package/dist/index.mjs
CHANGED
|
@@ -125,13 +125,17 @@ const GLOB_EXCLUDE = [
|
|
|
125
125
|
"**/.output",
|
|
126
126
|
"**/.vite-inspect",
|
|
127
127
|
"**/.yarn",
|
|
128
|
-
"**/vite.config.*.timestamp-*",
|
|
129
128
|
"**/CHANGELOG*.md",
|
|
130
|
-
"**/*.min.*",
|
|
131
129
|
"**/LICENSE*",
|
|
130
|
+
"**/*.min.*",
|
|
132
131
|
"**/__snapshots__",
|
|
132
|
+
"**/vite.config.*.timestamp-*",
|
|
133
133
|
"**/auto-import?(s).d.ts",
|
|
134
|
-
"**/components.d.ts"
|
|
134
|
+
"**/components.d.ts",
|
|
135
|
+
"**/.context",
|
|
136
|
+
"**/.claude",
|
|
137
|
+
"**/.agents",
|
|
138
|
+
"**/.*/skills"
|
|
135
139
|
];
|
|
136
140
|
//#endregion
|
|
137
141
|
//#region src/utils.ts
|
|
@@ -292,6 +296,9 @@ async function angular(options = {}) {
|
|
|
292
296
|
"angular-template/eqeqeq": "error",
|
|
293
297
|
"angular-template/no-negated-async": "error",
|
|
294
298
|
"angular-template/prefer-control-flow": "error",
|
|
299
|
+
/**
|
|
300
|
+
* we need to mute some style lint rules for angular inline templates,
|
|
301
|
+
*/
|
|
295
302
|
"style/indent": "off",
|
|
296
303
|
"style/no-multiple-empty-lines": ["error", { max: 1 }],
|
|
297
304
|
"style/no-trailing-spaces": "off",
|
|
@@ -1396,24 +1403,12 @@ const ReactRouterPackages = [
|
|
|
1396
1403
|
"@react-router/dev"
|
|
1397
1404
|
];
|
|
1398
1405
|
const NextJsPackages = ["next"];
|
|
1399
|
-
const ReactCompilerPackages = ["babel-plugin-react-compiler"];
|
|
1400
1406
|
async function react(options = {}) {
|
|
1401
|
-
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides = {}, tsconfigPath
|
|
1402
|
-
await ensurePackages([
|
|
1403
|
-
"@eslint-react/eslint-plugin",
|
|
1404
|
-
"eslint-plugin-react-hooks",
|
|
1405
|
-
"eslint-plugin-react-refresh"
|
|
1406
|
-
]);
|
|
1407
|
+
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides = {}, tsconfigPath } = options;
|
|
1408
|
+
await ensurePackages(["@eslint-react/eslint-plugin", "eslint-plugin-react-refresh"]);
|
|
1407
1409
|
const isTypeAware = !!tsconfigPath;
|
|
1408
|
-
const typeAwareRules = {
|
|
1409
|
-
|
|
1410
|
-
"react/no-implicit-key": "error"
|
|
1411
|
-
};
|
|
1412
|
-
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
|
|
1413
|
-
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
1414
|
-
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1415
|
-
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1416
|
-
]);
|
|
1410
|
+
const typeAwareRules = { "react/no-leaked-conditional-rendering": "error" };
|
|
1411
|
+
const [pluginReact, pluginReactRefresh] = await Promise.all([interopDefault(import("@eslint-react/eslint-plugin")), interopDefault(import("eslint-plugin-react-refresh"))]);
|
|
1417
1412
|
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists(i));
|
|
1418
1413
|
const isUsingRemix = RemixPackages.some((i) => isPackageExists(i));
|
|
1419
1414
|
const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
|
|
@@ -1425,8 +1420,6 @@ async function react(options = {}) {
|
|
|
1425
1420
|
plugins: {
|
|
1426
1421
|
react: plugins["@eslint-react"],
|
|
1427
1422
|
"react-dom": plugins["@eslint-react/dom"],
|
|
1428
|
-
"react-hooks": pluginReactHooks,
|
|
1429
|
-
"react-hooks-extra": plugins["@eslint-react/hooks-extra"],
|
|
1430
1423
|
"react-naming-convention": plugins["@eslint-react/naming-convention"],
|
|
1431
1424
|
"react-refresh": pluginReactRefresh,
|
|
1432
1425
|
"react-rsc": plugins["@eslint-react/rsc"],
|
|
@@ -1441,85 +1434,8 @@ async function react(options = {}) {
|
|
|
1441
1434
|
},
|
|
1442
1435
|
name: "antfu/react/rules",
|
|
1443
1436
|
rules: {
|
|
1444
|
-
|
|
1445
|
-
"react/jsx-no-comment-textnodes": "warn",
|
|
1446
|
-
"react/jsx-no-duplicate-props": "warn",
|
|
1447
|
-
"react/jsx-uses-react": "warn",
|
|
1448
|
-
"react/jsx-uses-vars": "warn",
|
|
1449
|
-
"react/no-access-state-in-setstate": "error",
|
|
1450
|
-
"react/no-array-index-key": "warn",
|
|
1451
|
-
"react/no-children-count": "warn",
|
|
1452
|
-
"react/no-children-for-each": "warn",
|
|
1453
|
-
"react/no-children-map": "warn",
|
|
1454
|
-
"react/no-children-only": "warn",
|
|
1455
|
-
"react/no-children-to-array": "warn",
|
|
1456
|
-
"react/no-clone-element": "warn",
|
|
1457
|
-
"react/no-component-will-mount": "error",
|
|
1458
|
-
"react/no-component-will-receive-props": "error",
|
|
1459
|
-
"react/no-component-will-update": "error",
|
|
1460
|
-
"react/no-context-provider": "warn",
|
|
1461
|
-
"react/no-create-ref": "error",
|
|
1462
|
-
"react/no-default-props": "error",
|
|
1463
|
-
"react/no-direct-mutation-state": "error",
|
|
1464
|
-
"react/no-forward-ref": "warn",
|
|
1465
|
-
"react/no-missing-key": "error",
|
|
1466
|
-
"react/no-nested-component-definitions": "error",
|
|
1467
|
-
"react/no-nested-lazy-component-declarations": "error",
|
|
1468
|
-
"react/no-prop-types": "error",
|
|
1469
|
-
"react/no-redundant-should-component-update": "error",
|
|
1470
|
-
"react/no-set-state-in-component-did-mount": "warn",
|
|
1471
|
-
"react/no-set-state-in-component-did-update": "warn",
|
|
1472
|
-
"react/no-set-state-in-component-will-update": "warn",
|
|
1473
|
-
"react/no-string-refs": "error",
|
|
1474
|
-
"react/no-unnecessary-use-prefix": "warn",
|
|
1475
|
-
"react/no-unsafe-component-will-mount": "warn",
|
|
1476
|
-
"react/no-unsafe-component-will-receive-props": "warn",
|
|
1477
|
-
"react/no-unsafe-component-will-update": "warn",
|
|
1478
|
-
"react/no-unused-class-component-members": "warn",
|
|
1479
|
-
"react/no-use-context": "warn",
|
|
1480
|
-
"react/no-useless-forward-ref": "warn",
|
|
1481
|
-
"react/prefer-use-state-lazy-initialization": "warn",
|
|
1437
|
+
...pluginReact.configs.recommended.rules,
|
|
1482
1438
|
"react/prefer-namespace-import": "error",
|
|
1483
|
-
"react-rsc/function-definition": "error",
|
|
1484
|
-
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
1485
|
-
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
1486
|
-
"react-dom/no-find-dom-node": "error",
|
|
1487
|
-
"react-dom/no-flush-sync": "error",
|
|
1488
|
-
"react-dom/no-hydrate": "error",
|
|
1489
|
-
"react-dom/no-namespace": "error",
|
|
1490
|
-
"react-dom/no-render": "error",
|
|
1491
|
-
"react-dom/no-render-return-value": "error",
|
|
1492
|
-
"react-dom/no-script-url": "warn",
|
|
1493
|
-
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
1494
|
-
"react-dom/no-use-form-state": "error",
|
|
1495
|
-
"react-dom/no-void-elements-with-children": "error",
|
|
1496
|
-
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
1497
|
-
"react-naming-convention/context-name": "warn",
|
|
1498
|
-
"react-naming-convention/ref-name": "warn",
|
|
1499
|
-
"react-naming-convention/use-state": "warn",
|
|
1500
|
-
"react-web-api/no-leaked-event-listener": "warn",
|
|
1501
|
-
"react-web-api/no-leaked-interval": "warn",
|
|
1502
|
-
"react-web-api/no-leaked-resize-observer": "warn",
|
|
1503
|
-
"react-web-api/no-leaked-timeout": "warn",
|
|
1504
|
-
"react-hooks/rules-of-hooks": "error",
|
|
1505
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
1506
|
-
...reactCompiler ? {
|
|
1507
|
-
"react-hooks/config": "error",
|
|
1508
|
-
"react-hooks/error-boundaries": "error",
|
|
1509
|
-
"react-hooks/component-hook-factories": "error",
|
|
1510
|
-
"react-hooks/gating": "error",
|
|
1511
|
-
"react-hooks/globals": "error",
|
|
1512
|
-
"react-hooks/immutability": "error",
|
|
1513
|
-
"react-hooks/preserve-manual-memoization": "error",
|
|
1514
|
-
"react-hooks/purity": "error",
|
|
1515
|
-
"react-hooks/refs": "error",
|
|
1516
|
-
"react-hooks/set-state-in-effect": "error",
|
|
1517
|
-
"react-hooks/set-state-in-render": "error",
|
|
1518
|
-
"react-hooks/static-components": "error",
|
|
1519
|
-
"react-hooks/unsupported-syntax": "warn",
|
|
1520
|
-
"react-hooks/use-memo": "error",
|
|
1521
|
-
"react-hooks/incompatible-library": "warn"
|
|
1522
|
-
} : {},
|
|
1523
1439
|
"react-refresh/only-export-components": ["error", {
|
|
1524
1440
|
allowConstantExport: isAllowConstantExport,
|
|
1525
1441
|
allowExportNames: [...isUsingNext ? [
|
|
@@ -1557,11 +1473,7 @@ async function react(options = {}) {
|
|
|
1557
1473
|
name: "antfu/react/typescript",
|
|
1558
1474
|
rules: {
|
|
1559
1475
|
"react-dom/no-string-style-prop": "off",
|
|
1560
|
-
"react-dom/no-unknown-property": "off"
|
|
1561
|
-
"react/jsx-no-duplicate-props": "off",
|
|
1562
|
-
"react/jsx-no-undef": "off",
|
|
1563
|
-
"react/jsx-uses-react": "off",
|
|
1564
|
-
"react/jsx-uses-vars": "off"
|
|
1476
|
+
"react-dom/no-unknown-property": "off"
|
|
1565
1477
|
}
|
|
1566
1478
|
},
|
|
1567
1479
|
...isTypeAware ? [{
|
|
@@ -1902,25 +1814,10 @@ async function svelte(options = {}) {
|
|
|
1902
1814
|
vars: "all",
|
|
1903
1815
|
varsIgnorePattern: "^(\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
|
|
1904
1816
|
}],
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
"svelte/no-dupe-style-properties": "error",
|
|
1910
|
-
"svelte/no-dupe-use-directives": "error",
|
|
1911
|
-
"svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
|
|
1912
|
-
"svelte/no-inner-declarations": "error",
|
|
1913
|
-
"svelte/no-not-function-handler": "error",
|
|
1914
|
-
"svelte/no-object-in-text-mustaches": "error",
|
|
1915
|
-
"svelte/no-reactive-functions": "error",
|
|
1916
|
-
"svelte/no-reactive-literals": "error",
|
|
1917
|
-
"svelte/no-shorthand-style-property-overrides": "error",
|
|
1918
|
-
"svelte/no-unknown-style-directive-property": "error",
|
|
1919
|
-
"svelte/no-unused-svelte-ignore": "error",
|
|
1920
|
-
"svelte/no-useless-mustaches": "error",
|
|
1921
|
-
"svelte/require-store-callbacks-use-set-param": "error",
|
|
1922
|
-
"svelte/system": "error",
|
|
1923
|
-
"svelte/valid-each-key": "error",
|
|
1817
|
+
...pluginSvelte.configs.recommended.map((config) => config.rules).reduce((acc, rules) => ({
|
|
1818
|
+
...acc,
|
|
1819
|
+
...rules
|
|
1820
|
+
}), {}),
|
|
1924
1821
|
"unused-imports/no-unused-vars": ["error", {
|
|
1925
1822
|
args: "after-used",
|
|
1926
1823
|
argsIgnorePattern: "^_",
|
|
@@ -2158,7 +2055,7 @@ async function typescript(options = {}) {
|
|
|
2158
2055
|
}] : [],
|
|
2159
2056
|
...erasableOnly ? [{
|
|
2160
2057
|
name: "antfu/typescript/erasable-syntax-only",
|
|
2161
|
-
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-
|
|
2058
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-zvCEClb6.mjs")) },
|
|
2162
2059
|
rules: {
|
|
2163
2060
|
"erasable-syntax-only/enums": "error",
|
|
2164
2061
|
"erasable-syntax-only/import-aliases": "error",
|
|
@@ -2480,6 +2377,13 @@ async function e18e(options = {}) {
|
|
|
2480
2377
|
...modernization ? { ...configs.modernization.rules } : {},
|
|
2481
2378
|
...moduleReplacements ? { ...configs.moduleReplacements.rules } : {},
|
|
2482
2379
|
...performanceImprovements ? { ...configs.performanceImprovements.rules } : {},
|
|
2380
|
+
...type === "lib" ? {} : { "e18e/prefer-static-regex": "off" },
|
|
2381
|
+
"e18e/prefer-array-at": "off",
|
|
2382
|
+
"e18e/prefer-array-from-map": "off",
|
|
2383
|
+
"e18e/prefer-array-to-reversed": "off",
|
|
2384
|
+
"e18e/prefer-array-to-sorted": "off",
|
|
2385
|
+
"e18e/prefer-array-to-spliced": "off",
|
|
2386
|
+
"e18e/prefer-spread-syntax": "off",
|
|
2483
2387
|
...overrides
|
|
2484
2388
|
}
|
|
2485
2389
|
}];
|
|
@@ -2504,8 +2408,9 @@ const VuePackages = [
|
|
|
2504
2408
|
const defaultPluginRenaming = {
|
|
2505
2409
|
"@eslint-react": "react",
|
|
2506
2410
|
"@eslint-react/dom": "react-dom",
|
|
2507
|
-
"@eslint-react/hooks-extra": "react-hooks-extra",
|
|
2508
2411
|
"@eslint-react/naming-convention": "react-naming-convention",
|
|
2412
|
+
"@eslint-react/rsc": "react-rsc",
|
|
2413
|
+
"@eslint-react/web-api": "react-web-api",
|
|
2509
2414
|
"@next/next": "next",
|
|
2510
2415
|
"@stylistic": "style",
|
|
2511
2416
|
"@typescript-eslint": "ts",
|
|
@@ -2677,7 +2582,7 @@ const CONFIG_PRESET_FULL_ON = {
|
|
|
2677
2582
|
nextjs: true,
|
|
2678
2583
|
node: true,
|
|
2679
2584
|
pnpm: true,
|
|
2680
|
-
react:
|
|
2585
|
+
react: true,
|
|
2681
2586
|
regexp: true,
|
|
2682
2587
|
solid: true,
|
|
2683
2588
|
stylistic: { experimental: true },
|