@ntnyq/eslint-config 3.8.0 → 3.9.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 +19 -38
- package/dist/index.cjs +83 -16
- package/dist/index.d.cts +6343 -4061
- package/dist/index.d.ts +6343 -4061
- package/dist/index.js +148 -84
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -110,55 +110,36 @@ Check for detail in:
|
|
|
110
110
|
|
|
111
111
|
```ts
|
|
112
112
|
export interface ConfigOptions extends ConfigOptionsInternal {
|
|
113
|
-
node?: ConfigNodeOptions
|
|
114
|
-
|
|
115
|
-
jsdoc?: ConfigJsdocOptions
|
|
116
|
-
|
|
117
|
-
ignores?: ConfigIgnoresOptions
|
|
118
|
-
|
|
119
|
-
importX?: ConfigImportsOptions
|
|
120
|
-
|
|
121
113
|
command?: ConfigCommandOptions
|
|
122
|
-
|
|
123
114
|
comments?: ConfigCommentsOptions
|
|
124
|
-
|
|
115
|
+
ignores?: ConfigIgnoresOptions
|
|
116
|
+
importX?: ConfigImportXOptions
|
|
125
117
|
javascript?: ConfigJavaScriptOptions
|
|
126
|
-
|
|
118
|
+
jsdoc?: ConfigJsdocOptions
|
|
119
|
+
node?: ConfigNodeOptions
|
|
127
120
|
specials?: ConfigSpecialsOptions
|
|
128
121
|
|
|
129
|
-
|
|
130
|
-
|
|
122
|
+
/**
|
|
123
|
+
* bellow can be disabled
|
|
124
|
+
*/
|
|
125
|
+
antfu?: boolean | ConfigAntfuOptions
|
|
126
|
+
githubAction?: boolean | ConfigGitHubActionOptions
|
|
131
127
|
gitignore?: boolean | ConfigGitIgnoreOptions
|
|
132
|
-
|
|
128
|
+
jsonc?: boolean | ConfigJsoncOptions
|
|
129
|
+
markdown?: boolean | ConfigMarkdownOptions
|
|
130
|
+
perfectionist?: boolean | ConfigPerfectionistOptions
|
|
131
|
+
pinia?: boolean | ConfigPiniaOptions
|
|
132
|
+
prettier?: boolean | ConfigPrettierOptions
|
|
133
|
+
regexp?: boolean | ConfigRegexpOptions
|
|
134
|
+
sort?: boolean | ConfigSortOptions
|
|
133
135
|
stylistic?: boolean | ConfigStylisticOptions
|
|
134
|
-
|
|
136
|
+
test?: boolean | ConfigTestOptions
|
|
137
|
+
toml?: boolean | ConfigTomlOptions
|
|
135
138
|
typescript?: boolean | ConfigTypeScriptOptions
|
|
136
|
-
|
|
137
139
|
unicorn?: boolean | ConfigUnicornOptions
|
|
138
|
-
|
|
139
|
-
prettier?: boolean | ConfigPrettierOptions
|
|
140
|
-
|
|
141
|
-
perfectionist?: boolean | ConfigPerfectionistOptions
|
|
142
|
-
|
|
143
140
|
unocss?: boolean | ConfigUnoCSSOptions
|
|
144
|
-
|
|
145
|
-
regexp?: boolean | ConfigRegexpOptions
|
|
146
|
-
|
|
147
|
-
jsonc?: boolean | ConfigJsoncOptions
|
|
148
|
-
|
|
149
|
-
yml?: boolean | ConfigYmlOptions
|
|
150
|
-
|
|
151
|
-
markdown?: boolean | ConfigMarkdownOptions
|
|
152
|
-
|
|
153
|
-
toml?: boolean | ConfigTomlOptions
|
|
154
|
-
|
|
155
141
|
vue?: boolean | ConfigVueOptions
|
|
156
|
-
|
|
157
|
-
test?: boolean | ConfigTestOptions
|
|
158
|
-
|
|
159
|
-
antfu?: boolean | ConfigAntfuOptions
|
|
160
|
-
|
|
161
|
-
githubAction?: boolean | ConfigGitHubActionOptions
|
|
142
|
+
yml?: boolean | ConfigYmlOptions
|
|
162
143
|
}
|
|
163
144
|
```
|
|
164
145
|
|
package/dist/index.cjs
CHANGED
|
@@ -51,6 +51,7 @@ __export(src_exports, {
|
|
|
51
51
|
GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
|
|
52
52
|
GLOB_MARKDOWN_NESTED: () => GLOB_MARKDOWN_NESTED,
|
|
53
53
|
GLOB_NODE_MODULES: () => GLOB_NODE_MODULES,
|
|
54
|
+
GLOB_PINIA_STORE: () => GLOB_PINIA_STORE,
|
|
54
55
|
GLOB_POSTCSS: () => GLOB_POSTCSS,
|
|
55
56
|
GLOB_SCSS: () => GLOB_SCSS,
|
|
56
57
|
GLOB_SRC: () => GLOB_SRC,
|
|
@@ -67,14 +68,13 @@ __export(src_exports, {
|
|
|
67
68
|
antfu: () => antfu,
|
|
68
69
|
command: () => command,
|
|
69
70
|
comments: () => comments,
|
|
70
|
-
defaultSortInterfacesGroups: () => defaultSortInterfacesGroups,
|
|
71
|
-
defaultSortIntersectionTypesGroups: () => defaultSortIntersectionTypesGroups,
|
|
72
|
-
defaultSortObjectTypesGroups: () => defaultSortObjectTypesGroups,
|
|
73
71
|
defineESLintConfig: () => defineESLintConfig,
|
|
72
|
+
esX: () => esX,
|
|
74
73
|
format: () => format,
|
|
75
74
|
getOverrides: () => getOverrides,
|
|
76
75
|
githubAction: () => githubAction,
|
|
77
76
|
gitignore: () => gitignore,
|
|
77
|
+
hasPinia: () => hasPinia,
|
|
78
78
|
hasTypeScript: () => hasTypeScript,
|
|
79
79
|
hasUnoCSS: () => hasUnoCSS,
|
|
80
80
|
hasVitest: () => hasVitest,
|
|
@@ -99,8 +99,10 @@ __export(src_exports, {
|
|
|
99
99
|
parserVue: () => parserVue,
|
|
100
100
|
parserYaml: () => parserYaml,
|
|
101
101
|
perfectionist: () => perfectionist,
|
|
102
|
+
pinia: () => pinia,
|
|
102
103
|
pluginAntfu: () => import_eslint_plugin_antfu.default,
|
|
103
104
|
pluginComments: () => import_eslint_plugin_eslint_comments.default,
|
|
105
|
+
pluginEsX: () => import_eslint_plugin_es_x.default,
|
|
104
106
|
pluginFormat: () => import_eslint_plugin_format.default,
|
|
105
107
|
pluginGitHubAction: () => import_eslint_plugin_github_action.default,
|
|
106
108
|
pluginImportX: () => import_eslint_plugin_import_x.default,
|
|
@@ -110,6 +112,7 @@ __export(src_exports, {
|
|
|
110
112
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
111
113
|
pluginNtnyq: () => import_eslint_plugin_ntnyq.default,
|
|
112
114
|
pluginPerfectionist: () => import_eslint_plugin_perfectionist.default,
|
|
115
|
+
pluginPinia: () => import_eslint_plugin_pinia.default,
|
|
113
116
|
pluginPrettier: () => import_eslint_plugin_prettier.default,
|
|
114
117
|
pluginRegexp: () => pluginRegexp,
|
|
115
118
|
pluginStylistic: () => import_eslint_plugin3.default,
|
|
@@ -181,8 +184,10 @@ var parserPlain = {
|
|
|
181
184
|
var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
|
|
182
185
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
183
186
|
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
187
|
+
var import_eslint_plugin_es_x = __toESM(require("eslint-plugin-es-x"), 1);
|
|
184
188
|
var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
|
|
185
189
|
var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
|
|
190
|
+
var import_eslint_plugin_pinia = __toESM(require("eslint-plugin-pinia"), 1);
|
|
186
191
|
var import_eslint_plugin_ntnyq = __toESM(require("eslint-plugin-ntnyq"), 1);
|
|
187
192
|
var import_markdown = __toESM(require("@eslint/markdown"), 1);
|
|
188
193
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
@@ -253,6 +258,7 @@ var GLOB_ALL_SRC = [
|
|
|
253
258
|
GLOB_HTML,
|
|
254
259
|
GLOB_MARKDOWN
|
|
255
260
|
];
|
|
261
|
+
var GLOB_PINIA_STORE = `**/store?(s)/*.${GLOB_SRC_EXT}`;
|
|
256
262
|
var GLOB_GITHUB_ACTION = "**/.github/workflows/*.y?(a)ml";
|
|
257
263
|
var GLOB_NODE_MODULES = "**/node_modules/**";
|
|
258
264
|
var GLOB_DIST = "**/dist/**";
|
|
@@ -405,7 +411,7 @@ var unCategorizedRules = {
|
|
|
405
411
|
"vue/next-tick-style": ["error", "promise"],
|
|
406
412
|
"vue/v-for-delimiter-style": ["error", "in"],
|
|
407
413
|
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
408
|
-
"vue/slot-name-casing": ["error", "
|
|
414
|
+
"vue/slot-name-casing": ["error", "kebab-case"],
|
|
409
415
|
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
410
416
|
"vue/define-props-declaration": ["error", "type-based"],
|
|
411
417
|
"vue/define-emits-declaration": ["error", "type-literal"],
|
|
@@ -684,6 +690,20 @@ var yml = (options = {}) => [
|
|
|
684
690
|
}
|
|
685
691
|
];
|
|
686
692
|
|
|
693
|
+
// src/configs/esX.ts
|
|
694
|
+
var esX = (options = {}) => [
|
|
695
|
+
{
|
|
696
|
+
name: "ntnyq/es-x",
|
|
697
|
+
plugins: {
|
|
698
|
+
"es-x": import_eslint_plugin_es_x.default
|
|
699
|
+
},
|
|
700
|
+
rules: {
|
|
701
|
+
// Overrides rules
|
|
702
|
+
...options.overrides
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
];
|
|
706
|
+
|
|
687
707
|
// src/configs/node.ts
|
|
688
708
|
var node = (options = {}) => [
|
|
689
709
|
{
|
|
@@ -1405,6 +1425,37 @@ var jsonc = (options = {}) => [
|
|
|
1405
1425
|
}
|
|
1406
1426
|
];
|
|
1407
1427
|
|
|
1428
|
+
// src/configs/pinia.ts
|
|
1429
|
+
var pinia = (options = {}) => {
|
|
1430
|
+
const { files = [GLOB_PINIA_STORE] } = options;
|
|
1431
|
+
return [
|
|
1432
|
+
{
|
|
1433
|
+
name: "ntnyq/pinia",
|
|
1434
|
+
files,
|
|
1435
|
+
plugins: {
|
|
1436
|
+
pinia: import_eslint_plugin_pinia.default
|
|
1437
|
+
},
|
|
1438
|
+
rules: {
|
|
1439
|
+
"pinia/prefer-single-store-per-file": "error",
|
|
1440
|
+
"pinia/no-duplicate-store-ids": "error",
|
|
1441
|
+
"pinia/no-return-global-properties": "error",
|
|
1442
|
+
"pinia/no-store-to-refs-in-store": "error",
|
|
1443
|
+
"pinia/never-export-initialized-store": "error",
|
|
1444
|
+
"pinia/require-setup-store-properties-export": "error",
|
|
1445
|
+
"pinia/prefer-use-store-naming-convention": [
|
|
1446
|
+
"error",
|
|
1447
|
+
{
|
|
1448
|
+
checkStoreNameMismatch: true,
|
|
1449
|
+
storeSuffix: "Store"
|
|
1450
|
+
}
|
|
1451
|
+
],
|
|
1452
|
+
// Overrides rules
|
|
1453
|
+
...options.overrides
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
];
|
|
1457
|
+
};
|
|
1458
|
+
|
|
1408
1459
|
// src/configs/ntnyq.ts
|
|
1409
1460
|
var ntnyq = (options = {}) => [
|
|
1410
1461
|
{
|
|
@@ -1426,7 +1477,7 @@ var regexp = (options = {}) => {
|
|
|
1426
1477
|
const recommendedRules2 = {
|
|
1427
1478
|
...recommendedConfig.rules
|
|
1428
1479
|
};
|
|
1429
|
-
if (options.level === "warn") {
|
|
1480
|
+
if (options.severity || options.level === "warn") {
|
|
1430
1481
|
for (const key in recommendedRules2) {
|
|
1431
1482
|
if (recommendedRules2[key] === "error") {
|
|
1432
1483
|
recommendedRules2[key] = "warn";
|
|
@@ -1520,6 +1571,7 @@ var hasVitest = (0, import_local_pkg.isPackageExists)("vitest");
|
|
|
1520
1571
|
var hasVue = (0, import_local_pkg.isPackageExists)("vue") || (0, import_local_pkg.isPackageExists)("nuxt") || (0, import_local_pkg.isPackageExists)("vitepress") || (0, import_local_pkg.isPackageExists)("@slidev/cli") || (0, import_local_pkg.isPackageExists)("vue", {
|
|
1521
1572
|
paths: [(0, import_node_path.resolve)(import_node_process.default.cwd(), "playground")]
|
|
1522
1573
|
});
|
|
1574
|
+
var hasPinia = (0, import_local_pkg.isPackageExists)("pinia");
|
|
1523
1575
|
var hasUnoCSS = (0, import_local_pkg.isPackageExists)("unocss") || (0, import_local_pkg.isPackageExists)("@unocss/postcss") || (0, import_local_pkg.isPackageExists)("@unocss/webpack") || (0, import_local_pkg.isPackageExists)("@unocss/nuxt");
|
|
1524
1576
|
|
|
1525
1577
|
// src/utils/toArray.ts
|
|
@@ -2005,7 +2057,7 @@ var prettier = (options = {}) => {
|
|
|
2005
2057
|
"vue/space-unary-ops": "off",
|
|
2006
2058
|
"vue/template-curly-spacing": "off",
|
|
2007
2059
|
...import_eslint_plugin_prettier.default.configs.recommended.rules,
|
|
2008
|
-
"prettier/prettier": options.level || "warn",
|
|
2060
|
+
"prettier/prettier": options.severity || options.level || "warn",
|
|
2009
2061
|
// Overrides rules
|
|
2010
2062
|
...options.overrides
|
|
2011
2063
|
}
|
|
@@ -2512,7 +2564,7 @@ var githubAction = (options = {}) => {
|
|
|
2512
2564
|
};
|
|
2513
2565
|
|
|
2514
2566
|
// src/configs/perfectionist.ts
|
|
2515
|
-
var
|
|
2567
|
+
var sharedGroupsForInterfaceOrObjectTypes = [
|
|
2516
2568
|
"required-property",
|
|
2517
2569
|
"optional-property",
|
|
2518
2570
|
"required-method",
|
|
@@ -2525,9 +2577,7 @@ var sharedGroups = [
|
|
|
2525
2577
|
"index-signature",
|
|
2526
2578
|
"multiline-index-signature"
|
|
2527
2579
|
];
|
|
2528
|
-
var
|
|
2529
|
-
var defaultSortObjectTypesGroups = [...sharedGroups];
|
|
2530
|
-
var defaultSortIntersectionTypesGroups = [
|
|
2580
|
+
var sharedGroupsForIntersectionOrUnion = [
|
|
2531
2581
|
/**
|
|
2532
2582
|
* eg. 'foobar', 24, false
|
|
2533
2583
|
*/
|
|
@@ -2577,6 +2627,10 @@ var defaultSortIntersectionTypesGroups = [
|
|
|
2577
2627
|
*/
|
|
2578
2628
|
"nullish"
|
|
2579
2629
|
];
|
|
2630
|
+
var defaultSortInterfacesGroups = [...sharedGroupsForInterfaceOrObjectTypes];
|
|
2631
|
+
var defaultSortObjectTypesGroups = [...sharedGroupsForInterfaceOrObjectTypes];
|
|
2632
|
+
var defaultSortIntersectionTypesGroups = [...sharedGroupsForIntersectionOrUnion];
|
|
2633
|
+
var defaultSortUnionTypesGroups = [...sharedGroupsForIntersectionOrUnion];
|
|
2580
2634
|
var perfectionist = (options = {}) => {
|
|
2581
2635
|
const {
|
|
2582
2636
|
sortEnums: enableSortEnums = true,
|
|
@@ -2726,7 +2780,7 @@ var perfectionist = (options = {}) => {
|
|
|
2726
2780
|
type: "alphabetical",
|
|
2727
2781
|
order: "asc",
|
|
2728
2782
|
partitionByComment: true,
|
|
2729
|
-
groups:
|
|
2783
|
+
groups: defaultSortIntersectionTypesGroups
|
|
2730
2784
|
}
|
|
2731
2785
|
],
|
|
2732
2786
|
"perfectionist/sort-modules": [
|
|
@@ -2743,7 +2797,7 @@ var perfectionist = (options = {}) => {
|
|
|
2743
2797
|
type: "alphabetical",
|
|
2744
2798
|
order: "asc",
|
|
2745
2799
|
partitionByComment: true,
|
|
2746
|
-
groups:
|
|
2800
|
+
groups: defaultSortObjectTypesGroups
|
|
2747
2801
|
}
|
|
2748
2802
|
],
|
|
2749
2803
|
"perfectionist/sort-union-types": [
|
|
@@ -2751,7 +2805,8 @@ var perfectionist = (options = {}) => {
|
|
|
2751
2805
|
{
|
|
2752
2806
|
type: "alphabetical",
|
|
2753
2807
|
order: "asc",
|
|
2754
|
-
partitionByComment: true
|
|
2808
|
+
partitionByComment: true,
|
|
2809
|
+
groups: defaultSortUnionTypesGroups
|
|
2755
2810
|
}
|
|
2756
2811
|
],
|
|
2757
2812
|
// Overrides rules
|
|
@@ -2847,6 +2902,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2847
2902
|
* Conditional by deps
|
|
2848
2903
|
*/
|
|
2849
2904
|
vue: enableVue = hasVue,
|
|
2905
|
+
pinia: enablePinia = hasPinia,
|
|
2850
2906
|
test: enableTest = hasVitest,
|
|
2851
2907
|
unocss: enableUnoCSS = hasUnoCSS,
|
|
2852
2908
|
typescript: enableTypeScript = hasTypeScript,
|
|
@@ -2917,6 +2973,14 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2917
2973
|
})
|
|
2918
2974
|
);
|
|
2919
2975
|
}
|
|
2976
|
+
if (enablePinia) {
|
|
2977
|
+
configs2.push(
|
|
2978
|
+
...pinia({
|
|
2979
|
+
...resolveSubOptions(options, "pinia"),
|
|
2980
|
+
overrides: getOverrides(options, "pinia")
|
|
2981
|
+
})
|
|
2982
|
+
);
|
|
2983
|
+
}
|
|
2920
2984
|
if (enableRegexp) {
|
|
2921
2985
|
configs2.push(
|
|
2922
2986
|
...regexp({
|
|
@@ -3055,6 +3119,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
3055
3119
|
GLOB_MARKDOWN_CODE,
|
|
3056
3120
|
GLOB_MARKDOWN_NESTED,
|
|
3057
3121
|
GLOB_NODE_MODULES,
|
|
3122
|
+
GLOB_PINIA_STORE,
|
|
3058
3123
|
GLOB_POSTCSS,
|
|
3059
3124
|
GLOB_SCSS,
|
|
3060
3125
|
GLOB_SRC,
|
|
@@ -3071,14 +3136,13 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
3071
3136
|
antfu,
|
|
3072
3137
|
command,
|
|
3073
3138
|
comments,
|
|
3074
|
-
defaultSortInterfacesGroups,
|
|
3075
|
-
defaultSortIntersectionTypesGroups,
|
|
3076
|
-
defaultSortObjectTypesGroups,
|
|
3077
3139
|
defineESLintConfig,
|
|
3140
|
+
esX,
|
|
3078
3141
|
format,
|
|
3079
3142
|
getOverrides,
|
|
3080
3143
|
githubAction,
|
|
3081
3144
|
gitignore,
|
|
3145
|
+
hasPinia,
|
|
3082
3146
|
hasTypeScript,
|
|
3083
3147
|
hasUnoCSS,
|
|
3084
3148
|
hasVitest,
|
|
@@ -3103,8 +3167,10 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
3103
3167
|
parserVue,
|
|
3104
3168
|
parserYaml,
|
|
3105
3169
|
perfectionist,
|
|
3170
|
+
pinia,
|
|
3106
3171
|
pluginAntfu,
|
|
3107
3172
|
pluginComments,
|
|
3173
|
+
pluginEsX,
|
|
3108
3174
|
pluginFormat,
|
|
3109
3175
|
pluginGitHubAction,
|
|
3110
3176
|
pluginImportX,
|
|
@@ -3114,6 +3180,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
3114
3180
|
pluginNode,
|
|
3115
3181
|
pluginNtnyq,
|
|
3116
3182
|
pluginPerfectionist,
|
|
3183
|
+
pluginPinia,
|
|
3117
3184
|
pluginPrettier,
|
|
3118
3185
|
pluginRegexp,
|
|
3119
3186
|
pluginStylistic,
|