@luxass/eslint-config 4.14.0 → 4.16.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.js CHANGED
@@ -224,7 +224,6 @@ async function astro(options = {}) {
224
224
  }
225
225
  },
226
226
  {
227
- name: "luxass/astro/rules",
228
227
  files,
229
228
  languageOptions: {
230
229
  globals: pluginAstro.environments.astro.globals,
@@ -235,8 +234,12 @@ async function astro(options = {}) {
235
234
  },
236
235
  sourceType: "module"
237
236
  },
237
+ name: "luxass/astro/rules",
238
238
  processor: "astro/client-side-ts",
239
239
  rules: {
240
+ // Astro uses top level await for e.g. data fetching
241
+ // https://docs.astro.build/en/guides/data-fetching/#fetch-in-astro
242
+ "antfu/no-top-level-await": "off",
240
243
  // use recommended rules
241
244
  "astro/missing-client-only-directive-value": "error",
242
245
  "astro/no-conflict-set-directives": "error",
@@ -329,8 +332,8 @@ async function disables() {
329
332
  }
330
333
  },
331
334
  {
332
- name: "luxass/disables/github-actions",
333
335
  files: ["**/.github/workflows/*.{yml,yaml}"],
336
+ name: "luxass/disables/github-actions",
334
337
  rules: {
335
338
  // GitHub Actions supports empty values to enable features
336
339
  "yaml/no-empty-mapping-value": "off"
@@ -369,7 +372,6 @@ async function stylistic(options = {}) {
369
372
  };
370
373
  const pluginStylistic = await interop(import("@stylistic/eslint-plugin"));
371
374
  const config = pluginStylistic.configs.customize({
372
- flat: true,
373
375
  indent,
374
376
  jsx: jsx2,
375
377
  pluginName: "style",
@@ -391,6 +393,8 @@ async function stylistic(options = {}) {
391
393
  "curly": ["error", "multi-line", "consistent"],
392
394
  "style/arrow-parens": ["error", "always", { requireForBlockBody: true }],
393
395
  "style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
396
+ "style/generator-star-spacing": ["error", { after: true, before: false }],
397
+ "style/yield-star-spacing": ["error", { after: true, before: false }],
394
398
  ...overrides
395
399
  }
396
400
  }
@@ -462,11 +466,11 @@ async function formatters(options = {}, stylistic2 = {}) {
462
466
  if (options.css) {
463
467
  configs2.push(
464
468
  {
465
- name: "luxass/formatter/css",
466
469
  files: [GLOB_CSS, GLOB_POSTCSS],
467
470
  languageOptions: {
468
471
  parser: parserPlain
469
472
  },
473
+ name: "luxass/formatter/css",
470
474
  rules: {
471
475
  "format/prettier": [
472
476
  "error",
@@ -477,11 +481,11 @@ async function formatters(options = {}, stylistic2 = {}) {
477
481
  }
478
482
  },
479
483
  {
480
- name: "luxass/formatter/scss",
481
484
  files: [GLOB_SCSS],
482
485
  languageOptions: {
483
486
  parser: parserPlain
484
487
  },
488
+ name: "luxass/formatter/scss",
485
489
  rules: {
486
490
  "format/prettier": [
487
491
  "error",
@@ -492,11 +496,11 @@ async function formatters(options = {}, stylistic2 = {}) {
492
496
  }
493
497
  },
494
498
  {
495
- name: "luxass/formatter/less",
496
499
  files: [GLOB_LESS],
497
500
  languageOptions: {
498
501
  parser: parserPlain
499
502
  },
503
+ name: "luxass/formatter/less",
500
504
  rules: {
501
505
  "format/prettier": [
502
506
  "error",
@@ -510,11 +514,11 @@ async function formatters(options = {}, stylistic2 = {}) {
510
514
  }
511
515
  if (options.html) {
512
516
  configs2.push({
513
- name: "luxass/formatter/html",
514
517
  files: [GLOB_HTML],
515
518
  languageOptions: {
516
519
  parser: parserPlain
517
520
  },
521
+ name: "luxass/formatter/html",
518
522
  rules: {
519
523
  "format/prettier": [
520
524
  "error",
@@ -526,17 +530,17 @@ async function formatters(options = {}, stylistic2 = {}) {
526
530
  });
527
531
  }
528
532
  if (options.markdown) {
529
- const formater = options.markdown === true ? "prettier" : options.markdown;
533
+ const formatter = options.markdown === true ? "prettier" : options.markdown;
530
534
  configs2.push({
531
- name: "luxass/formatter/markdown",
532
535
  files: [GLOB_MARKDOWN],
533
536
  languageOptions: {
534
537
  parser: parserPlain
535
538
  },
539
+ name: "luxass/formatter/markdown",
536
540
  rules: {
537
- [`format/${formater}`]: [
541
+ [`format/${formatter}`]: [
538
542
  "error",
539
- formater === "prettier" ? mergePrettierOptions(prettierOptions, {
543
+ formatter === "prettier" ? mergePrettierOptions(prettierOptions, {
540
544
  embeddedLanguageFormatting: "off",
541
545
  parser: "markdown"
542
546
  }) : {
@@ -549,11 +553,11 @@ async function formatters(options = {}, stylistic2 = {}) {
549
553
  }
550
554
  if (options.astro) {
551
555
  configs2.push({
552
- name: "luxass/formatter/astro",
553
556
  files: [GLOB_ASTRO],
554
557
  languageOptions: {
555
558
  parser: parserPlain
556
559
  },
560
+ name: "luxass/formatter/astro",
557
561
  rules: {
558
562
  "format/prettier": [
559
563
  "error",
@@ -569,11 +573,11 @@ async function formatters(options = {}, stylistic2 = {}) {
569
573
  }
570
574
  if (options.graphql) {
571
575
  configs2.push({
572
- name: "luxass/formatter/graphql",
573
576
  files: [GLOB_GRAPHQL],
574
577
  languageOptions: {
575
578
  parser: parserPlain
576
579
  },
580
+ name: "luxass/formatter/graphql",
577
581
  rules: {
578
582
  "format/prettier": [
579
583
  "error",
@@ -618,6 +622,7 @@ async function imports(options = {}) {
618
622
  "antfu/import-dedupe": "error",
619
623
  "antfu/no-import-dist": "error",
620
624
  "antfu/no-import-node-modules-by-path": "error",
625
+ "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
621
626
  "import/first": "error",
622
627
  "import/no-duplicates": "error",
623
628
  "import/no-mutable-exports": "error",
@@ -643,7 +648,6 @@ async function javascript(options = {}) {
643
648
  } = options;
644
649
  return [
645
650
  {
646
- name: "luxass/javascript/setup",
647
651
  languageOptions: {
648
652
  ecmaVersion: 2022,
649
653
  globals: {
@@ -665,7 +669,8 @@ async function javascript(options = {}) {
665
669
  },
666
670
  linterOptions: {
667
671
  reportUnusedDisableDirectives: true
668
- }
672
+ },
673
+ name: "luxass/javascript/setup"
669
674
  },
670
675
  {
671
676
  name: "luxass/javascript/rules",
@@ -741,8 +746,8 @@ async function javascript(options = {}) {
741
746
  "no-regex-spaces": "error",
742
747
  "no-restricted-globals": [
743
748
  "error",
744
- { name: "global", message: "Use `globalThis` instead." },
745
- { name: "self", message: "Use `globalThis` instead." }
749
+ { message: "Use `globalThis` instead.", name: "global" },
750
+ { message: "Use `globalThis` instead.", name: "self" }
746
751
  ],
747
752
  "no-restricted-properties": [
748
753
  "error",
@@ -874,12 +879,12 @@ async function javascript(options = {}) {
874
879
  }
875
880
  },
876
881
  {
877
- name: "luxass/disables/cli",
878
882
  files: [
879
883
  `scripts/${GLOB_SRC}`,
880
884
  `cli.${GLOB_SRC_EXT}`,
881
885
  `**/playground.${GLOB_SRC_EXT}`
882
886
  ],
887
+ name: "luxass/disables/cli",
883
888
  rules: {
884
889
  "no-console": "off"
885
890
  }
@@ -950,11 +955,11 @@ async function jsonc(options = {}) {
950
955
  }
951
956
  },
952
957
  {
953
- name: "luxass/jsonc/rules",
954
958
  files,
955
959
  languageOptions: {
956
960
  parser: parserJsonc
957
961
  },
962
+ name: "luxass/jsonc/rules",
958
963
  rules: {
959
964
  "jsonc/no-bigint-literals": "error",
960
965
  "jsonc/no-binary-expression": "error",
@@ -1013,7 +1018,6 @@ async function jsonc(options = {}) {
1013
1018
  async function jsx() {
1014
1019
  return [
1015
1020
  {
1016
- name: "luxass/jsx/setup",
1017
1021
  files: [GLOB_JSX, GLOB_TSX],
1018
1022
  languageOptions: {
1019
1023
  parserOptions: {
@@ -1021,7 +1025,8 @@ async function jsx() {
1021
1025
  jsx: true
1022
1026
  }
1023
1027
  }
1024
- }
1028
+ },
1029
+ name: "luxass/jsx/setup"
1025
1030
  }
1026
1031
  ];
1027
1032
  }
@@ -1043,9 +1048,9 @@ async function markdown(options = {}) {
1043
1048
  }
1044
1049
  },
1045
1050
  {
1046
- name: "luxass/markdown/processor",
1047
1051
  files,
1048
1052
  ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
1053
+ name: "luxass/markdown/processor",
1049
1054
  // `eslint-plugin-markdown` only creates virtual files for code blocks,
1050
1055
  // but not the markdown file itself. We use `eslint-merge-processors` to
1051
1056
  // add a pass-through processor for the markdown file itself.
@@ -1055,14 +1060,13 @@ async function markdown(options = {}) {
1055
1060
  ])
1056
1061
  },
1057
1062
  {
1058
- name: "luxass/markdown/parser",
1059
1063
  files,
1060
1064
  languageOptions: {
1061
1065
  parser: parserPlain
1062
- }
1066
+ },
1067
+ name: "luxass/markdown/parser"
1063
1068
  },
1064
1069
  {
1065
- name: "luxass/markdown/disables",
1066
1070
  files: [
1067
1071
  GLOB_MARKDOWN_CODE,
1068
1072
  ...exts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
@@ -1074,6 +1078,7 @@ async function markdown(options = {}) {
1074
1078
  }
1075
1079
  }
1076
1080
  },
1081
+ name: "luxass/markdown/disables",
1077
1082
  rules: {
1078
1083
  "antfu/no-top-level-await": "off",
1079
1084
  "import/newline-after-import": "off",
@@ -1144,10 +1149,10 @@ async function perfectionist() {
1144
1149
  "perfectionist/sort-imports": ["error", {
1145
1150
  groups: [
1146
1151
  "type",
1147
- ["parent-type", "sibling-type", "index-type"],
1152
+ ["parent-type", "sibling-type", "index-type", "internal-type"],
1148
1153
  "builtin",
1149
1154
  "external",
1150
- ["internal", "internal-type"],
1155
+ "internal",
1151
1156
  ["parent", "sibling", "index"],
1152
1157
  "side-effect",
1153
1158
  "object",
@@ -1175,18 +1180,24 @@ var RemixPackages = [
1175
1180
  "@remix-run/serve",
1176
1181
  "@remix-run/dev"
1177
1182
  ];
1183
+ var ReactRouterPackages = [
1184
+ "@react-router/node",
1185
+ "@react-router/react",
1186
+ "@react-router/serve",
1187
+ "@react-router/dev"
1188
+ ];
1178
1189
  var NextJsPackages = [
1179
1190
  "next"
1180
1191
  ];
1181
1192
  async function react(options = {}) {
1182
1193
  const {
1183
1194
  files = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
1184
- overrides = {},
1185
1195
  filesTypeAware = [GLOB_TS, GLOB_TSX],
1186
1196
  ignoresTypeAware = [
1187
1197
  `${GLOB_MARKDOWN}/**`,
1188
1198
  GLOB_ASTRO_TS
1189
1199
  ],
1200
+ overrides = {},
1190
1201
  tsconfigPath
1191
1202
  } = options;
1192
1203
  await ensure([
@@ -1209,6 +1220,7 @@ async function react(options = {}) {
1209
1220
  ]);
1210
1221
  const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists2(i));
1211
1222
  const isUsingRemix = RemixPackages.some((i) => isPackageExists2(i));
1223
+ const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists2(i));
1212
1224
  const isUsingNext = NextJsPackages.some((i) => isPackageExists2(i));
1213
1225
  const plugins = pluginReact.configs.all.plugins;
1214
1226
  return [
@@ -1220,11 +1232,11 @@ async function react(options = {}) {
1220
1232
  "react-hooks": pluginReactHooks,
1221
1233
  "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1222
1234
  "react-naming-convention": plugins["@eslint-react/naming-convention"],
1223
- "react-refresh": pluginReactRefresh
1235
+ "react-refresh": pluginReactRefresh,
1236
+ "react-web-api": plugins["@eslint-react/web-api"]
1224
1237
  }
1225
1238
  },
1226
1239
  {
1227
- name: "luxass/react/rules",
1228
1240
  files,
1229
1241
  languageOptions: {
1230
1242
  parserOptions: {
@@ -1234,6 +1246,7 @@ async function react(options = {}) {
1234
1246
  },
1235
1247
  sourceType: "module"
1236
1248
  },
1249
+ name: "luxass/react/rules",
1237
1250
  rules: {
1238
1251
  // recommended rules from @eslint-react/dom
1239
1252
  "react-dom/no-children-in-void-dom-elements": "warn",
@@ -1272,7 +1285,7 @@ async function react(options = {}) {
1272
1285
  "viewport",
1273
1286
  "generateViewport"
1274
1287
  ] : [],
1275
- ...isUsingRemix ? [
1288
+ ...isUsingRemix || isUsingReactRouter ? [
1276
1289
  "meta",
1277
1290
  "links",
1278
1291
  "headers",
@@ -1282,27 +1295,37 @@ async function react(options = {}) {
1282
1295
  ]
1283
1296
  }
1284
1297
  ],
1298
+ // recommended rules from @eslint-react/web-api
1299
+ "react-web-api/no-leaked-event-listener": "warn",
1300
+ "react-web-api/no-leaked-interval": "warn",
1301
+ "react-web-api/no-leaked-resize-observer": "warn",
1302
+ "react-web-api/no-leaked-timeout": "warn",
1285
1303
  // recommended rules from @eslint-react
1286
1304
  "react/ensure-forward-ref-using-ref": "warn",
1305
+ "react/jsx-no-duplicate-props": "warn",
1306
+ "react/jsx-uses-vars": "warn",
1287
1307
  "react/no-access-state-in-setstate": "error",
1288
1308
  "react/no-array-index-key": "warn",
1289
1309
  "react/no-children-count": "warn",
1290
1310
  "react/no-children-for-each": "warn",
1291
1311
  "react/no-children-map": "warn",
1292
1312
  "react/no-children-only": "warn",
1293
- "react/no-children-prop": "warn",
1294
1313
  "react/no-children-to-array": "warn",
1295
1314
  "react/no-clone-element": "warn",
1296
1315
  "react/no-comment-textnodes": "warn",
1297
1316
  "react/no-component-will-mount": "error",
1298
1317
  "react/no-component-will-receive-props": "error",
1299
1318
  "react/no-component-will-update": "error",
1319
+ "react/no-context-provider": "warn",
1300
1320
  "react/no-create-ref": "error",
1321
+ "react/no-default-props": "error",
1301
1322
  "react/no-direct-mutation-state": "error",
1302
1323
  "react/no-duplicate-key": "error",
1303
- "react/no-implicit-key": "error",
1324
+ "react/no-forward-ref": "warn",
1325
+ "react/no-implicit-key": "warn",
1304
1326
  "react/no-missing-key": "error",
1305
- "react/no-nested-components": "warn",
1327
+ "react/no-nested-components": "error",
1328
+ "react/no-prop-types": "error",
1306
1329
  "react/no-redundant-should-component-update": "error",
1307
1330
  "react/no-set-state-in-component-did-mount": "warn",
1308
1331
  "react/no-set-state-in-component-did-update": "warn",
@@ -1311,11 +1334,10 @@ async function react(options = {}) {
1311
1334
  "react/no-unsafe-component-will-mount": "warn",
1312
1335
  "react/no-unsafe-component-will-receive-props": "warn",
1313
1336
  "react/no-unsafe-component-will-update": "warn",
1314
- "react/no-unstable-context-value": "error",
1315
- "react/no-unstable-default-props": "error",
1337
+ "react/no-unstable-context-value": "warn",
1338
+ "react/no-unstable-default-props": "warn",
1316
1339
  "react/no-unused-class-component-members": "warn",
1317
1340
  "react/no-unused-state": "warn",
1318
- "react/no-useless-fragment": "warn",
1319
1341
  "react/prefer-destructuring-assignment": "warn",
1320
1342
  "react/prefer-shorthand-boolean": "warn",
1321
1343
  "react/prefer-shorthand-fragment": "warn",
@@ -1364,8 +1386,8 @@ async function regexp(options = {}) {
1364
1386
  function sortPackageJson() {
1365
1387
  return [
1366
1388
  {
1367
- name: "luxass/sort/package-json",
1368
1389
  files: ["**/package.json"],
1390
+ name: "luxass/sort/package-json",
1369
1391
  rules: {
1370
1392
  "jsonc/sort-array-values": [
1371
1393
  "error",
@@ -1465,8 +1487,8 @@ function sortPackageJson() {
1465
1487
  function sortTsconfig() {
1466
1488
  return [
1467
1489
  {
1468
- name: "luxass/sort/tsconfig",
1469
1490
  files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1491
+ name: "luxass/sort/tsconfig",
1470
1492
  rules: {
1471
1493
  "jsonc/sort-keys": [
1472
1494
  "error",
@@ -1592,8 +1614,8 @@ function sortTsconfig() {
1592
1614
  // src/configs/tailwindcss.ts
1593
1615
  async function tailwindcss(options = {}) {
1594
1616
  const {
1595
- overrides,
1596
- configPath
1617
+ configPath,
1618
+ overrides
1597
1619
  } = options;
1598
1620
  await ensure([
1599
1621
  "eslint-plugin-tailwindcss"
@@ -1605,7 +1627,6 @@ async function tailwindcss(options = {}) {
1605
1627
  ]);
1606
1628
  return [
1607
1629
  {
1608
- name: "luxass/tailwindcss",
1609
1630
  languageOptions: {
1610
1631
  parserOptions: {
1611
1632
  ecmaFeatures: {
@@ -1613,13 +1634,7 @@ async function tailwindcss(options = {}) {
1613
1634
  }
1614
1635
  }
1615
1636
  },
1616
- settings: {
1617
- ...configPath != null ? {
1618
- tailwindcss: {
1619
- config: configPath
1620
- }
1621
- } : {}
1622
- },
1637
+ name: "luxass/tailwindcss",
1623
1638
  plugins: {
1624
1639
  tailwindcss: pluginTailwindCSS
1625
1640
  },
@@ -1639,6 +1654,13 @@ async function tailwindcss(options = {}) {
1639
1654
  // https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-custom-classname.md
1640
1655
  "tailwindcss/no-custom-classname": "warn",
1641
1656
  ...overrides
1657
+ },
1658
+ settings: {
1659
+ ...configPath != null ? {
1660
+ tailwindcss: {
1661
+ config: configPath
1662
+ }
1663
+ } : {}
1642
1664
  }
1643
1665
  }
1644
1666
  ];
@@ -1648,8 +1670,8 @@ async function tailwindcss(options = {}) {
1648
1670
  var _pluginTest;
1649
1671
  async function test(options = {}) {
1650
1672
  const {
1651
- isInEditor = false,
1652
1673
  files = GLOB_TESTS,
1674
+ isInEditor = false,
1653
1675
  overrides = {}
1654
1676
  } = options;
1655
1677
  const [
@@ -1666,16 +1688,16 @@ async function test(options = {}) {
1666
1688
  }
1667
1689
  },
1668
1690
  {
1669
- name: "luxass/test/rules",
1670
1691
  files,
1692
+ name: "luxass/test/rules",
1671
1693
  rules: {
1672
1694
  "test/consistent-test-it": [
1673
1695
  "error",
1674
1696
  { fn: "it", withinDescribe: "it" }
1675
1697
  ],
1698
+ "test/no-focused-tests": isInEditor ? "off" : ["error", { fixable: true }],
1676
1699
  "test/no-identical-title": "error",
1677
1700
  "test/no-import-node-test": "error",
1678
- "test/no-focused-tests": isInEditor ? "off" : ["error", { fixable: true }],
1679
1701
  "test/prefer-hooks-in-order": "error",
1680
1702
  "test/prefer-lowercase-title": "error",
1681
1703
  // Disables
@@ -1716,11 +1738,11 @@ async function toml(options = {}) {
1716
1738
  }
1717
1739
  },
1718
1740
  {
1719
- name: "luxass/toml/rules",
1720
1741
  files,
1721
1742
  languageOptions: {
1722
1743
  parser: parserToml
1723
1744
  },
1745
+ name: "luxass/toml/rules",
1724
1746
  rules: {
1725
1747
  "style/spaced-comment": "off",
1726
1748
  "toml/comma-style": "error",
@@ -1757,8 +1779,8 @@ async function typescript(options = {}) {
1757
1779
  const {
1758
1780
  exts = [],
1759
1781
  overrides = {},
1760
- parserOptions = {},
1761
1782
  overridesTypeAware = {},
1783
+ parserOptions = {},
1762
1784
  type = "app"
1763
1785
  } = options ?? {};
1764
1786
  const files = options.files ?? [
@@ -1807,7 +1829,6 @@ async function typescript(options = {}) {
1807
1829
  return {
1808
1830
  files: files2,
1809
1831
  ...ignores2 ? { ignores: ignores2 } : {},
1810
- name: `luxass/typescript/${typeAware ? "type-aware-parser" : "parser"}`,
1811
1832
  languageOptions: {
1812
1833
  parser: parserTs,
1813
1834
  parserOptions: {
@@ -1822,7 +1843,8 @@ async function typescript(options = {}) {
1822
1843
  } : {},
1823
1844
  ...parserOptions
1824
1845
  }
1825
- }
1846
+ },
1847
+ name: `luxass/typescript/${typeAware ? "type-aware-parser" : "parser"}`
1826
1848
  };
1827
1849
  }
1828
1850
  return [
@@ -1839,8 +1861,8 @@ async function typescript(options = {}) {
1839
1861
  makeParser(false, files, filesTypeAware)
1840
1862
  ] : [makeParser(false, files)],
1841
1863
  {
1842
- name: "luxass/typescript/rules",
1843
1864
  files,
1865
+ name: "luxass/typescript/rules",
1844
1866
  rules: {
1845
1867
  ...renameRules(
1846
1868
  pluginTs.configs["eslint-recommended"].overrides[0].rules,
@@ -1863,14 +1885,18 @@ async function typescript(options = {}) {
1863
1885
  "ts/ban-ts-comment": [
1864
1886
  "error",
1865
1887
  {
1866
- "ts-ignore": "allow-with-description",
1867
- "ts-expect-error": "allow-with-description"
1888
+ "ts-expect-error": "allow-with-description",
1889
+ "ts-ignore": "allow-with-description"
1868
1890
  }
1869
1891
  ],
1870
1892
  "ts/consistent-type-definitions": ["error", "interface"],
1871
1893
  "ts/consistent-type-imports": [
1872
1894
  "error",
1873
- { disallowTypeAnnotations: false, prefer: "type-imports" }
1895
+ {
1896
+ disallowTypeAnnotations: false,
1897
+ fixStyle: "separate-type-imports",
1898
+ prefer: "type-imports"
1899
+ }
1874
1900
  ],
1875
1901
  "ts/method-signature-style": ["error", "property"],
1876
1902
  // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
@@ -1924,9 +1950,6 @@ async function typescript(options = {}) {
1924
1950
  // src/configs/unicorn.ts
1925
1951
  import pluginUnicorn from "eslint-plugin-unicorn";
1926
1952
  async function unicorn(options = {}) {
1927
- if (options.allRecommended && pluginUnicorn.configs == null) {
1928
- throw new Error("The `allRecommended` option requires `eslint-plugin-unicorn` to be installed.");
1929
- }
1930
1953
  return [
1931
1954
  {
1932
1955
  name: "luxass/unicorn/rules",
@@ -1934,7 +1957,7 @@ async function unicorn(options = {}) {
1934
1957
  unicorn: pluginUnicorn
1935
1958
  },
1936
1959
  rules: {
1937
- ...options.allRecommended ? pluginUnicorn.configs["flat/recommended"].rules : {
1960
+ ...options.allRecommended ? pluginUnicorn.configs.recommended.rules : {
1938
1961
  // Pass error message when throwing errors
1939
1962
  // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/error-message.md
1940
1963
  "unicorn/error-message": "error",
@@ -1942,8 +1965,8 @@ async function unicorn(options = {}) {
1942
1965
  // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/escape-case.md
1943
1966
  "unicorn/escape-case": "error",
1944
1967
  // Array.isArray instead of instanceof
1945
- // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-instanceof-array.md
1946
- "unicorn/no-instanceof-array": "error",
1968
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-instanceof-builtins.md
1969
+ "unicorn/no-instanceof-builtins": "error",
1947
1970
  // Ban `new Array` as `Array` constructor's params are ambiguous
1948
1971
  // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-array.md
1949
1972
  "unicorn/no-new-array": "error",
@@ -1984,9 +2007,9 @@ async function unicorn(options = {}) {
1984
2007
  async function unocss(options = {}) {
1985
2008
  const {
1986
2009
  attributify = true,
2010
+ configPath,
1987
2011
  overrides,
1988
- strict = false,
1989
- configPath
2012
+ strict = false
1990
2013
  } = options;
1991
2014
  await ensure([
1992
2015
  "@unocss/eslint-plugin"
@@ -2002,13 +2025,6 @@ async function unocss(options = {}) {
2002
2025
  plugins: {
2003
2026
  unocss: pluginUnoCSS
2004
2027
  },
2005
- settings: {
2006
- ...configPath != null ? {
2007
- unocss: {
2008
- configPath
2009
- }
2010
- } : {}
2011
- },
2012
2028
  rules: {
2013
2029
  "unocss/order": "warn",
2014
2030
  ...attributify ? {
@@ -2018,6 +2034,13 @@ async function unocss(options = {}) {
2018
2034
  "unocss/blocklist": "error"
2019
2035
  } : {},
2020
2036
  ...overrides
2037
+ },
2038
+ settings: {
2039
+ ...configPath != null ? {
2040
+ unocss: {
2041
+ configPath
2042
+ }
2043
+ } : {}
2021
2044
  }
2022
2045
  }
2023
2046
  ];
@@ -2046,7 +2069,6 @@ async function vue(options = {}) {
2046
2069
  } = typeof stylistic2 === "boolean" ? {} : stylistic2;
2047
2070
  return [
2048
2071
  {
2049
- name: "luxass/vue/setup",
2050
2072
  // This allows Vue plugin to work with auto imports
2051
2073
  // https://github.com/vuejs/eslint-plugin-vue/pull/2422
2052
2074
  languageOptions: {
@@ -2067,12 +2089,12 @@ async function vue(options = {}) {
2067
2089
  watchEffect: "readonly"
2068
2090
  }
2069
2091
  },
2092
+ name: "luxass/vue/setup",
2070
2093
  plugins: {
2071
2094
  vue: pluginVue
2072
2095
  }
2073
2096
  },
2074
2097
  {
2075
- name: "luxass/vue/rules",
2076
2098
  files,
2077
2099
  languageOptions: {
2078
2100
  parser: parserVue,
@@ -2085,6 +2107,7 @@ async function vue(options = {}) {
2085
2107
  sourceType: "module"
2086
2108
  }
2087
2109
  },
2110
+ name: "luxass/vue/rules",
2088
2111
  processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors2([
2089
2112
  pluginVue.processors[".vue"],
2090
2113
  processorVueBlocks({
@@ -2097,9 +2120,9 @@ async function vue(options = {}) {
2097
2120
  ]),
2098
2121
  rules: {
2099
2122
  ...pluginVue.configs.base.rules,
2100
- ...pluginVue.configs["vue3-essential"].rules,
2101
- ...pluginVue.configs["vue3-strongly-recommended"].rules,
2102
- ...pluginVue.configs["vue3-recommended"].rules,
2123
+ ...pluginVue.configs["flat/essential"].map((c) => c.rules).reduce((acc, c) => ({ ...acc, ...c }), {}),
2124
+ ...pluginVue.configs["flat/strongly-recommended"].map((c) => c.rules).reduce((acc, c) => ({ ...acc, ...c }), {}),
2125
+ ...pluginVue.configs["flat/recommended"].map((c) => c.rules).reduce((acc, c) => ({ ...acc, ...c }), {}),
2103
2126
  "antfu/no-top-level-await": "off",
2104
2127
  "node/prefer-global/process": "off",
2105
2128
  "ts/explicit-function-return-type": "off",
@@ -2238,11 +2261,11 @@ async function yaml(options = {}) {
2238
2261
  }
2239
2262
  },
2240
2263
  {
2241
- name: "luxass/yaml/rules",
2242
2264
  files,
2243
2265
  languageOptions: {
2244
2266
  parser: parserYaml
2245
2267
  },
2268
+ name: "luxass/yaml/rules",
2246
2269
  rules: {
2247
2270
  "style/spaced-comment": "off",
2248
2271
  "yaml/block-mapping": "error",
@@ -2289,16 +2312,16 @@ var VuePackages = [
2289
2312
  "@slidev/cli"
2290
2313
  ];
2291
2314
  var defaultPluginRenaming = {
2315
+ "@eslint-react": "react",
2316
+ "@eslint-react/dom": "react-dom",
2317
+ "@eslint-react/hooks-extra": "react-hooks-extra",
2318
+ "@eslint-react/naming-convention": "react-naming-convention",
2292
2319
  "@stylistic": "style",
2293
2320
  "@typescript-eslint": "ts",
2294
2321
  "import-x": "import",
2295
2322
  "n": "node",
2296
2323
  "vitest": "test",
2297
- "yml": "yaml",
2298
- "@eslint-react": "react",
2299
- "@eslint-react/dom": "react-dom",
2300
- "@eslint-react/hooks-extra": "react-hooks-extra",
2301
- "@eslint-react/naming-convention": "react-naming-convention"
2324
+ "yml": "yaml"
2302
2325
  };
2303
2326
  function luxass(options = {}, ...userConfigs) {
2304
2327
  const {
@@ -2309,12 +2332,12 @@ function luxass(options = {}, ...userConfigs) {
2309
2332
  jsx: enableJsx = true,
2310
2333
  react: enableReact = false,
2311
2334
  regexp: enableRegexp = true,
2335
+ tailwindcss: enableTailwindCSS = false,
2336
+ type: projectType = "app",
2312
2337
  typescript: enableTypeScript = isPackageExists3("typescript"),
2313
2338
  unicorn: enableUnicorn = true,
2314
2339
  unocss: enableUnoCSS = false,
2315
- tailwindcss: enableTailwindCSS = false,
2316
- vue: enableVue = VuePackages.some((i) => isPackageExists3(i)),
2317
- type: projectType = "app"
2340
+ vue: enableVue = VuePackages.some((i) => isPackageExists3(i))
2318
2341
  } = options;
2319
2342
  let isInEditor = options.isInEditor;
2320
2343
  if (isInEditor == null) {
@@ -2494,7 +2517,7 @@ function luxass(options = {}, ...userConfigs) {
2494
2517
  }
2495
2518
 
2496
2519
  // src/index.ts
2497
- var src_default = luxass;
2520
+ var index_default = luxass;
2498
2521
  export {
2499
2522
  GLOB_ASTRO,
2500
2523
  GLOB_ASTRO_TS,
@@ -2528,7 +2551,7 @@ export {
2528
2551
  astro,
2529
2552
  combine,
2530
2553
  comments,
2531
- src_default as default,
2554
+ index_default as default,
2532
2555
  disables,
2533
2556
  ensure,
2534
2557
  formatters,