@ntnyq/eslint-config 3.7.2 → 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/README.md +1 -1
- package/dist/index.cjs +112 -52
- package/dist/index.d.cts +228 -175
- package/dist/index.d.ts +228 -175
- package/dist/index.js +110 -53
- package/package.json +6 -6
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -67,6 +67,9 @@ __export(src_exports, {
|
|
|
67
67
|
antfu: () => antfu,
|
|
68
68
|
command: () => command,
|
|
69
69
|
comments: () => comments,
|
|
70
|
+
defaultSortInterfacesGroups: () => defaultSortInterfacesGroups,
|
|
71
|
+
defaultSortIntersectionTypesGroups: () => defaultSortIntersectionTypesGroups,
|
|
72
|
+
defaultSortObjectTypesGroups: () => defaultSortObjectTypesGroups,
|
|
70
73
|
defineESLintConfig: () => defineESLintConfig,
|
|
71
74
|
format: () => format,
|
|
72
75
|
getOverrides: () => getOverrides,
|
|
@@ -77,7 +80,7 @@ __export(src_exports, {
|
|
|
77
80
|
hasVitest: () => hasVitest,
|
|
78
81
|
hasVue: () => hasVue,
|
|
79
82
|
ignores: () => ignores,
|
|
80
|
-
|
|
83
|
+
importX: () => importX,
|
|
81
84
|
interopDefault: () => interopDefault,
|
|
82
85
|
javascript: () => javascript,
|
|
83
86
|
jsdoc: () => jsdoc,
|
|
@@ -100,7 +103,7 @@ __export(src_exports, {
|
|
|
100
103
|
pluginComments: () => import_eslint_plugin_eslint_comments.default,
|
|
101
104
|
pluginFormat: () => import_eslint_plugin_format.default,
|
|
102
105
|
pluginGitHubAction: () => import_eslint_plugin_github_action.default,
|
|
103
|
-
|
|
106
|
+
pluginImportX: () => import_eslint_plugin_import_x.default,
|
|
104
107
|
pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
|
|
105
108
|
pluginJsonc: () => import_eslint_plugin_jsonc.default,
|
|
106
109
|
pluginMarkdown: () => import_markdown.default,
|
|
@@ -189,8 +192,8 @@ var import_typescript_eslint2 = require("typescript-eslint");
|
|
|
189
192
|
var import_eslint_plugin_format = __toESM(require("eslint-plugin-format"), 1);
|
|
190
193
|
var import_eslint_plugin = __toESM(require("@unocss/eslint-plugin"), 1);
|
|
191
194
|
var import_eslint_plugin2 = __toESM(require("@vitest/eslint-plugin"), 1);
|
|
192
|
-
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
193
195
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
196
|
+
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
194
197
|
var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
|
|
195
198
|
var import_eslint_plugin3 = __toESM(require("@stylistic/eslint-plugin"), 1);
|
|
196
199
|
var import_eslint_plugin_github_action = __toESM(require("eslint-plugin-github-action"), 1);
|
|
@@ -1676,31 +1679,31 @@ var ignores = (customIgnores = []) => [
|
|
|
1676
1679
|
}
|
|
1677
1680
|
];
|
|
1678
1681
|
|
|
1679
|
-
// src/configs/
|
|
1680
|
-
var
|
|
1682
|
+
// src/configs/importX.ts
|
|
1683
|
+
var importX = (options = {}) => [
|
|
1681
1684
|
{
|
|
1682
|
-
name: "ntnyq/
|
|
1685
|
+
name: "ntnyq/import-x",
|
|
1683
1686
|
plugins: {
|
|
1684
|
-
import: import_eslint_plugin_import_x.default
|
|
1687
|
+
"import-x": import_eslint_plugin_import_x.default
|
|
1685
1688
|
},
|
|
1686
1689
|
settings: {
|
|
1687
|
-
"import/resolver": {
|
|
1690
|
+
"import-x/resolver": {
|
|
1688
1691
|
node: { extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts"] }
|
|
1689
1692
|
}
|
|
1690
1693
|
},
|
|
1691
1694
|
rules: {
|
|
1692
|
-
"import/no-unresolved": "off",
|
|
1693
|
-
"import/no-absolute-path": "off",
|
|
1694
|
-
"import/no-named-as-default-member": "off",
|
|
1695
|
-
"import/no-named-default": "off",
|
|
1695
|
+
"import-x/no-unresolved": "off",
|
|
1696
|
+
"import-x/no-absolute-path": "off",
|
|
1697
|
+
"import-x/no-named-as-default-member": "off",
|
|
1698
|
+
"import-x/no-named-default": "off",
|
|
1696
1699
|
// disabled in favor or `perfectionist/sort-imports`
|
|
1697
|
-
"import/order": "off",
|
|
1698
|
-
"import/first": "error",
|
|
1699
|
-
"import/export": "error",
|
|
1700
|
-
"import/no-self-import": "error",
|
|
1701
|
-
"import/no-duplicates": "error",
|
|
1702
|
-
"import/no-mutable-exports": "error",
|
|
1703
|
-
"import/newline-after-import": "error",
|
|
1700
|
+
"import-x/order": "off",
|
|
1701
|
+
"import-x/first": "error",
|
|
1702
|
+
"import-x/export": "error",
|
|
1703
|
+
"import-x/no-self-import": "error",
|
|
1704
|
+
"import-x/no-duplicates": "error",
|
|
1705
|
+
"import-x/no-mutable-exports": "error",
|
|
1706
|
+
"import-x/newline-after-import": "error",
|
|
1704
1707
|
// Overrides rules
|
|
1705
1708
|
...options.overrides
|
|
1706
1709
|
}
|
|
@@ -1844,12 +1847,12 @@ var specials = (options = {}) => [
|
|
|
1844
1847
|
name: "ntnyq/specials/config-file",
|
|
1845
1848
|
files: [`**/*.config*.${GLOB_SRC_EXT}`],
|
|
1846
1849
|
plugins: {
|
|
1847
|
-
import: import_eslint_plugin_import_x.default,
|
|
1850
|
+
"import-x": import_eslint_plugin_import_x.default,
|
|
1848
1851
|
perfectionist: import_eslint_plugin_perfectionist.default
|
|
1849
1852
|
},
|
|
1850
1853
|
rules: {
|
|
1851
1854
|
"no-console": "off",
|
|
1852
|
-
"import/no-default-export": "off",
|
|
1855
|
+
"import-x/no-default-export": "off",
|
|
1853
1856
|
"@typescript-eslint/explicit-function-return-type": "off",
|
|
1854
1857
|
"perfectionist/sort-objects": [
|
|
1855
1858
|
"error",
|
|
@@ -1931,7 +1934,7 @@ var markdown = (options = {}) => {
|
|
|
1931
1934
|
"no-restricted-imports": "off",
|
|
1932
1935
|
"node/prefer-global/buffer": "off",
|
|
1933
1936
|
"node/prefer-global/process": "off",
|
|
1934
|
-
"import/no-unresolved": "off",
|
|
1937
|
+
"import-x/no-unresolved": "off",
|
|
1935
1938
|
"unused-imports/no-unused-imports": "off",
|
|
1936
1939
|
"unused-imports/no-unused-vars": "off",
|
|
1937
1940
|
"@typescript-eslint/comma-dangle": "off",
|
|
@@ -2474,8 +2477,8 @@ var typescript = (options = {}) => {
|
|
|
2474
2477
|
rules: {
|
|
2475
2478
|
"no-use-before-define": "off",
|
|
2476
2479
|
"no-restricted-syntax": "off",
|
|
2477
|
-
"import/no-duplicates": "off",
|
|
2478
|
-
"import/newline-after-import": "off",
|
|
2480
|
+
"import-x/no-duplicates": "off",
|
|
2481
|
+
"import-x/newline-after-import": "off",
|
|
2479
2482
|
"@typescript-eslint/no-use-before-define": "off"
|
|
2480
2483
|
}
|
|
2481
2484
|
}
|
|
@@ -2509,6 +2512,71 @@ var githubAction = (options = {}) => {
|
|
|
2509
2512
|
};
|
|
2510
2513
|
|
|
2511
2514
|
// src/configs/perfectionist.ts
|
|
2515
|
+
var sharedGroups = [
|
|
2516
|
+
"required-property",
|
|
2517
|
+
"optional-property",
|
|
2518
|
+
"required-method",
|
|
2519
|
+
"optional-method",
|
|
2520
|
+
"required-multiline-property",
|
|
2521
|
+
"optional-multiline-property",
|
|
2522
|
+
"required-multiline-method",
|
|
2523
|
+
"optional-multiline-method",
|
|
2524
|
+
"unknown",
|
|
2525
|
+
"index-signature",
|
|
2526
|
+
"multiline-index-signature"
|
|
2527
|
+
];
|
|
2528
|
+
var defaultSortInterfacesGroups = [...sharedGroups];
|
|
2529
|
+
var defaultSortObjectTypesGroups = [...sharedGroups];
|
|
2530
|
+
var defaultSortIntersectionTypesGroups = [
|
|
2531
|
+
/**
|
|
2532
|
+
* eg. 'foobar', 24, false
|
|
2533
|
+
*/
|
|
2534
|
+
"literal",
|
|
2535
|
+
/**
|
|
2536
|
+
* eg. number, string
|
|
2537
|
+
*/
|
|
2538
|
+
"keyword",
|
|
2539
|
+
/**
|
|
2540
|
+
* eg. FooBar
|
|
2541
|
+
*/
|
|
2542
|
+
"named",
|
|
2543
|
+
/**
|
|
2544
|
+
* eg. Foo & Bar
|
|
2545
|
+
*/
|
|
2546
|
+
"intersection",
|
|
2547
|
+
/**
|
|
2548
|
+
* eg. Foobar extends string ? Foo : Bar
|
|
2549
|
+
*/
|
|
2550
|
+
"conditional",
|
|
2551
|
+
/**
|
|
2552
|
+
* eg. (...args: any[]) => void
|
|
2553
|
+
*/
|
|
2554
|
+
"function",
|
|
2555
|
+
/**
|
|
2556
|
+
* eg. import('eslint').Linter
|
|
2557
|
+
*/
|
|
2558
|
+
"import",
|
|
2559
|
+
/**
|
|
2560
|
+
* eg. { foo: string; bar: number; }
|
|
2561
|
+
*/
|
|
2562
|
+
"object",
|
|
2563
|
+
/**
|
|
2564
|
+
* eg. keyof T
|
|
2565
|
+
*/
|
|
2566
|
+
"operator",
|
|
2567
|
+
/**
|
|
2568
|
+
* eg. [string, number]
|
|
2569
|
+
*/
|
|
2570
|
+
"tuple",
|
|
2571
|
+
/**
|
|
2572
|
+
* eg. Foo | Bar
|
|
2573
|
+
*/
|
|
2574
|
+
"union",
|
|
2575
|
+
/**
|
|
2576
|
+
* eg. null | undefined
|
|
2577
|
+
*/
|
|
2578
|
+
"nullish"
|
|
2579
|
+
];
|
|
2512
2580
|
var perfectionist = (options = {}) => {
|
|
2513
2581
|
const {
|
|
2514
2582
|
sortEnums: enableSortEnums = true,
|
|
@@ -2643,34 +2711,22 @@ var perfectionist = (options = {}) => {
|
|
|
2643
2711
|
order: "asc"
|
|
2644
2712
|
}
|
|
2645
2713
|
],
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2714
|
+
"perfectionist/sort-interfaces": [
|
|
2715
|
+
"error",
|
|
2716
|
+
{
|
|
2717
|
+
type: "alphabetical",
|
|
2718
|
+
order: "asc",
|
|
2719
|
+
partitionByComment: true,
|
|
2720
|
+
groups: defaultSortInterfacesGroups
|
|
2721
|
+
}
|
|
2722
|
+
],
|
|
2654
2723
|
"perfectionist/sort-intersection-types": [
|
|
2655
2724
|
"error",
|
|
2656
2725
|
{
|
|
2657
2726
|
type: "alphabetical",
|
|
2658
2727
|
order: "asc",
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
"named",
|
|
2662
|
-
"conditional",
|
|
2663
|
-
"function",
|
|
2664
|
-
"import",
|
|
2665
|
-
"keyword",
|
|
2666
|
-
"literal",
|
|
2667
|
-
"object",
|
|
2668
|
-
"operator",
|
|
2669
|
-
"tuple",
|
|
2670
|
-
"union",
|
|
2671
|
-
"nullish"
|
|
2672
|
-
],
|
|
2673
|
-
partitionByComment: true
|
|
2728
|
+
partitionByComment: true,
|
|
2729
|
+
groups: [...defaultSortIntersectionTypesGroups]
|
|
2674
2730
|
}
|
|
2675
2731
|
],
|
|
2676
2732
|
"perfectionist/sort-modules": [
|
|
@@ -2686,7 +2742,8 @@ var perfectionist = (options = {}) => {
|
|
|
2686
2742
|
{
|
|
2687
2743
|
type: "alphabetical",
|
|
2688
2744
|
order: "asc",
|
|
2689
|
-
partitionByComment: true
|
|
2745
|
+
partitionByComment: true,
|
|
2746
|
+
groups: []
|
|
2690
2747
|
}
|
|
2691
2748
|
],
|
|
2692
2749
|
"perfectionist/sort-union-types": [
|
|
@@ -2830,8 +2887,8 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2830
2887
|
...command({
|
|
2831
2888
|
...resolveSubOptions(options, "command")
|
|
2832
2889
|
}),
|
|
2833
|
-
...
|
|
2834
|
-
overrides: getOverrides(options, "
|
|
2890
|
+
...importX({
|
|
2891
|
+
overrides: getOverrides(options, "importX")
|
|
2835
2892
|
}),
|
|
2836
2893
|
...jsdoc({
|
|
2837
2894
|
typescript: !!enableTypeScript,
|
|
@@ -3014,6 +3071,9 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
3014
3071
|
antfu,
|
|
3015
3072
|
command,
|
|
3016
3073
|
comments,
|
|
3074
|
+
defaultSortInterfacesGroups,
|
|
3075
|
+
defaultSortIntersectionTypesGroups,
|
|
3076
|
+
defaultSortObjectTypesGroups,
|
|
3017
3077
|
defineESLintConfig,
|
|
3018
3078
|
format,
|
|
3019
3079
|
getOverrides,
|
|
@@ -3024,7 +3084,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
3024
3084
|
hasVitest,
|
|
3025
3085
|
hasVue,
|
|
3026
3086
|
ignores,
|
|
3027
|
-
|
|
3087
|
+
importX,
|
|
3028
3088
|
interopDefault,
|
|
3029
3089
|
javascript,
|
|
3030
3090
|
jsdoc,
|
|
@@ -3047,7 +3107,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
3047
3107
|
pluginComments,
|
|
3048
3108
|
pluginFormat,
|
|
3049
3109
|
pluginGitHubAction,
|
|
3050
|
-
|
|
3110
|
+
pluginImportX,
|
|
3051
3111
|
pluginJsdoc,
|
|
3052
3112
|
pluginJsonc,
|
|
3053
3113
|
pluginMarkdown,
|