@ntnyq/eslint-config 3.7.1 → 3.8.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
@@ -47,8 +47,8 @@ import { plugin } from "typescript-eslint";
47
47
  import { default as default11 } from "eslint-plugin-format";
48
48
  import { default as default12 } from "@unocss/eslint-plugin";
49
49
  import { default as default13 } from "@vitest/eslint-plugin";
50
- import { default as default14 } from "eslint-plugin-import-x";
51
- import { default as default15 } from "eslint-plugin-unicorn";
50
+ import { default as default14 } from "eslint-plugin-unicorn";
51
+ import { default as default15 } from "eslint-plugin-import-x";
52
52
  import { default as default16 } from "eslint-plugin-prettier";
53
53
  import { default as default17 } from "@stylistic/eslint-plugin";
54
54
  import { default as default18 } from "eslint-plugin-github-action";
@@ -1012,7 +1012,6 @@ var jsdoc = (options = {}) => [
1012
1012
  "jsdoc/check-line-alignment": "error",
1013
1013
  "jsdoc/check-param-names": "error",
1014
1014
  "jsdoc/check-property-names": "error",
1015
- "jsdoc/check-tag-names": "error",
1016
1015
  "jsdoc/check-types": "error",
1017
1016
  "jsdoc/empty-tags": "error",
1018
1017
  "jsdoc/multiline-blocks": "error",
@@ -1023,6 +1022,16 @@ var jsdoc = (options = {}) => [
1023
1022
  "jsdoc/no-multi-asterisks": "error",
1024
1023
  "jsdoc/require-asterisk-prefix": "error",
1025
1024
  "jsdoc/require-hyphen-before-param-description": "error",
1025
+ "jsdoc/check-tag-names": [
1026
+ "error",
1027
+ {
1028
+ definedTags: [
1029
+ // magic-comments
1030
+ "vite-ignore",
1031
+ "unocss-include"
1032
+ ]
1033
+ }
1034
+ ],
1026
1035
  // TODO: this after investigate
1027
1036
  // 'jsdoc/sort-tags': [
1028
1037
  // 'error',
@@ -1525,31 +1534,31 @@ var ignores = (customIgnores = []) => [
1525
1534
  }
1526
1535
  ];
1527
1536
 
1528
- // src/configs/imports.ts
1529
- var imports = (options = {}) => [
1537
+ // src/configs/importX.ts
1538
+ var importX = (options = {}) => [
1530
1539
  {
1531
- name: "ntnyq/imports",
1540
+ name: "ntnyq/import-x",
1532
1541
  plugins: {
1533
- import: default14
1542
+ "import-x": default15
1534
1543
  },
1535
1544
  settings: {
1536
- "import/resolver": {
1545
+ "import-x/resolver": {
1537
1546
  node: { extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts"] }
1538
1547
  }
1539
1548
  },
1540
1549
  rules: {
1541
- "import/no-unresolved": "off",
1542
- "import/no-absolute-path": "off",
1543
- "import/no-named-as-default-member": "off",
1544
- "import/no-named-default": "off",
1550
+ "import-x/no-unresolved": "off",
1551
+ "import-x/no-absolute-path": "off",
1552
+ "import-x/no-named-as-default-member": "off",
1553
+ "import-x/no-named-default": "off",
1545
1554
  // disabled in favor or `perfectionist/sort-imports`
1546
- "import/order": "off",
1547
- "import/first": "error",
1548
- "import/export": "error",
1549
- "import/no-self-import": "error",
1550
- "import/no-duplicates": "error",
1551
- "import/no-mutable-exports": "error",
1552
- "import/newline-after-import": "error",
1555
+ "import-x/order": "off",
1556
+ "import-x/first": "error",
1557
+ "import-x/export": "error",
1558
+ "import-x/no-self-import": "error",
1559
+ "import-x/no-duplicates": "error",
1560
+ "import-x/no-mutable-exports": "error",
1561
+ "import-x/newline-after-import": "error",
1553
1562
  // Overrides rules
1554
1563
  ...options.overrides
1555
1564
  }
@@ -1571,7 +1580,7 @@ var unicorn = (options = {}) => [
1571
1580
  {
1572
1581
  name: "ntnyq/unicorn",
1573
1582
  plugins: {
1574
- unicorn: default15
1583
+ unicorn: default14
1575
1584
  },
1576
1585
  rules: {
1577
1586
  "unicorn/escape-case": "error",
@@ -1693,12 +1702,12 @@ var specials = (options = {}) => [
1693
1702
  name: "ntnyq/specials/config-file",
1694
1703
  files: [`**/*.config*.${GLOB_SRC_EXT}`],
1695
1704
  plugins: {
1696
- import: default14,
1705
+ "import-x": default15,
1697
1706
  perfectionist: default19
1698
1707
  },
1699
1708
  rules: {
1700
1709
  "no-console": "off",
1701
- "import/no-default-export": "off",
1710
+ "import-x/no-default-export": "off",
1702
1711
  "@typescript-eslint/explicit-function-return-type": "off",
1703
1712
  "perfectionist/sort-objects": [
1704
1713
  "error",
@@ -1780,7 +1789,7 @@ var markdown = (options = {}) => {
1780
1789
  "no-restricted-imports": "off",
1781
1790
  "node/prefer-global/buffer": "off",
1782
1791
  "node/prefer-global/process": "off",
1783
- "import/no-unresolved": "off",
1792
+ "import-x/no-unresolved": "off",
1784
1793
  "unused-imports/no-unused-imports": "off",
1785
1794
  "unused-imports/no-unused-vars": "off",
1786
1795
  "@typescript-eslint/comma-dangle": "off",
@@ -2323,8 +2332,8 @@ var typescript = (options = {}) => {
2323
2332
  rules: {
2324
2333
  "no-use-before-define": "off",
2325
2334
  "no-restricted-syntax": "off",
2326
- "import/no-duplicates": "off",
2327
- "import/newline-after-import": "off",
2335
+ "import-x/no-duplicates": "off",
2336
+ "import-x/newline-after-import": "off",
2328
2337
  "@typescript-eslint/no-use-before-define": "off"
2329
2338
  }
2330
2339
  }
@@ -2332,22 +2341,97 @@ var typescript = (options = {}) => {
2332
2341
  };
2333
2342
 
2334
2343
  // src/configs/githubAction.ts
2335
- var githubAction = (options = {}) => [
2336
- {
2344
+ import { createRecommendedConfig } from "eslint-plugin-github-action";
2345
+ var githubAction = (options = {}) => {
2346
+ const {
2347
+ // Support common overrides rules
2348
+ overrides: overridesRules = {},
2349
+ // Flat config options
2350
+ ...restOptions
2351
+ } = options;
2352
+ const recommendedConfig = createRecommendedConfig({
2337
2353
  name: "ntnyq/github-action",
2338
2354
  files: [GLOB_GITHUB_ACTION],
2339
- plugins: {
2340
- "github-action": default18
2341
- },
2342
- rules: {
2343
- "github-action/require-action-name": "error",
2344
- // Overrides rules
2345
- ...options.overrides
2355
+ ...restOptions
2356
+ });
2357
+ return [
2358
+ {
2359
+ ...recommendedConfig,
2360
+ rules: {
2361
+ ...recommendedConfig.rules,
2362
+ // Overrides rules
2363
+ ...overridesRules
2364
+ }
2346
2365
  }
2347
- }
2348
- ];
2366
+ ];
2367
+ };
2349
2368
 
2350
2369
  // src/configs/perfectionist.ts
2370
+ var sharedGroups = [
2371
+ "required-property",
2372
+ "optional-property",
2373
+ "required-method",
2374
+ "optional-method",
2375
+ "required-multiline-property",
2376
+ "optional-multiline-property",
2377
+ "required-multiline-method",
2378
+ "optional-multiline-method",
2379
+ "unknown",
2380
+ "index-signature",
2381
+ "multiline-index-signature"
2382
+ ];
2383
+ var defaultSortInterfacesGroups = [...sharedGroups];
2384
+ var defaultSortObjectTypesGroups = [...sharedGroups];
2385
+ var defaultSortIntersectionTypesGroups = [
2386
+ /**
2387
+ * eg. 'foobar', 24, false
2388
+ */
2389
+ "literal",
2390
+ /**
2391
+ * eg. number, string
2392
+ */
2393
+ "keyword",
2394
+ /**
2395
+ * eg. FooBar
2396
+ */
2397
+ "named",
2398
+ /**
2399
+ * eg. Foo & Bar
2400
+ */
2401
+ "intersection",
2402
+ /**
2403
+ * eg. Foobar extends string ? Foo : Bar
2404
+ */
2405
+ "conditional",
2406
+ /**
2407
+ * eg. (...args: any[]) => void
2408
+ */
2409
+ "function",
2410
+ /**
2411
+ * eg. import('eslint').Linter
2412
+ */
2413
+ "import",
2414
+ /**
2415
+ * eg. { foo: string; bar: number; }
2416
+ */
2417
+ "object",
2418
+ /**
2419
+ * eg. keyof T
2420
+ */
2421
+ "operator",
2422
+ /**
2423
+ * eg. [string, number]
2424
+ */
2425
+ "tuple",
2426
+ /**
2427
+ * eg. Foo | Bar
2428
+ */
2429
+ "union",
2430
+ /**
2431
+ * eg. null | undefined
2432
+ */
2433
+ "nullish"
2434
+ ];
2351
2435
  var perfectionist = (options = {}) => {
2352
2436
  const {
2353
2437
  sortEnums: enableSortEnums = true,
@@ -2450,7 +2534,8 @@ var perfectionist = (options = {}) => {
2450
2534
  "error",
2451
2535
  {
2452
2536
  type: "alphabetical",
2453
- order: "asc"
2537
+ order: "asc",
2538
+ partitionByComment: true
2454
2539
  }
2455
2540
  ],
2456
2541
  "perfectionist/sort-modules": [
@@ -2481,32 +2566,22 @@ var perfectionist = (options = {}) => {
2481
2566
  order: "asc"
2482
2567
  }
2483
2568
  ],
2484
- // 'perfectionist/sort-interfaces': [
2485
- // 'error',
2486
- // {
2487
- // type: 'alphabetical',
2488
- // order: 'asc',
2489
- // },
2490
- // ],
2569
+ "perfectionist/sort-interfaces": [
2570
+ "error",
2571
+ {
2572
+ type: "alphabetical",
2573
+ order: "asc",
2574
+ partitionByComment: true,
2575
+ groups: defaultSortInterfacesGroups
2576
+ }
2577
+ ],
2491
2578
  "perfectionist/sort-intersection-types": [
2492
2579
  "error",
2493
2580
  {
2494
2581
  type: "alphabetical",
2495
2582
  order: "asc",
2496
- groups: [
2497
- "intersection",
2498
- "named",
2499
- "conditional",
2500
- "function",
2501
- "import",
2502
- "keyword",
2503
- "literal",
2504
- "object",
2505
- "operator",
2506
- "tuple",
2507
- "union",
2508
- "nullish"
2509
- ]
2583
+ partitionByComment: true,
2584
+ groups: [...defaultSortIntersectionTypesGroups]
2510
2585
  }
2511
2586
  ],
2512
2587
  "perfectionist/sort-modules": [
@@ -2521,14 +2596,17 @@ var perfectionist = (options = {}) => {
2521
2596
  "error",
2522
2597
  {
2523
2598
  type: "alphabetical",
2524
- order: "asc"
2599
+ order: "asc",
2600
+ partitionByComment: true,
2601
+ groups: []
2525
2602
  }
2526
2603
  ],
2527
2604
  "perfectionist/sort-union-types": [
2528
2605
  "error",
2529
2606
  {
2530
2607
  type: "alphabetical",
2531
- order: "asc"
2608
+ order: "asc",
2609
+ partitionByComment: true
2532
2610
  }
2533
2611
  ],
2534
2612
  // Overrides rules
@@ -2548,21 +2626,24 @@ var perfectionist = (options = {}) => {
2548
2626
  "error",
2549
2627
  {
2550
2628
  type: "alphabetical",
2551
- order: "asc"
2629
+ order: "asc",
2630
+ partitionByComment: true
2552
2631
  }
2553
2632
  ],
2554
2633
  "perfectionist/sort-objects": [
2555
2634
  "error",
2556
2635
  {
2557
2636
  type: "alphabetical",
2558
- order: "asc"
2637
+ order: "asc",
2638
+ partitionByComment: true
2559
2639
  }
2560
2640
  ],
2561
2641
  "perfectionist/sort-sets": [
2562
2642
  "error",
2563
2643
  {
2564
2644
  type: "alphabetical",
2565
- order: "asc"
2645
+ order: "asc",
2646
+ partitionByComment: true
2566
2647
  }
2567
2648
  ],
2568
2649
  "perfectionist/sort-modules": [
@@ -2661,8 +2742,8 @@ function defineESLintConfig(options = {}, ...userConfigs) {
2661
2742
  ...command({
2662
2743
  ...resolveSubOptions(options, "command")
2663
2744
  }),
2664
- ...imports({
2665
- overrides: getOverrides(options, "imports")
2745
+ ...importX({
2746
+ overrides: getOverrides(options, "importX")
2666
2747
  }),
2667
2748
  ...jsdoc({
2668
2749
  typescript: !!enableTypeScript,
@@ -2844,6 +2925,9 @@ export {
2844
2925
  antfu,
2845
2926
  command,
2846
2927
  comments,
2928
+ defaultSortInterfacesGroups,
2929
+ defaultSortIntersectionTypesGroups,
2930
+ defaultSortObjectTypesGroups,
2847
2931
  defineESLintConfig,
2848
2932
  format,
2849
2933
  getOverrides,
@@ -2854,7 +2938,7 @@ export {
2854
2938
  hasVitest,
2855
2939
  hasVue,
2856
2940
  ignores,
2857
- imports,
2941
+ importX,
2858
2942
  interopDefault,
2859
2943
  javascript,
2860
2944
  jsdoc,
@@ -2877,7 +2961,7 @@ export {
2877
2961
  default21 as pluginComments,
2878
2962
  default11 as pluginFormat,
2879
2963
  default18 as pluginGitHubAction,
2880
- default14 as pluginImport,
2964
+ default15 as pluginImportX,
2881
2965
  default9 as pluginJsdoc,
2882
2966
  default10 as pluginJsonc,
2883
2967
  default7 as pluginMarkdown,
@@ -2889,7 +2973,7 @@ export {
2889
2973
  default17 as pluginStylistic,
2890
2974
  default5 as pluginToml,
2891
2975
  plugin as pluginTypeScript,
2892
- default15 as pluginUnicorn,
2976
+ default14 as pluginUnicorn,
2893
2977
  default12 as pluginUnoCSS,
2894
2978
  default20 as pluginUnusedImports,
2895
2979
  default13 as pluginVitest,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ntnyq/eslint-config",
3
3
  "type": "module",
4
- "version": "3.7.1",
4
+ "version": "3.8.0",
5
5
  "packageManager": "pnpm@9.14.4",
6
6
  "description": "An opinionated ESLint config preset of ntnyq",
7
7
  "keywords": [
@@ -53,42 +53,42 @@
53
53
  "typecheck": "tsc --noEmit"
54
54
  },
55
55
  "peerDependencies": {
56
- "eslint": "^9.0.0"
56
+ "eslint": "^9.5.0"
57
57
  },
58
58
  "dependencies": {
59
59
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
60
60
  "@eslint/js": "^9.16.0",
61
61
  "@eslint/markdown": "^6.2.1",
62
62
  "@stylistic/eslint-plugin": "^2.11.0",
63
- "@unocss/eslint-plugin": "^0.64.1",
64
- "@vitest/eslint-plugin": "^1.1.12",
63
+ "@unocss/eslint-plugin": "^0.65.0",
64
+ "@vitest/eslint-plugin": "^1.1.14",
65
65
  "eslint-config-flat-gitignore": "^0.3.0",
66
66
  "eslint-flat-config-utils": "^0.4.0",
67
67
  "eslint-merge-processors": "^0.1.0",
68
68
  "eslint-plugin-antfu": "^2.7.0",
69
69
  "eslint-plugin-command": "^0.2.6",
70
70
  "eslint-plugin-format": "^0.1.3",
71
- "eslint-plugin-github-action": "^0.0.6",
72
- "eslint-plugin-import-x": "^4.4.3",
71
+ "eslint-plugin-github-action": "^0.0.8",
72
+ "eslint-plugin-import-x": "^4.5.0",
73
73
  "eslint-plugin-jsdoc": "^50.6.0",
74
74
  "eslint-plugin-jsonc": "^2.18.2",
75
75
  "eslint-plugin-n": "^17.14.0",
76
76
  "eslint-plugin-ntnyq": "^0.7.1",
77
- "eslint-plugin-perfectionist": "^4.1.2",
77
+ "eslint-plugin-perfectionist": "^4.2.0",
78
78
  "eslint-plugin-prettier": "^5.2.1",
79
79
  "eslint-plugin-regexp": "^2.7.0",
80
- "eslint-plugin-toml": "^0.11.1",
80
+ "eslint-plugin-toml": "^0.12.0",
81
81
  "eslint-plugin-unicorn": "^56.0.1",
82
82
  "eslint-plugin-unused-imports": "^4.1.4",
83
83
  "eslint-plugin-vue": "^9.32.0",
84
- "eslint-plugin-yml": "^1.15.0",
84
+ "eslint-plugin-yml": "^1.16.0",
85
85
  "eslint-processor-vue-blocks": "^0.1.2",
86
- "globals": "^15.12.0",
86
+ "globals": "^15.13.0",
87
87
  "jsonc-eslint-parser": "^2.4.0",
88
88
  "local-pkg": "^0.5.1",
89
89
  "prettier": "^3.4.1",
90
90
  "toml-eslint-parser": "^0.10.0",
91
- "typescript-eslint": "^8.16.0",
91
+ "typescript-eslint": "^8.17.0",
92
92
  "vue-eslint-parser": "^9.4.3",
93
93
  "yaml-eslint-parser": "^1.2.3"
94
94
  },
@@ -106,7 +106,7 @@
106
106
  "tsup": "^8.3.5",
107
107
  "tsx": "^4.19.2",
108
108
  "typescript": "^5.7.2",
109
- "vitest": "^2.1.6",
109
+ "vitest": "^2.1.8",
110
110
  "zx": "^8.2.4"
111
111
  },
112
112
  "engines": {