@ntnyq/eslint-config 2.3.0 → 2.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 +1 -1
- package/dist/index.cjs +72 -14
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +69 -14
- package/package.json +13 -8
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -52,6 +52,7 @@ __export(src_exports, {
|
|
|
52
52
|
GLOB_TSX: () => GLOB_TSX,
|
|
53
53
|
GLOB_VUE: () => GLOB_VUE,
|
|
54
54
|
GLOB_YAML: () => GLOB_YAML,
|
|
55
|
+
command: () => command,
|
|
55
56
|
comments: () => comments,
|
|
56
57
|
defineConfig: () => defineConfig,
|
|
57
58
|
getVueVersion: () => getVueVersion,
|
|
@@ -78,6 +79,7 @@ __export(src_exports, {
|
|
|
78
79
|
pluginMarkdown: () => import_eslint_plugin_markdown.default,
|
|
79
80
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
80
81
|
pluginPrettier: () => import_eslint_plugin_prettier.default,
|
|
82
|
+
pluginRegexp: () => pluginRegexp,
|
|
81
83
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
82
84
|
pluginUnoCSS: () => import_eslint_plugin.default,
|
|
83
85
|
pluginVue: () => import_eslint_plugin_vue.default,
|
|
@@ -89,6 +91,7 @@ __export(src_exports, {
|
|
|
89
91
|
presetJsonc: () => presetJsonc,
|
|
90
92
|
presetLanguageExtensions: () => presetLanguageExtensions,
|
|
91
93
|
prettier: () => prettier,
|
|
94
|
+
regexp: () => regexp,
|
|
92
95
|
sortPackageJson: () => sortPackageJson,
|
|
93
96
|
sortTsConfig: () => sortTsConfig,
|
|
94
97
|
tseslint: () => import_typescript_eslint.default,
|
|
@@ -102,10 +105,16 @@ __export(src_exports, {
|
|
|
102
105
|
module.exports = __toCommonJS(src_exports);
|
|
103
106
|
|
|
104
107
|
// src/env.ts
|
|
108
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
109
|
+
var import_node_path = require("path");
|
|
105
110
|
var import_local_pkg = require("local-pkg");
|
|
106
111
|
var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
|
|
107
|
-
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")
|
|
108
|
-
|
|
112
|
+
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", {
|
|
113
|
+
paths: [(0, import_node_path.resolve)(import_node_process.default.cwd(), "playground")]
|
|
114
|
+
});
|
|
115
|
+
var hasUnoCSS = (0, import_local_pkg.isPackageExists)("unocss") || (0, import_local_pkg.isPackageExists)("unocss", {
|
|
116
|
+
paths: [(0, import_node_path.resolve)(import_node_process.default.cwd(), "playground")]
|
|
117
|
+
}) || (0, import_local_pkg.isPackageExists)("@unocss/postcss") || (0, import_local_pkg.isPackageExists)("@unocss/webpack") || (0, import_local_pkg.isPackageExists)("@unocss/nuxt");
|
|
109
118
|
|
|
110
119
|
// src/types.ts
|
|
111
120
|
function defineConfig(configs = []) {
|
|
@@ -192,6 +201,7 @@ var GLOB_EXCLUDE = [
|
|
|
192
201
|
// src/configs/ignores.ts
|
|
193
202
|
var ignores = defineConfig([
|
|
194
203
|
{
|
|
204
|
+
name: "ntnyq/ignores",
|
|
195
205
|
ignores: GLOB_EXCLUDE
|
|
196
206
|
}
|
|
197
207
|
]);
|
|
@@ -208,6 +218,7 @@ var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
|
|
|
208
218
|
var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
209
219
|
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
210
220
|
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
221
|
+
var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
|
|
211
222
|
var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
|
|
212
223
|
var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
|
|
213
224
|
var parserVue = __toESM(require("vue-eslint-parser"), 1);
|
|
@@ -220,6 +231,7 @@ function interopDefault(m) {
|
|
|
220
231
|
// src/configs/node.ts
|
|
221
232
|
var node = defineConfig([
|
|
222
233
|
{
|
|
234
|
+
name: "ntnyq/node",
|
|
223
235
|
plugins: {
|
|
224
236
|
node: import_eslint_plugin_n.default
|
|
225
237
|
},
|
|
@@ -239,6 +251,7 @@ var node = defineConfig([
|
|
|
239
251
|
// src/configs/jsdoc.ts
|
|
240
252
|
var jsdoc = defineConfig([
|
|
241
253
|
{
|
|
254
|
+
name: "ntnyq/jsdoc",
|
|
242
255
|
plugins: {
|
|
243
256
|
jsdoc: import_eslint_plugin_jsdoc.default
|
|
244
257
|
},
|
|
@@ -267,6 +280,7 @@ var jsdoc = defineConfig([
|
|
|
267
280
|
// src/configs/imports.ts
|
|
268
281
|
var imports = defineConfig([
|
|
269
282
|
{
|
|
283
|
+
name: "ntnyq/imports",
|
|
270
284
|
plugins: {
|
|
271
285
|
import: import_eslint_plugin_import_x.default
|
|
272
286
|
},
|
|
@@ -309,11 +323,15 @@ var imports = defineConfig([
|
|
|
309
323
|
// src/configs/unicorn.ts
|
|
310
324
|
var unicorn = defineConfig([
|
|
311
325
|
{
|
|
326
|
+
name: "ntnyq/unicorn",
|
|
312
327
|
plugins: {
|
|
313
328
|
unicorn: import_eslint_plugin_unicorn.default
|
|
314
329
|
},
|
|
315
330
|
rules: {
|
|
316
|
-
|
|
331
|
+
// Disabled for now
|
|
332
|
+
"unicorn/prefer-top-level-await": "off",
|
|
333
|
+
"unicorn/explicit-length-check": "off",
|
|
334
|
+
"unicorn/no-array-callback-reference": "off",
|
|
317
335
|
"unicorn/error-message": "error",
|
|
318
336
|
"unicorn/escape-case": "error",
|
|
319
337
|
"unicorn/no-new-buffer": "error",
|
|
@@ -327,12 +345,10 @@ var unicorn = defineConfig([
|
|
|
327
345
|
"unicorn/prefer-set-size": "error",
|
|
328
346
|
"unicorn/better-regex": "error",
|
|
329
347
|
"unicorn/prefer-regexp-test": "error",
|
|
330
|
-
"unicorn/prefer-top-level-await": "error",
|
|
331
348
|
"unicorn/no-static-only-class": "error",
|
|
332
349
|
"unicorn/no-zero-fractions": "error",
|
|
333
350
|
"unicorn/custom-error-definition": "error",
|
|
334
351
|
"unicorn/prefer-modern-math-apis": "error",
|
|
335
|
-
"unicorn/explicit-length-check": "error",
|
|
336
352
|
"unicorn/new-for-builtins": "error",
|
|
337
353
|
"unicorn/no-console-spaces": "error",
|
|
338
354
|
"unicorn/no-for-loop": "error",
|
|
@@ -371,7 +387,6 @@ var unicorn = defineConfig([
|
|
|
371
387
|
"unicorn/no-new-array": "error",
|
|
372
388
|
"unicorn/no-instanceof-array": "error",
|
|
373
389
|
"unicorn/no-array-push-push": "error",
|
|
374
|
-
"unicorn/no-array-callback-reference": "error",
|
|
375
390
|
"unicorn/no-array-method-this-argument": "error",
|
|
376
391
|
"unicorn/prefer-array-find": "error",
|
|
377
392
|
"unicorn/prefer-array-some": "error",
|
|
@@ -385,6 +400,7 @@ var unicorn = defineConfig([
|
|
|
385
400
|
var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
|
|
386
401
|
var prettier = defineConfig([
|
|
387
402
|
{
|
|
403
|
+
name: "ntnyq/prettier",
|
|
388
404
|
plugins: {
|
|
389
405
|
prettier: import_eslint_plugin_prettier.default
|
|
390
406
|
},
|
|
@@ -399,6 +415,7 @@ var prettier = defineConfig([
|
|
|
399
415
|
// src/configs/comments.ts
|
|
400
416
|
var comments = defineConfig([
|
|
401
417
|
{
|
|
418
|
+
name: "ntnyq/eslint-comments",
|
|
402
419
|
plugins: {
|
|
403
420
|
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
404
421
|
},
|
|
@@ -413,8 +430,12 @@ var comments = defineConfig([
|
|
|
413
430
|
var import_globals = __toESM(require("globals"), 1);
|
|
414
431
|
var import_js = __toESM(require("@eslint/js"), 1);
|
|
415
432
|
var javascript = defineConfig([
|
|
416
|
-
import_js.default.configs.recommended,
|
|
417
433
|
{
|
|
434
|
+
name: "ntnyq/js/recommended",
|
|
435
|
+
...import_js.default.configs.recommended
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
name: "ntnyq/js/core",
|
|
418
439
|
languageOptions: {
|
|
419
440
|
globals: {
|
|
420
441
|
...import_globals.default.browser,
|
|
@@ -609,7 +630,6 @@ var javascript = defineConfig([
|
|
|
609
630
|
semi: ["error", "never"],
|
|
610
631
|
"semi-spacing": ["error", { before: false, after: true }],
|
|
611
632
|
"space-before-blocks": ["error", "always"],
|
|
612
|
-
"space-before-function-paren": ["error", "never"],
|
|
613
633
|
"space-in-parens": ["error", "never"],
|
|
614
634
|
"space-infix-ops": "error",
|
|
615
635
|
"space-unary-ops": ["error", { words: true, nonwords: false }],
|
|
@@ -625,7 +645,6 @@ var javascript = defineConfig([
|
|
|
625
645
|
],
|
|
626
646
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
627
647
|
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
628
|
-
"yield-star-spacing": ["error", "both"],
|
|
629
648
|
yoda: ["error", "never"],
|
|
630
649
|
// es6+
|
|
631
650
|
"no-var": "error",
|
|
@@ -761,12 +780,14 @@ var javascript = defineConfig([
|
|
|
761
780
|
}
|
|
762
781
|
},
|
|
763
782
|
{
|
|
783
|
+
name: "ntnyq/js/script",
|
|
764
784
|
files: ["**/scripts/*", "**/cli.*"],
|
|
765
785
|
rules: {
|
|
766
786
|
"no-console": "off"
|
|
767
787
|
}
|
|
768
788
|
},
|
|
769
789
|
{
|
|
790
|
+
name: "ntnyq/js/test",
|
|
770
791
|
files: ["**/*.{test,spec}.js?(x)"],
|
|
771
792
|
rules: {
|
|
772
793
|
"no-unused-expressions": "off",
|
|
@@ -776,6 +797,7 @@ var javascript = defineConfig([
|
|
|
776
797
|
]);
|
|
777
798
|
var jsx = defineConfig([
|
|
778
799
|
{
|
|
800
|
+
name: "ntnyq/jsx",
|
|
779
801
|
files: ["**/*.jsx"],
|
|
780
802
|
languageOptions: {
|
|
781
803
|
parserOptions: {
|
|
@@ -789,6 +811,7 @@ var jsx = defineConfig([
|
|
|
789
811
|
|
|
790
812
|
// src/configs/typescript.ts
|
|
791
813
|
var typescriptCore = import_typescript_eslint.default.config({
|
|
814
|
+
name: "ntnyq/ts/core",
|
|
792
815
|
extends: [...import_typescript_eslint.default.configs.recommended],
|
|
793
816
|
files: [GLOB_TS, GLOB_TSX],
|
|
794
817
|
languageOptions: {
|
|
@@ -835,7 +858,6 @@ var typescriptCore = import_typescript_eslint.default.config({
|
|
|
835
858
|
"@typescript-eslint/no-explicit-any": "off",
|
|
836
859
|
"@typescript-eslint/no-empty-function": "off",
|
|
837
860
|
"@typescript-eslint/naming-convention": "off",
|
|
838
|
-
"@typescript-eslint/no-empty-interface": "off",
|
|
839
861
|
"@typescript-eslint/no-empty-object-type": "off",
|
|
840
862
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
841
863
|
"@typescript-eslint/triple-slash-reference": "off",
|
|
@@ -849,6 +871,7 @@ var typescriptCore = import_typescript_eslint.default.config({
|
|
|
849
871
|
var typescript = defineConfig([
|
|
850
872
|
...typescriptCore,
|
|
851
873
|
{
|
|
874
|
+
name: "ntnyq/ts/dts",
|
|
852
875
|
files: ["**/*.d.ts"],
|
|
853
876
|
rules: {
|
|
854
877
|
"import/no-duplicates": "off",
|
|
@@ -856,6 +879,7 @@ var typescript = defineConfig([
|
|
|
856
879
|
}
|
|
857
880
|
},
|
|
858
881
|
{
|
|
882
|
+
name: "ntnyq/ts/test",
|
|
859
883
|
files: ["**/*.{spec,test}.ts?(x)"],
|
|
860
884
|
rules: {
|
|
861
885
|
"no-unused-expressions": "off",
|
|
@@ -863,6 +887,7 @@ var typescript = defineConfig([
|
|
|
863
887
|
}
|
|
864
888
|
},
|
|
865
889
|
{
|
|
890
|
+
name: "ntnyq/ts/cjs",
|
|
866
891
|
files: [GLOB_JS, "**/*.cjs"],
|
|
867
892
|
rules: {
|
|
868
893
|
"@typescript-eslint/no-var-requires": "off"
|
|
@@ -870,9 +895,21 @@ var typescript = defineConfig([
|
|
|
870
895
|
}
|
|
871
896
|
]);
|
|
872
897
|
|
|
898
|
+
// src/configs/regexp.ts
|
|
899
|
+
var regexp = defineConfig([
|
|
900
|
+
/**
|
|
901
|
+
* https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/rules/recommended.ts
|
|
902
|
+
*/
|
|
903
|
+
{
|
|
904
|
+
name: "ntnyq/regexp",
|
|
905
|
+
...pluginRegexp.configs["flat/recommended"]
|
|
906
|
+
}
|
|
907
|
+
]);
|
|
908
|
+
|
|
873
909
|
// src/configs/unocss.ts
|
|
874
910
|
var unocss = defineConfig([
|
|
875
911
|
{
|
|
912
|
+
name: "ntnyq/unocss",
|
|
876
913
|
plugins: {
|
|
877
914
|
unocss: import_eslint_plugin.default
|
|
878
915
|
},
|
|
@@ -884,9 +921,14 @@ var unocss = defineConfig([
|
|
|
884
921
|
}
|
|
885
922
|
]);
|
|
886
923
|
|
|
924
|
+
// src/configs/command.ts
|
|
925
|
+
var import_config = __toESM(require("eslint-plugin-command/config"), 1);
|
|
926
|
+
var command = defineConfig([(0, import_config.default)({})]);
|
|
927
|
+
|
|
887
928
|
// src/configs/yml.ts
|
|
888
929
|
var yml = defineConfig([
|
|
889
930
|
{
|
|
931
|
+
name: "ntnyq/yaml",
|
|
890
932
|
files: [GLOB_YAML],
|
|
891
933
|
languageOptions: {
|
|
892
934
|
parser: parserYaml
|
|
@@ -906,6 +948,7 @@ var yml = defineConfig([
|
|
|
906
948
|
// src/configs/sort.ts
|
|
907
949
|
var sortPackageJson = defineConfig([
|
|
908
950
|
{
|
|
951
|
+
name: "ntnyq/sort/package-json",
|
|
909
952
|
files: ["**/package.json"],
|
|
910
953
|
rules: {
|
|
911
954
|
"jsonc/sort-keys": [
|
|
@@ -1004,6 +1047,7 @@ var sortPackageJson = defineConfig([
|
|
|
1004
1047
|
]);
|
|
1005
1048
|
var sortTsConfig = defineConfig([
|
|
1006
1049
|
{
|
|
1050
|
+
name: "ntnyq/sort/tsconfig",
|
|
1007
1051
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
1008
1052
|
rules: {
|
|
1009
1053
|
"jsonc/sort-keys": [
|
|
@@ -1121,6 +1165,7 @@ var sortTsConfig = defineConfig([
|
|
|
1121
1165
|
// src/configs/jsonc.ts
|
|
1122
1166
|
var jsonc = defineConfig([
|
|
1123
1167
|
{
|
|
1168
|
+
name: "ntnyq/jsonc",
|
|
1124
1169
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
|
|
1125
1170
|
plugins: {
|
|
1126
1171
|
jsonc: import_eslint_plugin_jsonc.default
|
|
@@ -1162,8 +1207,11 @@ var jsonc = defineConfig([
|
|
|
1162
1207
|
|
|
1163
1208
|
// src/configs/markdown.ts
|
|
1164
1209
|
var markdown = defineConfig([
|
|
1210
|
+
// TODO: Add config name for markdown plugin
|
|
1211
|
+
// wait for https://github.com/eslint/eslint-plugin-markdown/pull/256
|
|
1165
1212
|
...import_eslint_plugin_markdown.default.configs.recommended,
|
|
1166
1213
|
{
|
|
1214
|
+
name: "ntnyq/markdown/extensions",
|
|
1167
1215
|
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
1168
1216
|
rules: {
|
|
1169
1217
|
"no-undef": "off",
|
|
@@ -1189,10 +1237,10 @@ var markdown = defineConfig([
|
|
|
1189
1237
|
]);
|
|
1190
1238
|
|
|
1191
1239
|
// src/configs/vue.ts
|
|
1192
|
-
var
|
|
1240
|
+
var import_node_process2 = __toESM(require("process"), 1);
|
|
1193
1241
|
var import_local_pkg2 = require("local-pkg");
|
|
1194
1242
|
function getVueVersion() {
|
|
1195
|
-
const pkg = (0, import_local_pkg2.getPackageInfoSync)("vue", { paths: [
|
|
1243
|
+
const pkg = (0, import_local_pkg2.getPackageInfoSync)("vue", { paths: [import_node_process2.default.cwd()] });
|
|
1196
1244
|
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
1197
1245
|
return +pkg.version[0];
|
|
1198
1246
|
}
|
|
@@ -1213,10 +1261,12 @@ var vue3Rules = {
|
|
|
1213
1261
|
};
|
|
1214
1262
|
var vue = defineConfig([
|
|
1215
1263
|
...import_typescript_eslint.default.config({
|
|
1264
|
+
name: "ntnyq/vue/ts",
|
|
1216
1265
|
files: [GLOB_VUE],
|
|
1217
1266
|
extends: typescriptCore
|
|
1218
1267
|
}),
|
|
1219
1268
|
{
|
|
1269
|
+
name: "ntnyq/vue/core",
|
|
1220
1270
|
files: [GLOB_VUE],
|
|
1221
1271
|
plugins: {
|
|
1222
1272
|
vue: import_eslint_plugin_vue.default,
|
|
@@ -1461,7 +1511,8 @@ var presetJavaScript = [
|
|
|
1461
1511
|
...imports,
|
|
1462
1512
|
...unicorn,
|
|
1463
1513
|
...comments,
|
|
1464
|
-
...javascript
|
|
1514
|
+
...javascript,
|
|
1515
|
+
...regexp
|
|
1465
1516
|
];
|
|
1466
1517
|
var presetBasic = [...presetJavaScript, ...typescript];
|
|
1467
1518
|
var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsConfig];
|
|
@@ -1472,7 +1523,8 @@ function ntnyq(config = [], {
|
|
|
1472
1523
|
vue: enableVue = hasVue,
|
|
1473
1524
|
unocss: enableUnoCSS = hasUnoCSS,
|
|
1474
1525
|
prettier: enablePrettier = true,
|
|
1475
|
-
markdown: enableMarkdown = true
|
|
1526
|
+
markdown: enableMarkdown = true,
|
|
1527
|
+
command: enableCommand = true
|
|
1476
1528
|
} = {}) {
|
|
1477
1529
|
const configs = defineConfig([...presetBasic, ...yml, ...presetJsonc]);
|
|
1478
1530
|
if (enableVue) {
|
|
@@ -1487,6 +1539,9 @@ function ntnyq(config = [], {
|
|
|
1487
1539
|
if (enableMarkdown) {
|
|
1488
1540
|
configs.push(...markdown);
|
|
1489
1541
|
}
|
|
1542
|
+
if (enableCommand) {
|
|
1543
|
+
configs.push(...command);
|
|
1544
|
+
}
|
|
1490
1545
|
if (Object.keys(config).length > 0) {
|
|
1491
1546
|
configs.push(...Array.isArray(config) ? config : [config]);
|
|
1492
1547
|
}
|
|
@@ -1516,6 +1571,7 @@ function ntnyq(config = [], {
|
|
|
1516
1571
|
GLOB_TSX,
|
|
1517
1572
|
GLOB_VUE,
|
|
1518
1573
|
GLOB_YAML,
|
|
1574
|
+
command,
|
|
1519
1575
|
comments,
|
|
1520
1576
|
defineConfig,
|
|
1521
1577
|
getVueVersion,
|
|
@@ -1542,6 +1598,7 @@ function ntnyq(config = [], {
|
|
|
1542
1598
|
pluginMarkdown,
|
|
1543
1599
|
pluginNode,
|
|
1544
1600
|
pluginPrettier,
|
|
1601
|
+
pluginRegexp,
|
|
1545
1602
|
pluginUnicorn,
|
|
1546
1603
|
pluginUnoCSS,
|
|
1547
1604
|
pluginVue,
|
|
@@ -1553,6 +1610,7 @@ function ntnyq(config = [], {
|
|
|
1553
1610
|
presetJsonc,
|
|
1554
1611
|
presetLanguageExtensions,
|
|
1555
1612
|
prettier,
|
|
1613
|
+
regexp,
|
|
1556
1614
|
sortPackageJson,
|
|
1557
1615
|
sortTsConfig,
|
|
1558
1616
|
tseslint,
|
package/dist/index.d.cts
CHANGED
|
@@ -10,6 +10,8 @@ export { default as pluginYaml } from 'eslint-plugin-yml';
|
|
|
10
10
|
export { default as pluginJsonc } from 'eslint-plugin-jsonc';
|
|
11
11
|
export { default as pluginImport } from 'eslint-plugin-import-x';
|
|
12
12
|
export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
|
|
13
|
+
import * as eslintPluginRegexp from 'eslint-plugin-regexp';
|
|
14
|
+
export { eslintPluginRegexp as pluginRegexp };
|
|
13
15
|
import * as yamlEslintParser from 'yaml-eslint-parser';
|
|
14
16
|
export { yamlEslintParser as parserYaml };
|
|
15
17
|
import * as vueEslintParser from 'vue-eslint-parser';
|
|
@@ -101,11 +103,12 @@ declare const presetAll: FlatConfig[];
|
|
|
101
103
|
/**
|
|
102
104
|
* Custom framework support
|
|
103
105
|
*/
|
|
104
|
-
declare function ntnyq(config?: FlatConfig | FlatConfig[], { vue: enableVue, unocss: enableUnoCSS, prettier: enablePrettier, markdown: enableMarkdown, }?: {
|
|
106
|
+
declare function ntnyq(config?: FlatConfig | FlatConfig[], { vue: enableVue, unocss: enableUnoCSS, prettier: enablePrettier, markdown: enableMarkdown, command: enableCommand, }?: {
|
|
105
107
|
vue?: boolean | undefined;
|
|
106
108
|
unocss?: boolean | undefined;
|
|
107
109
|
prettier?: boolean | undefined;
|
|
108
110
|
markdown?: boolean | undefined;
|
|
111
|
+
command?: boolean | undefined;
|
|
109
112
|
}): FlatConfig[];
|
|
110
113
|
|
|
111
114
|
/**
|
|
@@ -131,8 +134,12 @@ declare const jsx: FlatConfig[];
|
|
|
131
134
|
declare const typescriptCore: FlatConfig[];
|
|
132
135
|
declare const typescript: FlatConfig[];
|
|
133
136
|
|
|
137
|
+
declare const regexp: FlatConfig[];
|
|
138
|
+
|
|
134
139
|
declare const unocss: FlatConfig[];
|
|
135
140
|
|
|
141
|
+
declare const command: FlatConfig[];
|
|
142
|
+
|
|
136
143
|
declare const yml: FlatConfig[];
|
|
137
144
|
|
|
138
145
|
declare const sortPackageJson: FlatConfig[];
|
|
@@ -153,4 +160,4 @@ type InteropDefault<T> = T extends {
|
|
|
153
160
|
} ? U : T;
|
|
154
161
|
declare function interopDefault<T>(m: T): InteropDefault<T>;
|
|
155
162
|
|
|
156
|
-
export { type ESLintPlugin, type FlatConfig, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropDefault, type RuleRecord, type RuleRecordEntry, comments, defineConfig, getVueVersion, hasTypeScript, hasUnoCSS, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, markdown, node, ntnyq, presetAll, presetBasic, presetCommon, presetJavaScript, presetJsonc, presetLanguageExtensions, prettier, sortPackageJson, sortTsConfig, typescript, typescriptCore, unicorn, unocss, vue, yml };
|
|
163
|
+
export { type ESLintPlugin, type FlatConfig, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropDefault, type RuleRecord, type RuleRecordEntry, command, comments, defineConfig, getVueVersion, hasTypeScript, hasUnoCSS, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, markdown, node, ntnyq, presetAll, presetBasic, presetCommon, presetJavaScript, presetJsonc, presetLanguageExtensions, prettier, regexp, sortPackageJson, sortTsConfig, typescript, typescriptCore, unicorn, unocss, vue, yml };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export { default as pluginYaml } from 'eslint-plugin-yml';
|
|
|
10
10
|
export { default as pluginJsonc } from 'eslint-plugin-jsonc';
|
|
11
11
|
export { default as pluginImport } from 'eslint-plugin-import-x';
|
|
12
12
|
export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
|
|
13
|
+
import * as eslintPluginRegexp from 'eslint-plugin-regexp';
|
|
14
|
+
export { eslintPluginRegexp as pluginRegexp };
|
|
13
15
|
import * as yamlEslintParser from 'yaml-eslint-parser';
|
|
14
16
|
export { yamlEslintParser as parserYaml };
|
|
15
17
|
import * as vueEslintParser from 'vue-eslint-parser';
|
|
@@ -101,11 +103,12 @@ declare const presetAll: FlatConfig[];
|
|
|
101
103
|
/**
|
|
102
104
|
* Custom framework support
|
|
103
105
|
*/
|
|
104
|
-
declare function ntnyq(config?: FlatConfig | FlatConfig[], { vue: enableVue, unocss: enableUnoCSS, prettier: enablePrettier, markdown: enableMarkdown, }?: {
|
|
106
|
+
declare function ntnyq(config?: FlatConfig | FlatConfig[], { vue: enableVue, unocss: enableUnoCSS, prettier: enablePrettier, markdown: enableMarkdown, command: enableCommand, }?: {
|
|
105
107
|
vue?: boolean | undefined;
|
|
106
108
|
unocss?: boolean | undefined;
|
|
107
109
|
prettier?: boolean | undefined;
|
|
108
110
|
markdown?: boolean | undefined;
|
|
111
|
+
command?: boolean | undefined;
|
|
109
112
|
}): FlatConfig[];
|
|
110
113
|
|
|
111
114
|
/**
|
|
@@ -131,8 +134,12 @@ declare const jsx: FlatConfig[];
|
|
|
131
134
|
declare const typescriptCore: FlatConfig[];
|
|
132
135
|
declare const typescript: FlatConfig[];
|
|
133
136
|
|
|
137
|
+
declare const regexp: FlatConfig[];
|
|
138
|
+
|
|
134
139
|
declare const unocss: FlatConfig[];
|
|
135
140
|
|
|
141
|
+
declare const command: FlatConfig[];
|
|
142
|
+
|
|
136
143
|
declare const yml: FlatConfig[];
|
|
137
144
|
|
|
138
145
|
declare const sortPackageJson: FlatConfig[];
|
|
@@ -153,4 +160,4 @@ type InteropDefault<T> = T extends {
|
|
|
153
160
|
} ? U : T;
|
|
154
161
|
declare function interopDefault<T>(m: T): InteropDefault<T>;
|
|
155
162
|
|
|
156
|
-
export { type ESLintPlugin, type FlatConfig, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropDefault, type RuleRecord, type RuleRecordEntry, comments, defineConfig, getVueVersion, hasTypeScript, hasUnoCSS, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, markdown, node, ntnyq, presetAll, presetBasic, presetCommon, presetJavaScript, presetJsonc, presetLanguageExtensions, prettier, sortPackageJson, sortTsConfig, typescript, typescriptCore, unicorn, unocss, vue, yml };
|
|
163
|
+
export { type ESLintPlugin, type FlatConfig, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropDefault, type RuleRecord, type RuleRecordEntry, command, comments, defineConfig, getVueVersion, hasTypeScript, hasUnoCSS, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, markdown, node, ntnyq, presetAll, presetBasic, presetCommon, presetJavaScript, presetJsonc, presetLanguageExtensions, prettier, regexp, sortPackageJson, sortTsConfig, typescript, typescriptCore, unicorn, unocss, vue, yml };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
// src/env.ts
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import { resolve } from "node:path";
|
|
2
4
|
import { isPackageExists } from "local-pkg";
|
|
3
5
|
var hasTypeScript = isPackageExists("typescript");
|
|
4
|
-
var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli")
|
|
5
|
-
|
|
6
|
+
var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
|
|
7
|
+
paths: [resolve(process.cwd(), "playground")]
|
|
8
|
+
});
|
|
9
|
+
var hasUnoCSS = isPackageExists("unocss") || isPackageExists("unocss", {
|
|
10
|
+
paths: [resolve(process.cwd(), "playground")]
|
|
11
|
+
}) || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
|
|
6
12
|
|
|
7
13
|
// src/types.ts
|
|
8
14
|
function defineConfig(configs = []) {
|
|
@@ -89,6 +95,7 @@ var GLOB_EXCLUDE = [
|
|
|
89
95
|
// src/configs/ignores.ts
|
|
90
96
|
var ignores = defineConfig([
|
|
91
97
|
{
|
|
98
|
+
name: "ntnyq/ignores",
|
|
92
99
|
ignores: GLOB_EXCLUDE
|
|
93
100
|
}
|
|
94
101
|
]);
|
|
@@ -105,6 +112,7 @@ import { default as default9 } from "eslint-plugin-yml";
|
|
|
105
112
|
import { default as default10 } from "eslint-plugin-jsonc";
|
|
106
113
|
import { default as default11 } from "eslint-plugin-import-x";
|
|
107
114
|
import { default as default12 } from "eslint-plugin-jsdoc";
|
|
115
|
+
import * as pluginRegexp from "eslint-plugin-regexp";
|
|
108
116
|
import tseslint from "typescript-eslint";
|
|
109
117
|
import * as parserYaml from "yaml-eslint-parser";
|
|
110
118
|
import * as parserVue from "vue-eslint-parser";
|
|
@@ -117,6 +125,7 @@ function interopDefault(m) {
|
|
|
117
125
|
// src/configs/node.ts
|
|
118
126
|
var node = defineConfig([
|
|
119
127
|
{
|
|
128
|
+
name: "ntnyq/node",
|
|
120
129
|
plugins: {
|
|
121
130
|
node: default2
|
|
122
131
|
},
|
|
@@ -136,6 +145,7 @@ var node = defineConfig([
|
|
|
136
145
|
// src/configs/jsdoc.ts
|
|
137
146
|
var jsdoc = defineConfig([
|
|
138
147
|
{
|
|
148
|
+
name: "ntnyq/jsdoc",
|
|
139
149
|
plugins: {
|
|
140
150
|
jsdoc: default12
|
|
141
151
|
},
|
|
@@ -164,6 +174,7 @@ var jsdoc = defineConfig([
|
|
|
164
174
|
// src/configs/imports.ts
|
|
165
175
|
var imports = defineConfig([
|
|
166
176
|
{
|
|
177
|
+
name: "ntnyq/imports",
|
|
167
178
|
plugins: {
|
|
168
179
|
import: default11
|
|
169
180
|
},
|
|
@@ -206,11 +217,15 @@ var imports = defineConfig([
|
|
|
206
217
|
// src/configs/unicorn.ts
|
|
207
218
|
var unicorn = defineConfig([
|
|
208
219
|
{
|
|
220
|
+
name: "ntnyq/unicorn",
|
|
209
221
|
plugins: {
|
|
210
222
|
unicorn: default5
|
|
211
223
|
},
|
|
212
224
|
rules: {
|
|
213
|
-
|
|
225
|
+
// Disabled for now
|
|
226
|
+
"unicorn/prefer-top-level-await": "off",
|
|
227
|
+
"unicorn/explicit-length-check": "off",
|
|
228
|
+
"unicorn/no-array-callback-reference": "off",
|
|
214
229
|
"unicorn/error-message": "error",
|
|
215
230
|
"unicorn/escape-case": "error",
|
|
216
231
|
"unicorn/no-new-buffer": "error",
|
|
@@ -224,12 +239,10 @@ var unicorn = defineConfig([
|
|
|
224
239
|
"unicorn/prefer-set-size": "error",
|
|
225
240
|
"unicorn/better-regex": "error",
|
|
226
241
|
"unicorn/prefer-regexp-test": "error",
|
|
227
|
-
"unicorn/prefer-top-level-await": "error",
|
|
228
242
|
"unicorn/no-static-only-class": "error",
|
|
229
243
|
"unicorn/no-zero-fractions": "error",
|
|
230
244
|
"unicorn/custom-error-definition": "error",
|
|
231
245
|
"unicorn/prefer-modern-math-apis": "error",
|
|
232
|
-
"unicorn/explicit-length-check": "error",
|
|
233
246
|
"unicorn/new-for-builtins": "error",
|
|
234
247
|
"unicorn/no-console-spaces": "error",
|
|
235
248
|
"unicorn/no-for-loop": "error",
|
|
@@ -268,7 +281,6 @@ var unicorn = defineConfig([
|
|
|
268
281
|
"unicorn/no-new-array": "error",
|
|
269
282
|
"unicorn/no-instanceof-array": "error",
|
|
270
283
|
"unicorn/no-array-push-push": "error",
|
|
271
|
-
"unicorn/no-array-callback-reference": "error",
|
|
272
284
|
"unicorn/no-array-method-this-argument": "error",
|
|
273
285
|
"unicorn/prefer-array-find": "error",
|
|
274
286
|
"unicorn/prefer-array-some": "error",
|
|
@@ -282,6 +294,7 @@ var unicorn = defineConfig([
|
|
|
282
294
|
import prettierConfig from "eslint-config-prettier";
|
|
283
295
|
var prettier = defineConfig([
|
|
284
296
|
{
|
|
297
|
+
name: "ntnyq/prettier",
|
|
285
298
|
plugins: {
|
|
286
299
|
prettier: default6
|
|
287
300
|
},
|
|
@@ -296,6 +309,7 @@ var prettier = defineConfig([
|
|
|
296
309
|
// src/configs/comments.ts
|
|
297
310
|
var comments = defineConfig([
|
|
298
311
|
{
|
|
312
|
+
name: "ntnyq/eslint-comments",
|
|
299
313
|
plugins: {
|
|
300
314
|
"eslint-comments": default8
|
|
301
315
|
},
|
|
@@ -310,8 +324,12 @@ var comments = defineConfig([
|
|
|
310
324
|
import globals from "globals";
|
|
311
325
|
import jsConfig from "@eslint/js";
|
|
312
326
|
var javascript = defineConfig([
|
|
313
|
-
jsConfig.configs.recommended,
|
|
314
327
|
{
|
|
328
|
+
name: "ntnyq/js/recommended",
|
|
329
|
+
...jsConfig.configs.recommended
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: "ntnyq/js/core",
|
|
315
333
|
languageOptions: {
|
|
316
334
|
globals: {
|
|
317
335
|
...globals.browser,
|
|
@@ -506,7 +524,6 @@ var javascript = defineConfig([
|
|
|
506
524
|
semi: ["error", "never"],
|
|
507
525
|
"semi-spacing": ["error", { before: false, after: true }],
|
|
508
526
|
"space-before-blocks": ["error", "always"],
|
|
509
|
-
"space-before-function-paren": ["error", "never"],
|
|
510
527
|
"space-in-parens": ["error", "never"],
|
|
511
528
|
"space-infix-ops": "error",
|
|
512
529
|
"space-unary-ops": ["error", { words: true, nonwords: false }],
|
|
@@ -522,7 +539,6 @@ var javascript = defineConfig([
|
|
|
522
539
|
],
|
|
523
540
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
524
541
|
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
525
|
-
"yield-star-spacing": ["error", "both"],
|
|
526
542
|
yoda: ["error", "never"],
|
|
527
543
|
// es6+
|
|
528
544
|
"no-var": "error",
|
|
@@ -658,12 +674,14 @@ var javascript = defineConfig([
|
|
|
658
674
|
}
|
|
659
675
|
},
|
|
660
676
|
{
|
|
677
|
+
name: "ntnyq/js/script",
|
|
661
678
|
files: ["**/scripts/*", "**/cli.*"],
|
|
662
679
|
rules: {
|
|
663
680
|
"no-console": "off"
|
|
664
681
|
}
|
|
665
682
|
},
|
|
666
683
|
{
|
|
684
|
+
name: "ntnyq/js/test",
|
|
667
685
|
files: ["**/*.{test,spec}.js?(x)"],
|
|
668
686
|
rules: {
|
|
669
687
|
"no-unused-expressions": "off",
|
|
@@ -673,6 +691,7 @@ var javascript = defineConfig([
|
|
|
673
691
|
]);
|
|
674
692
|
var jsx = defineConfig([
|
|
675
693
|
{
|
|
694
|
+
name: "ntnyq/jsx",
|
|
676
695
|
files: ["**/*.jsx"],
|
|
677
696
|
languageOptions: {
|
|
678
697
|
parserOptions: {
|
|
@@ -686,6 +705,7 @@ var jsx = defineConfig([
|
|
|
686
705
|
|
|
687
706
|
// src/configs/typescript.ts
|
|
688
707
|
var typescriptCore = tseslint.config({
|
|
708
|
+
name: "ntnyq/ts/core",
|
|
689
709
|
extends: [...tseslint.configs.recommended],
|
|
690
710
|
files: [GLOB_TS, GLOB_TSX],
|
|
691
711
|
languageOptions: {
|
|
@@ -732,7 +752,6 @@ var typescriptCore = tseslint.config({
|
|
|
732
752
|
"@typescript-eslint/no-explicit-any": "off",
|
|
733
753
|
"@typescript-eslint/no-empty-function": "off",
|
|
734
754
|
"@typescript-eslint/naming-convention": "off",
|
|
735
|
-
"@typescript-eslint/no-empty-interface": "off",
|
|
736
755
|
"@typescript-eslint/no-empty-object-type": "off",
|
|
737
756
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
738
757
|
"@typescript-eslint/triple-slash-reference": "off",
|
|
@@ -746,6 +765,7 @@ var typescriptCore = tseslint.config({
|
|
|
746
765
|
var typescript = defineConfig([
|
|
747
766
|
...typescriptCore,
|
|
748
767
|
{
|
|
768
|
+
name: "ntnyq/ts/dts",
|
|
749
769
|
files: ["**/*.d.ts"],
|
|
750
770
|
rules: {
|
|
751
771
|
"import/no-duplicates": "off",
|
|
@@ -753,6 +773,7 @@ var typescript = defineConfig([
|
|
|
753
773
|
}
|
|
754
774
|
},
|
|
755
775
|
{
|
|
776
|
+
name: "ntnyq/ts/test",
|
|
756
777
|
files: ["**/*.{spec,test}.ts?(x)"],
|
|
757
778
|
rules: {
|
|
758
779
|
"no-unused-expressions": "off",
|
|
@@ -760,6 +781,7 @@ var typescript = defineConfig([
|
|
|
760
781
|
}
|
|
761
782
|
},
|
|
762
783
|
{
|
|
784
|
+
name: "ntnyq/ts/cjs",
|
|
763
785
|
files: [GLOB_JS, "**/*.cjs"],
|
|
764
786
|
rules: {
|
|
765
787
|
"@typescript-eslint/no-var-requires": "off"
|
|
@@ -767,9 +789,21 @@ var typescript = defineConfig([
|
|
|
767
789
|
}
|
|
768
790
|
]);
|
|
769
791
|
|
|
792
|
+
// src/configs/regexp.ts
|
|
793
|
+
var regexp = defineConfig([
|
|
794
|
+
/**
|
|
795
|
+
* https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/rules/recommended.ts
|
|
796
|
+
*/
|
|
797
|
+
{
|
|
798
|
+
name: "ntnyq/regexp",
|
|
799
|
+
...pluginRegexp.configs["flat/recommended"]
|
|
800
|
+
}
|
|
801
|
+
]);
|
|
802
|
+
|
|
770
803
|
// src/configs/unocss.ts
|
|
771
804
|
var unocss = defineConfig([
|
|
772
805
|
{
|
|
806
|
+
name: "ntnyq/unocss",
|
|
773
807
|
plugins: {
|
|
774
808
|
unocss: default4
|
|
775
809
|
},
|
|
@@ -781,9 +815,14 @@ var unocss = defineConfig([
|
|
|
781
815
|
}
|
|
782
816
|
]);
|
|
783
817
|
|
|
818
|
+
// src/configs/command.ts
|
|
819
|
+
import createCommandPlugin from "eslint-plugin-command/config";
|
|
820
|
+
var command = defineConfig([createCommandPlugin({})]);
|
|
821
|
+
|
|
784
822
|
// src/configs/yml.ts
|
|
785
823
|
var yml = defineConfig([
|
|
786
824
|
{
|
|
825
|
+
name: "ntnyq/yaml",
|
|
787
826
|
files: [GLOB_YAML],
|
|
788
827
|
languageOptions: {
|
|
789
828
|
parser: parserYaml
|
|
@@ -803,6 +842,7 @@ var yml = defineConfig([
|
|
|
803
842
|
// src/configs/sort.ts
|
|
804
843
|
var sortPackageJson = defineConfig([
|
|
805
844
|
{
|
|
845
|
+
name: "ntnyq/sort/package-json",
|
|
806
846
|
files: ["**/package.json"],
|
|
807
847
|
rules: {
|
|
808
848
|
"jsonc/sort-keys": [
|
|
@@ -901,6 +941,7 @@ var sortPackageJson = defineConfig([
|
|
|
901
941
|
]);
|
|
902
942
|
var sortTsConfig = defineConfig([
|
|
903
943
|
{
|
|
944
|
+
name: "ntnyq/sort/tsconfig",
|
|
904
945
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
905
946
|
rules: {
|
|
906
947
|
"jsonc/sort-keys": [
|
|
@@ -1018,6 +1059,7 @@ var sortTsConfig = defineConfig([
|
|
|
1018
1059
|
// src/configs/jsonc.ts
|
|
1019
1060
|
var jsonc = defineConfig([
|
|
1020
1061
|
{
|
|
1062
|
+
name: "ntnyq/jsonc",
|
|
1021
1063
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
|
|
1022
1064
|
plugins: {
|
|
1023
1065
|
jsonc: default10
|
|
@@ -1059,8 +1101,11 @@ var jsonc = defineConfig([
|
|
|
1059
1101
|
|
|
1060
1102
|
// src/configs/markdown.ts
|
|
1061
1103
|
var markdown = defineConfig([
|
|
1104
|
+
// TODO: Add config name for markdown plugin
|
|
1105
|
+
// wait for https://github.com/eslint/eslint-plugin-markdown/pull/256
|
|
1062
1106
|
...default7.configs.recommended,
|
|
1063
1107
|
{
|
|
1108
|
+
name: "ntnyq/markdown/extensions",
|
|
1064
1109
|
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
1065
1110
|
rules: {
|
|
1066
1111
|
"no-undef": "off",
|
|
@@ -1086,10 +1131,10 @@ var markdown = defineConfig([
|
|
|
1086
1131
|
]);
|
|
1087
1132
|
|
|
1088
1133
|
// src/configs/vue.ts
|
|
1089
|
-
import
|
|
1134
|
+
import process2 from "node:process";
|
|
1090
1135
|
import { getPackageInfoSync } from "local-pkg";
|
|
1091
1136
|
function getVueVersion() {
|
|
1092
|
-
const pkg = getPackageInfoSync("vue", { paths: [
|
|
1137
|
+
const pkg = getPackageInfoSync("vue", { paths: [process2.cwd()] });
|
|
1093
1138
|
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
1094
1139
|
return +pkg.version[0];
|
|
1095
1140
|
}
|
|
@@ -1110,10 +1155,12 @@ var vue3Rules = {
|
|
|
1110
1155
|
};
|
|
1111
1156
|
var vue = defineConfig([
|
|
1112
1157
|
...tseslint.config({
|
|
1158
|
+
name: "ntnyq/vue/ts",
|
|
1113
1159
|
files: [GLOB_VUE],
|
|
1114
1160
|
extends: typescriptCore
|
|
1115
1161
|
}),
|
|
1116
1162
|
{
|
|
1163
|
+
name: "ntnyq/vue/core",
|
|
1117
1164
|
files: [GLOB_VUE],
|
|
1118
1165
|
plugins: {
|
|
1119
1166
|
vue: default3,
|
|
@@ -1358,7 +1405,8 @@ var presetJavaScript = [
|
|
|
1358
1405
|
...imports,
|
|
1359
1406
|
...unicorn,
|
|
1360
1407
|
...comments,
|
|
1361
|
-
...javascript
|
|
1408
|
+
...javascript,
|
|
1409
|
+
...regexp
|
|
1362
1410
|
];
|
|
1363
1411
|
var presetBasic = [...presetJavaScript, ...typescript];
|
|
1364
1412
|
var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsConfig];
|
|
@@ -1369,7 +1417,8 @@ function ntnyq(config = [], {
|
|
|
1369
1417
|
vue: enableVue = hasVue,
|
|
1370
1418
|
unocss: enableUnoCSS = hasUnoCSS,
|
|
1371
1419
|
prettier: enablePrettier = true,
|
|
1372
|
-
markdown: enableMarkdown = true
|
|
1420
|
+
markdown: enableMarkdown = true,
|
|
1421
|
+
command: enableCommand = true
|
|
1373
1422
|
} = {}) {
|
|
1374
1423
|
const configs = defineConfig([...presetBasic, ...yml, ...presetJsonc]);
|
|
1375
1424
|
if (enableVue) {
|
|
@@ -1384,6 +1433,9 @@ function ntnyq(config = [], {
|
|
|
1384
1433
|
if (enableMarkdown) {
|
|
1385
1434
|
configs.push(...markdown);
|
|
1386
1435
|
}
|
|
1436
|
+
if (enableCommand) {
|
|
1437
|
+
configs.push(...command);
|
|
1438
|
+
}
|
|
1387
1439
|
if (Object.keys(config).length > 0) {
|
|
1388
1440
|
configs.push(...Array.isArray(config) ? config : [config]);
|
|
1389
1441
|
}
|
|
@@ -1412,6 +1464,7 @@ export {
|
|
|
1412
1464
|
GLOB_TSX,
|
|
1413
1465
|
GLOB_VUE,
|
|
1414
1466
|
GLOB_YAML,
|
|
1467
|
+
command,
|
|
1415
1468
|
comments,
|
|
1416
1469
|
defineConfig,
|
|
1417
1470
|
getVueVersion,
|
|
@@ -1438,6 +1491,7 @@ export {
|
|
|
1438
1491
|
default7 as pluginMarkdown,
|
|
1439
1492
|
default2 as pluginNode,
|
|
1440
1493
|
default6 as pluginPrettier,
|
|
1494
|
+
pluginRegexp,
|
|
1441
1495
|
default5 as pluginUnicorn,
|
|
1442
1496
|
default4 as pluginUnoCSS,
|
|
1443
1497
|
default3 as pluginVue,
|
|
@@ -1449,6 +1503,7 @@ export {
|
|
|
1449
1503
|
presetJsonc,
|
|
1450
1504
|
presetLanguageExtensions,
|
|
1451
1505
|
prettier,
|
|
1506
|
+
regexp,
|
|
1452
1507
|
sortPackageJson,
|
|
1453
1508
|
sortTsConfig,
|
|
1454
1509
|
tseslint,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ntnyq/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.5.0",
|
|
5
5
|
"packageManager": "pnpm@9.4.0",
|
|
6
6
|
"description": "ESLint flat config of ntnyq",
|
|
7
7
|
"keywords": [
|
|
@@ -38,6 +38,8 @@
|
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsup",
|
|
40
40
|
"clean": "rimraf dist",
|
|
41
|
+
"dev": "tsup --watch",
|
|
42
|
+
"generate:site": "node scripts/generateSite.mjs",
|
|
41
43
|
"lint": "eslint .",
|
|
42
44
|
"prepare": "husky",
|
|
43
45
|
"release": "run-s release:check release:version",
|
|
@@ -56,22 +58,24 @@
|
|
|
56
58
|
"@types/eslint": "^8.56.10",
|
|
57
59
|
"@unocss/eslint-plugin": "^0.61.0",
|
|
58
60
|
"eslint-config-prettier": "^9.1.0",
|
|
61
|
+
"eslint-plugin-command": "^0.2.3",
|
|
59
62
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
60
|
-
"eslint-plugin-import-x": "^0.5.
|
|
63
|
+
"eslint-plugin-import-x": "^0.5.3",
|
|
61
64
|
"eslint-plugin-jsdoc": "^48.5.0",
|
|
62
65
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
63
66
|
"eslint-plugin-markdown": "^5.0.0",
|
|
64
67
|
"eslint-plugin-n": "^17.9.0",
|
|
65
68
|
"eslint-plugin-prettier": "^5.1.3",
|
|
69
|
+
"eslint-plugin-regexp": "^2.6.0",
|
|
66
70
|
"eslint-plugin-unicorn": "^54.0.0",
|
|
67
71
|
"eslint-plugin-unused-imports": "^4.0.0",
|
|
68
|
-
"eslint-plugin-vue": "^9.
|
|
72
|
+
"eslint-plugin-vue": "^9.27.0",
|
|
69
73
|
"eslint-plugin-yml": "^1.14.0",
|
|
70
|
-
"globals": "^15.
|
|
74
|
+
"globals": "^15.8.0",
|
|
71
75
|
"jsonc-eslint-parser": "^2.4.0",
|
|
72
76
|
"local-pkg": "^0.5.0",
|
|
73
77
|
"prettier": "^3.3.2",
|
|
74
|
-
"typescript-eslint": "^8.0.0-alpha.
|
|
78
|
+
"typescript-eslint": "^8.0.0-alpha.39",
|
|
75
79
|
"vue-eslint-parser": "^9.4.3",
|
|
76
80
|
"yaml-eslint-parser": "^1.2.3"
|
|
77
81
|
},
|
|
@@ -79,13 +83,14 @@
|
|
|
79
83
|
"@ntnyq/prettier-config": "^1.21.2",
|
|
80
84
|
"@types/node": "^20.14.9",
|
|
81
85
|
"bumpp": "^9.4.1",
|
|
82
|
-
"eslint": "^9.
|
|
86
|
+
"eslint": "^9.6.0",
|
|
83
87
|
"husky": "^9.0.11",
|
|
84
88
|
"nano-staged": "^0.8.0",
|
|
85
|
-
"npm-run-all2": "^6.2.
|
|
89
|
+
"npm-run-all2": "^6.2.2",
|
|
86
90
|
"rimraf": "^5.0.7",
|
|
87
91
|
"tsup": "^8.1.0",
|
|
88
|
-
"typescript": "^5.5.
|
|
92
|
+
"typescript": "^5.5.3",
|
|
93
|
+
"zx": "^8.1.4"
|
|
89
94
|
},
|
|
90
95
|
"engines": {
|
|
91
96
|
"node": ">=18.18"
|