@luxass/eslint-config 4.17.1 → 4.18.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.cjs CHANGED
@@ -82,6 +82,7 @@ __export(index_exports, {
82
82
  node: () => node,
83
83
  parserPlain: () => parserPlain,
84
84
  perfectionist: () => perfectionist,
85
+ pnpm: () => pnpm,
85
86
  react: () => react,
86
87
  regexp: () => regexp,
87
88
  renamePluginInConfigs: () => renamePluginInConfigs,
@@ -1277,6 +1278,53 @@ async function perfectionist() {
1277
1278
  ];
1278
1279
  }
1279
1280
 
1281
+ // src/configs/pnpm.ts
1282
+ async function pnpm() {
1283
+ const [
1284
+ pluginPnpm,
1285
+ yamlParser,
1286
+ jsoncParser
1287
+ ] = await Promise.all([
1288
+ interop(import("eslint-plugin-pnpm")),
1289
+ interop(import("yaml-eslint-parser")),
1290
+ interop(import("jsonc-eslint-parser"))
1291
+ ]);
1292
+ return [
1293
+ {
1294
+ files: [
1295
+ "package.json",
1296
+ "**/package.json"
1297
+ ],
1298
+ languageOptions: {
1299
+ parser: jsoncParser
1300
+ },
1301
+ name: "luxass/pnpm/package-json",
1302
+ plugins: {
1303
+ pnpm: pluginPnpm
1304
+ },
1305
+ rules: {
1306
+ "pnpm/json-enforce-catalog": "error",
1307
+ "pnpm/json-prefer-workspace-settings": "error",
1308
+ "pnpm/json-valid-catalog": "error"
1309
+ }
1310
+ },
1311
+ {
1312
+ files: ["pnpm-workspace.yaml"],
1313
+ languageOptions: {
1314
+ parser: yamlParser
1315
+ },
1316
+ name: "luxass/pnpm/pnpm-workspace-yaml",
1317
+ plugins: {
1318
+ pnpm: pluginPnpm
1319
+ },
1320
+ rules: {
1321
+ "pnpm/yaml-no-duplicate-catalog-item": "error",
1322
+ "pnpm/yaml-no-unused-catalog-item": "error"
1323
+ }
1324
+ }
1325
+ ];
1326
+ }
1327
+
1280
1328
  // src/configs/react.ts
1281
1329
  var import_local_pkg2 = require("local-pkg");
1282
1330
  var ReactRefreshAllowConstantExportPackages = [
@@ -1356,22 +1404,30 @@ async function react(options = {}) {
1356
1404
  },
1357
1405
  name: "luxass/react/rules",
1358
1406
  rules: {
1359
- // recommended rules from @eslint-react/dom
1360
- "react-dom/no-children-in-void-dom-elements": "warn",
1407
+ // recommended rules from eslint-plugin-react-dom https://eslint-react.xyz/docs/rules/overview#dom-rules
1361
1408
  "react-dom/no-dangerously-set-innerhtml": "warn",
1362
1409
  "react-dom/no-dangerously-set-innerhtml-with-children": "error",
1363
1410
  "react-dom/no-find-dom-node": "error",
1411
+ "react-dom/no-flush-sync": "error",
1412
+ "react-dom/no-hydrate": "error",
1364
1413
  "react-dom/no-missing-button-type": "warn",
1365
1414
  "react-dom/no-missing-iframe-sandbox": "warn",
1366
1415
  "react-dom/no-namespace": "error",
1416
+ "react-dom/no-render": "error",
1367
1417
  "react-dom/no-render-return-value": "error",
1368
1418
  "react-dom/no-script-url": "warn",
1369
1419
  "react-dom/no-unsafe-iframe-sandbox": "warn",
1370
1420
  "react-dom/no-unsafe-target-blank": "warn",
1371
- // recommended rules react-hooks
1421
+ "react-dom/no-use-form-state": "error",
1422
+ "react-dom/no-void-elements-with-children": "error",
1423
+ // recommended rules from eslint-plugin-react-hooks-extra https://eslint-react.xyz/docs/rules/overview#hooks-extra-rules
1424
+ "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
1425
+ "react-hooks-extra/no-unnecessary-use-prefix": "warn",
1426
+ "react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
1427
+ // recommended rules eslint-plugin-react-hooks https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks/src/rules
1372
1428
  "react-hooks/exhaustive-deps": "warn",
1373
1429
  "react-hooks/rules-of-hooks": "error",
1374
- // react refresh
1430
+ // preconfigured rules from eslint-plugin-react-refresh https://github.com/ArnaudBarre/eslint-plugin-react-refresh/tree/main/src
1375
1431
  "react-refresh/only-export-components": [
1376
1432
  "warn",
1377
1433
  {
@@ -1386,7 +1442,6 @@ async function react(options = {}) {
1386
1442
  "preferredRegion",
1387
1443
  "maxDuration",
1388
1444
  "config",
1389
- "runtime",
1390
1445
  "generateStaticParams",
1391
1446
  "metadata",
1392
1447
  "generateMetadata",
@@ -1403,13 +1458,12 @@ async function react(options = {}) {
1403
1458
  ]
1404
1459
  }
1405
1460
  ],
1406
- // recommended rules from @eslint-react/web-api
1461
+ // recommended rules from eslint-plugin-react-web-api https://eslint-react.xyz/docs/rules/overview#web-api-rules
1407
1462
  "react-web-api/no-leaked-event-listener": "warn",
1408
1463
  "react-web-api/no-leaked-interval": "warn",
1409
1464
  "react-web-api/no-leaked-resize-observer": "warn",
1410
1465
  "react-web-api/no-leaked-timeout": "warn",
1411
- // recommended rules from @eslint-react
1412
- "react/ensure-forward-ref-using-ref": "warn",
1466
+ // recommended rules from eslint-plugin-react-x https://eslint-react.xyz/docs/rules/overview#core-rules
1413
1467
  "react/jsx-no-duplicate-props": "warn",
1414
1468
  "react/jsx-uses-vars": "warn",
1415
1469
  "react/no-access-state-in-setstate": "error",
@@ -1428,11 +1482,11 @@ async function react(options = {}) {
1428
1482
  "react/no-create-ref": "error",
1429
1483
  "react/no-default-props": "error",
1430
1484
  "react/no-direct-mutation-state": "error",
1431
- "react/no-duplicate-key": "error",
1485
+ "react/no-duplicate-key": "warn",
1432
1486
  "react/no-forward-ref": "warn",
1433
1487
  "react/no-implicit-key": "warn",
1434
1488
  "react/no-missing-key": "error",
1435
- "react/no-nested-components": "error",
1489
+ "react/no-nested-component-definitions": "error",
1436
1490
  "react/no-prop-types": "error",
1437
1491
  "react/no-redundant-should-component-update": "error",
1438
1492
  "react/no-set-state-in-component-did-mount": "warn",
@@ -1446,9 +1500,8 @@ async function react(options = {}) {
1446
1500
  "react/no-unstable-default-props": "warn",
1447
1501
  "react/no-unused-class-component-members": "warn",
1448
1502
  "react/no-unused-state": "warn",
1449
- "react/prefer-destructuring-assignment": "warn",
1450
- "react/prefer-shorthand-boolean": "warn",
1451
- "react/prefer-shorthand-fragment": "warn",
1503
+ "react/no-use-context": "warn",
1504
+ "react/no-useless-forward-ref": "warn",
1452
1505
  // overrides
1453
1506
  ...overrides
1454
1507
  }
@@ -1456,7 +1509,7 @@ async function react(options = {}) {
1456
1509
  ...isTypeAware ? [{
1457
1510
  files: filesTypeAware,
1458
1511
  ignores: ignoresTypeAware,
1459
- name: "antfu/react/type-aware-rules",
1512
+ name: "luxass/react/type-aware-rules",
1460
1513
  rules: {
1461
1514
  ...typeAwareRules
1462
1515
  }
@@ -1633,6 +1686,7 @@ function sortTsconfig() {
1633
1686
  "useDefineForClassFields",
1634
1687
  "emitDecoratorMetadata",
1635
1688
  "experimentalDecorators",
1689
+ "libReplacement",
1636
1690
  /* Modules */
1637
1691
  "baseUrl",
1638
1692
  "rootDir",
@@ -1707,6 +1761,7 @@ function sortTsconfig() {
1707
1761
  "isolatedModules",
1708
1762
  "preserveSymlinks",
1709
1763
  "verbatimModuleSyntax",
1764
+ "erasableSyntaxOnly",
1710
1765
  /* Completeness */
1711
1766
  "skipDefaultLibCheck",
1712
1767
  "skipLibCheck"
@@ -2473,6 +2528,7 @@ function luxass(options = {}, ...userConfigs) {
2473
2528
  exts = [],
2474
2529
  gitignore: enableGitignore = true,
2475
2530
  jsx: enableJsx = true,
2531
+ pnpm: enableCatalogs = false,
2476
2532
  react: enableReact = false,
2477
2533
  regexp: enableRegexp = true,
2478
2534
  tailwindcss: enableTailwindCSS = false,
@@ -2607,6 +2663,11 @@ function luxass(options = {}, ...userConfigs) {
2607
2663
  sortTsconfig()
2608
2664
  );
2609
2665
  }
2666
+ if (enableCatalogs) {
2667
+ configs2.push(
2668
+ pnpm()
2669
+ );
2670
+ }
2610
2671
  if (options.yaml ?? true) {
2611
2672
  configs2.push(yaml({
2612
2673
  overrides: getOverrides(options, "yaml"),
@@ -2714,6 +2775,7 @@ var index_default = luxass;
2714
2775
  node,
2715
2776
  parserPlain,
2716
2777
  perfectionist,
2778
+ pnpm,
2717
2779
  react,
2718
2780
  regexp,
2719
2781
  renamePluginInConfigs,