@luxass/eslint-config 4.4.3 → 4.5.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/README.md CHANGED
@@ -131,7 +131,10 @@ Install [ESLint extension](https://marketplace.visualstudio.com/items?itemName=d
131
131
  "yaml",
132
132
  "toml",
133
133
  "gql",
134
- "graphql"
134
+ "graphql",
135
+ "astro",
136
+ "css",
137
+ "postcss"
135
138
  ]
136
139
  }
137
140
  ```
package/dist/index.cjs CHANGED
@@ -76,6 +76,7 @@ __export(src_exports, {
76
76
  node: () => node,
77
77
  parserPlain: () => parserPlain,
78
78
  react: () => react,
79
+ regexp: () => regexp,
79
80
  renameRules: () => renameRules,
80
81
  resolveSubOptions: () => resolveSubOptions,
81
82
  solid: () => solid,
@@ -544,8 +545,8 @@ var parserPlain = {
544
545
  }
545
546
  })
546
547
  };
547
- async function combine(...configs) {
548
- const resolved = await Promise.all(configs);
548
+ async function combine(...configs2) {
549
+ const resolved = await Promise.all(configs2);
549
550
  return resolved.flat();
550
551
  }
551
552
  function renameRules(rules, from, to) {
@@ -1735,11 +1736,13 @@ async function test(options = {}) {
1735
1736
  name: "luxass/test/rules",
1736
1737
  files,
1737
1738
  rules: {
1739
+ "node/prefer-global/process": "off",
1738
1740
  "test/consistent-test-it": [
1739
1741
  "error",
1740
1742
  { fn: "it", withinDescribe: "it" }
1741
1743
  ],
1742
1744
  "test/no-identical-title": "error",
1745
+ "test/no-import-node-test": "error",
1743
1746
  "test/no-focused-tests": editor ? "off" : "error",
1744
1747
  "test/prefer-hooks-in-order": "error",
1745
1748
  "test/prefer-lowercase-title": "error",
@@ -1802,7 +1805,7 @@ var RemixPackages = [
1802
1805
  ];
1803
1806
  async function react(options = {}) {
1804
1807
  const {
1805
- files = [GLOB_TS, GLOB_TSX],
1808
+ files = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
1806
1809
  overrides = {}
1807
1810
  } = options;
1808
1811
  await ensure([
@@ -2131,7 +2134,7 @@ async function formatters(options = {}, stylistic2 = {}) {
2131
2134
  options.dprintOptions || {}
2132
2135
  );
2133
2136
  const pluginFormat = await interop(import("eslint-plugin-format"));
2134
- const configs = [
2137
+ const configs2 = [
2135
2138
  {
2136
2139
  name: "luxass/formatter/setup",
2137
2140
  plugins: {
@@ -2140,7 +2143,7 @@ async function formatters(options = {}, stylistic2 = {}) {
2140
2143
  }
2141
2144
  ];
2142
2145
  if (options.css) {
2143
- configs.push(
2146
+ configs2.push(
2144
2147
  {
2145
2148
  name: "luxass/formatter/css",
2146
2149
  files: [GLOB_CSS, GLOB_POSTCSS],
@@ -2192,7 +2195,7 @@ async function formatters(options = {}, stylistic2 = {}) {
2192
2195
  );
2193
2196
  }
2194
2197
  if (options.html) {
2195
- configs.push({
2198
+ configs2.push({
2196
2199
  name: "luxass/formatter/html",
2197
2200
  files: [GLOB_HTML],
2198
2201
  languageOptions: {
@@ -2211,7 +2214,7 @@ async function formatters(options = {}, stylistic2 = {}) {
2211
2214
  }
2212
2215
  if (options.markdown) {
2213
2216
  const formater = options.markdown === true ? "prettier" : options.markdown;
2214
- configs.push({
2217
+ configs2.push({
2215
2218
  name: "luxass/formatter/markdown",
2216
2219
  files: [GLOB_MARKDOWN],
2217
2220
  languageOptions: {
@@ -2234,7 +2237,7 @@ async function formatters(options = {}, stylistic2 = {}) {
2234
2237
  });
2235
2238
  }
2236
2239
  if (options.astro) {
2237
- configs.push({
2240
+ configs2.push({
2238
2241
  name: "luxass/formatter/astro",
2239
2242
  files: [GLOB_ASTRO],
2240
2243
  languageOptions: {
@@ -2255,7 +2258,7 @@ async function formatters(options = {}, stylistic2 = {}) {
2255
2258
  });
2256
2259
  }
2257
2260
  if (options.graphql) {
2258
- configs.push({
2261
+ configs2.push({
2259
2262
  name: "luxass/formatter/graphql",
2260
2263
  files: [GLOB_GRAPHQL],
2261
2264
  languageOptions: {
@@ -2272,7 +2275,7 @@ async function formatters(options = {}, stylistic2 = {}) {
2272
2275
  }
2273
2276
  });
2274
2277
  }
2275
- return configs;
2278
+ return configs2;
2276
2279
  }
2277
2280
 
2278
2281
  // src/configs/toml.ts
@@ -2411,6 +2414,32 @@ async function solid(options = {}) {
2411
2414
  ];
2412
2415
  }
2413
2416
 
2417
+ // src/configs/regexp.ts
2418
+ var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
2419
+ async function regexp(options = {}) {
2420
+ const config = import_eslint_plugin_regexp.configs["flat/recommended"];
2421
+ const rules = {
2422
+ ...config.rules
2423
+ };
2424
+ if (options.level === "warn") {
2425
+ for (const key in rules) {
2426
+ if (rules[key] === "error") {
2427
+ rules[key] = "warn";
2428
+ }
2429
+ }
2430
+ }
2431
+ return [
2432
+ {
2433
+ ...config,
2434
+ name: "luxass/regexp/rules",
2435
+ rules: {
2436
+ ...rules,
2437
+ ...options.overrides
2438
+ }
2439
+ }
2440
+ ];
2441
+ }
2442
+
2414
2443
  // src/factory.ts
2415
2444
  var FLAT_CONFIG_PROPS = [
2416
2445
  "name",
@@ -2454,23 +2483,24 @@ function luxass(options = {}, ...userConfigs) {
2454
2483
  solid: enableSolid = false,
2455
2484
  typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
2456
2485
  unocss: enableUnoCSS = false,
2486
+ regexp: enableRegexp = true,
2457
2487
  vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
2458
2488
  } = options;
2459
2489
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2460
2490
  if (stylisticOptions && !("jsx" in stylisticOptions)) {
2461
2491
  stylisticOptions.jsx = options.jsx ?? true;
2462
2492
  }
2463
- const configs = [];
2493
+ const configs2 = [];
2464
2494
  if (enableGitignore) {
2465
2495
  if (typeof enableGitignore !== "boolean") {
2466
- configs.push(interop(import("eslint-config-flat-gitignore")).then((plugin) => [plugin(enableGitignore)]));
2496
+ configs2.push(interop(import("eslint-config-flat-gitignore")).then((plugin) => [plugin(enableGitignore)]));
2467
2497
  } else {
2468
2498
  if ((0, import_node_fs.existsSync)(".gitignore")) {
2469
- configs.push(interop(import("eslint-config-flat-gitignore")).then((plugin) => [plugin()]));
2499
+ configs2.push(interop(import("eslint-config-flat-gitignore")).then((plugin) => [plugin()]));
2470
2500
  }
2471
2501
  }
2472
2502
  }
2473
- configs.push(
2503
+ configs2.push(
2474
2504
  ignores(),
2475
2505
  javascript({
2476
2506
  editor,
@@ -2490,33 +2520,39 @@ function luxass(options = {}, ...userConfigs) {
2490
2520
  exts.push("vue");
2491
2521
  }
2492
2522
  if (enableTypeScript) {
2493
- configs.push(typescript({
2523
+ configs2.push(typescript({
2494
2524
  ...resolveSubOptions(options, "typescript"),
2495
2525
  exts,
2496
2526
  overrides: getOverrides(options, "typescript")
2497
2527
  }));
2498
2528
  }
2499
2529
  if (stylisticOptions) {
2500
- configs.push(stylistic({
2530
+ configs2.push(stylistic({
2501
2531
  ...stylisticOptions,
2502
2532
  overrides: getOverrides(options, "stylistic")
2503
2533
  }));
2504
2534
  }
2535
+ if (enableRegexp) {
2536
+ configs2.push(regexp({
2537
+ ...resolveSubOptions(options, "regexp"),
2538
+ overrides: getOverrides(options, "regexp")
2539
+ }));
2540
+ }
2505
2541
  if (options.test ?? true) {
2506
- configs.push(test({
2542
+ configs2.push(test({
2507
2543
  editor,
2508
2544
  overrides: getOverrides(options, "test")
2509
2545
  }));
2510
2546
  }
2511
2547
  if (enableReact) {
2512
- configs.push(react({
2548
+ configs2.push(react({
2513
2549
  ...resolveSubOptions(options, "react"),
2514
2550
  overrides: getOverrides(options, "react"),
2515
2551
  tsconfigPath: getOverrides(options, "typescript").tsconfigPath
2516
2552
  }));
2517
2553
  }
2518
2554
  if (enableSolid) {
2519
- configs.push(
2555
+ configs2.push(
2520
2556
  solid({
2521
2557
  ...resolveSubOptions(options, "solid"),
2522
2558
  overrides: getOverrides(options, "solid"),
@@ -2525,7 +2561,7 @@ function luxass(options = {}, ...userConfigs) {
2525
2561
  );
2526
2562
  }
2527
2563
  if (enableSvelte) {
2528
- configs.push(
2564
+ configs2.push(
2529
2565
  svelte({
2530
2566
  ...resolveSubOptions(options, "svelte"),
2531
2567
  overrides: getOverrides(options, "svelte"),
@@ -2535,7 +2571,7 @@ function luxass(options = {}, ...userConfigs) {
2535
2571
  );
2536
2572
  }
2537
2573
  if (enableVue) {
2538
- configs.push(
2574
+ configs2.push(
2539
2575
  vue({
2540
2576
  ...resolveSubOptions(options, "vue"),
2541
2577
  overrides: getOverrides(options, "vue"),
@@ -2545,7 +2581,7 @@ function luxass(options = {}, ...userConfigs) {
2545
2581
  );
2546
2582
  }
2547
2583
  if (enableAstro) {
2548
- configs.push(
2584
+ configs2.push(
2549
2585
  astro({
2550
2586
  ...resolveSubOptions(options, "astro"),
2551
2587
  overrides: getOverrides(options, "astro"),
@@ -2554,19 +2590,19 @@ function luxass(options = {}, ...userConfigs) {
2554
2590
  );
2555
2591
  }
2556
2592
  if (enableUnoCSS) {
2557
- configs.push(unocss({
2593
+ configs2.push(unocss({
2558
2594
  ...resolveSubOptions(options, "unocss"),
2559
2595
  overrides: getOverrides(options, "unocss")
2560
2596
  }));
2561
2597
  }
2562
2598
  if (enableTailwindCSS) {
2563
- configs.push(tailwindcss({
2599
+ configs2.push(tailwindcss({
2564
2600
  ...resolveSubOptions(options, "tailwindcss"),
2565
2601
  overrides: getOverrides(options, "tailwindcss")
2566
2602
  }));
2567
2603
  }
2568
2604
  if (options.jsonc ?? true) {
2569
- configs.push(
2605
+ configs2.push(
2570
2606
  jsonc({
2571
2607
  overrides: getOverrides(options, "jsonc"),
2572
2608
  stylistic: stylisticOptions
@@ -2576,19 +2612,19 @@ function luxass(options = {}, ...userConfigs) {
2576
2612
  );
2577
2613
  }
2578
2614
  if (options.yaml ?? true) {
2579
- configs.push(yaml({
2615
+ configs2.push(yaml({
2580
2616
  overrides: getOverrides(options, "yaml"),
2581
2617
  stylistic: stylisticOptions
2582
2618
  }));
2583
2619
  }
2584
2620
  if (options.toml ?? true) {
2585
- configs.push(toml({
2621
+ configs2.push(toml({
2586
2622
  overrides: getOverrides(options, "toml"),
2587
2623
  stylistic: stylisticOptions
2588
2624
  }));
2589
2625
  }
2590
2626
  if (options.markdown ?? true) {
2591
- configs.push(
2627
+ configs2.push(
2592
2628
  markdown({
2593
2629
  exts,
2594
2630
  overrides: getOverrides(options, "markdown")
@@ -2596,7 +2632,7 @@ function luxass(options = {}, ...userConfigs) {
2596
2632
  );
2597
2633
  }
2598
2634
  if (options.formatters) {
2599
- configs.push(formatters(
2635
+ configs2.push(formatters(
2600
2636
  options.formatters,
2601
2637
  typeof stylisticOptions === "boolean" ? {} : stylisticOptions
2602
2638
  ));
@@ -2608,11 +2644,11 @@ function luxass(options = {}, ...userConfigs) {
2608
2644
  return acc;
2609
2645
  }, {});
2610
2646
  if (Object.keys(fusedConfig).length) {
2611
- configs.push([fusedConfig]);
2647
+ configs2.push([fusedConfig]);
2612
2648
  }
2613
2649
  let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
2614
2650
  composer = composer.append(
2615
- ...configs,
2651
+ ...configs2,
2616
2652
  ...userConfigs
2617
2653
  );
2618
2654
  if (autoRenamePlugins) {
@@ -2670,6 +2706,7 @@ var src_default = luxass;
2670
2706
  node,
2671
2707
  parserPlain,
2672
2708
  react,
2709
+ regexp,
2673
2710
  renameRules,
2674
2711
  resolveSubOptions,
2675
2712
  solid,