@ntnyq/eslint-config 2.4.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/dist/index.cjs +59 -12
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +57 -12
- package/package.json +12 -8
package/dist/index.cjs
CHANGED
|
@@ -79,6 +79,7 @@ __export(src_exports, {
|
|
|
79
79
|
pluginMarkdown: () => import_eslint_plugin_markdown.default,
|
|
80
80
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
81
81
|
pluginPrettier: () => import_eslint_plugin_prettier.default,
|
|
82
|
+
pluginRegexp: () => pluginRegexp,
|
|
82
83
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
83
84
|
pluginUnoCSS: () => import_eslint_plugin.default,
|
|
84
85
|
pluginVue: () => import_eslint_plugin_vue.default,
|
|
@@ -90,6 +91,7 @@ __export(src_exports, {
|
|
|
90
91
|
presetJsonc: () => presetJsonc,
|
|
91
92
|
presetLanguageExtensions: () => presetLanguageExtensions,
|
|
92
93
|
prettier: () => prettier,
|
|
94
|
+
regexp: () => regexp,
|
|
93
95
|
sortPackageJson: () => sortPackageJson,
|
|
94
96
|
sortTsConfig: () => sortTsConfig,
|
|
95
97
|
tseslint: () => import_typescript_eslint.default,
|
|
@@ -103,10 +105,16 @@ __export(src_exports, {
|
|
|
103
105
|
module.exports = __toCommonJS(src_exports);
|
|
104
106
|
|
|
105
107
|
// src/env.ts
|
|
108
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
109
|
+
var import_node_path = require("path");
|
|
106
110
|
var import_local_pkg = require("local-pkg");
|
|
107
111
|
var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
|
|
108
|
-
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")
|
|
109
|
-
|
|
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");
|
|
110
118
|
|
|
111
119
|
// src/types.ts
|
|
112
120
|
function defineConfig(configs = []) {
|
|
@@ -193,6 +201,7 @@ var GLOB_EXCLUDE = [
|
|
|
193
201
|
// src/configs/ignores.ts
|
|
194
202
|
var ignores = defineConfig([
|
|
195
203
|
{
|
|
204
|
+
name: "ntnyq/ignores",
|
|
196
205
|
ignores: GLOB_EXCLUDE
|
|
197
206
|
}
|
|
198
207
|
]);
|
|
@@ -209,6 +218,7 @@ var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
|
|
|
209
218
|
var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
210
219
|
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
211
220
|
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
221
|
+
var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
|
|
212
222
|
var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
|
|
213
223
|
var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
|
|
214
224
|
var parserVue = __toESM(require("vue-eslint-parser"), 1);
|
|
@@ -221,6 +231,7 @@ function interopDefault(m) {
|
|
|
221
231
|
// src/configs/node.ts
|
|
222
232
|
var node = defineConfig([
|
|
223
233
|
{
|
|
234
|
+
name: "ntnyq/node",
|
|
224
235
|
plugins: {
|
|
225
236
|
node: import_eslint_plugin_n.default
|
|
226
237
|
},
|
|
@@ -240,6 +251,7 @@ var node = defineConfig([
|
|
|
240
251
|
// src/configs/jsdoc.ts
|
|
241
252
|
var jsdoc = defineConfig([
|
|
242
253
|
{
|
|
254
|
+
name: "ntnyq/jsdoc",
|
|
243
255
|
plugins: {
|
|
244
256
|
jsdoc: import_eslint_plugin_jsdoc.default
|
|
245
257
|
},
|
|
@@ -268,6 +280,7 @@ var jsdoc = defineConfig([
|
|
|
268
280
|
// src/configs/imports.ts
|
|
269
281
|
var imports = defineConfig([
|
|
270
282
|
{
|
|
283
|
+
name: "ntnyq/imports",
|
|
271
284
|
plugins: {
|
|
272
285
|
import: import_eslint_plugin_import_x.default
|
|
273
286
|
},
|
|
@@ -310,12 +323,12 @@ var imports = defineConfig([
|
|
|
310
323
|
// src/configs/unicorn.ts
|
|
311
324
|
var unicorn = defineConfig([
|
|
312
325
|
{
|
|
326
|
+
name: "ntnyq/unicorn",
|
|
313
327
|
plugins: {
|
|
314
328
|
unicorn: import_eslint_plugin_unicorn.default
|
|
315
329
|
},
|
|
316
330
|
rules: {
|
|
317
|
-
// Disabled
|
|
318
|
-
"unicorn/no-unsafe-regex": "off",
|
|
331
|
+
// Disabled for now
|
|
319
332
|
"unicorn/prefer-top-level-await": "off",
|
|
320
333
|
"unicorn/explicit-length-check": "off",
|
|
321
334
|
"unicorn/no-array-callback-reference": "off",
|
|
@@ -387,6 +400,7 @@ var unicorn = defineConfig([
|
|
|
387
400
|
var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
|
|
388
401
|
var prettier = defineConfig([
|
|
389
402
|
{
|
|
403
|
+
name: "ntnyq/prettier",
|
|
390
404
|
plugins: {
|
|
391
405
|
prettier: import_eslint_plugin_prettier.default
|
|
392
406
|
},
|
|
@@ -401,6 +415,7 @@ var prettier = defineConfig([
|
|
|
401
415
|
// src/configs/comments.ts
|
|
402
416
|
var comments = defineConfig([
|
|
403
417
|
{
|
|
418
|
+
name: "ntnyq/eslint-comments",
|
|
404
419
|
plugins: {
|
|
405
420
|
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
406
421
|
},
|
|
@@ -415,8 +430,12 @@ var comments = defineConfig([
|
|
|
415
430
|
var import_globals = __toESM(require("globals"), 1);
|
|
416
431
|
var import_js = __toESM(require("@eslint/js"), 1);
|
|
417
432
|
var javascript = defineConfig([
|
|
418
|
-
import_js.default.configs.recommended,
|
|
419
433
|
{
|
|
434
|
+
name: "ntnyq/js/recommended",
|
|
435
|
+
...import_js.default.configs.recommended
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
name: "ntnyq/js/core",
|
|
420
439
|
languageOptions: {
|
|
421
440
|
globals: {
|
|
422
441
|
...import_globals.default.browser,
|
|
@@ -611,7 +630,6 @@ var javascript = defineConfig([
|
|
|
611
630
|
semi: ["error", "never"],
|
|
612
631
|
"semi-spacing": ["error", { before: false, after: true }],
|
|
613
632
|
"space-before-blocks": ["error", "always"],
|
|
614
|
-
"space-before-function-paren": ["error", "never"],
|
|
615
633
|
"space-in-parens": ["error", "never"],
|
|
616
634
|
"space-infix-ops": "error",
|
|
617
635
|
"space-unary-ops": ["error", { words: true, nonwords: false }],
|
|
@@ -627,7 +645,6 @@ var javascript = defineConfig([
|
|
|
627
645
|
],
|
|
628
646
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
629
647
|
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
630
|
-
"yield-star-spacing": ["error", "both"],
|
|
631
648
|
yoda: ["error", "never"],
|
|
632
649
|
// es6+
|
|
633
650
|
"no-var": "error",
|
|
@@ -763,12 +780,14 @@ var javascript = defineConfig([
|
|
|
763
780
|
}
|
|
764
781
|
},
|
|
765
782
|
{
|
|
783
|
+
name: "ntnyq/js/script",
|
|
766
784
|
files: ["**/scripts/*", "**/cli.*"],
|
|
767
785
|
rules: {
|
|
768
786
|
"no-console": "off"
|
|
769
787
|
}
|
|
770
788
|
},
|
|
771
789
|
{
|
|
790
|
+
name: "ntnyq/js/test",
|
|
772
791
|
files: ["**/*.{test,spec}.js?(x)"],
|
|
773
792
|
rules: {
|
|
774
793
|
"no-unused-expressions": "off",
|
|
@@ -778,6 +797,7 @@ var javascript = defineConfig([
|
|
|
778
797
|
]);
|
|
779
798
|
var jsx = defineConfig([
|
|
780
799
|
{
|
|
800
|
+
name: "ntnyq/jsx",
|
|
781
801
|
files: ["**/*.jsx"],
|
|
782
802
|
languageOptions: {
|
|
783
803
|
parserOptions: {
|
|
@@ -791,6 +811,7 @@ var jsx = defineConfig([
|
|
|
791
811
|
|
|
792
812
|
// src/configs/typescript.ts
|
|
793
813
|
var typescriptCore = import_typescript_eslint.default.config({
|
|
814
|
+
name: "ntnyq/ts/core",
|
|
794
815
|
extends: [...import_typescript_eslint.default.configs.recommended],
|
|
795
816
|
files: [GLOB_TS, GLOB_TSX],
|
|
796
817
|
languageOptions: {
|
|
@@ -837,7 +858,6 @@ var typescriptCore = import_typescript_eslint.default.config({
|
|
|
837
858
|
"@typescript-eslint/no-explicit-any": "off",
|
|
838
859
|
"@typescript-eslint/no-empty-function": "off",
|
|
839
860
|
"@typescript-eslint/naming-convention": "off",
|
|
840
|
-
"@typescript-eslint/no-empty-interface": "off",
|
|
841
861
|
"@typescript-eslint/no-empty-object-type": "off",
|
|
842
862
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
843
863
|
"@typescript-eslint/triple-slash-reference": "off",
|
|
@@ -851,6 +871,7 @@ var typescriptCore = import_typescript_eslint.default.config({
|
|
|
851
871
|
var typescript = defineConfig([
|
|
852
872
|
...typescriptCore,
|
|
853
873
|
{
|
|
874
|
+
name: "ntnyq/ts/dts",
|
|
854
875
|
files: ["**/*.d.ts"],
|
|
855
876
|
rules: {
|
|
856
877
|
"import/no-duplicates": "off",
|
|
@@ -858,6 +879,7 @@ var typescript = defineConfig([
|
|
|
858
879
|
}
|
|
859
880
|
},
|
|
860
881
|
{
|
|
882
|
+
name: "ntnyq/ts/test",
|
|
861
883
|
files: ["**/*.{spec,test}.ts?(x)"],
|
|
862
884
|
rules: {
|
|
863
885
|
"no-unused-expressions": "off",
|
|
@@ -865,6 +887,7 @@ var typescript = defineConfig([
|
|
|
865
887
|
}
|
|
866
888
|
},
|
|
867
889
|
{
|
|
890
|
+
name: "ntnyq/ts/cjs",
|
|
868
891
|
files: [GLOB_JS, "**/*.cjs"],
|
|
869
892
|
rules: {
|
|
870
893
|
"@typescript-eslint/no-var-requires": "off"
|
|
@@ -872,9 +895,21 @@ var typescript = defineConfig([
|
|
|
872
895
|
}
|
|
873
896
|
]);
|
|
874
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
|
+
|
|
875
909
|
// src/configs/unocss.ts
|
|
876
910
|
var unocss = defineConfig([
|
|
877
911
|
{
|
|
912
|
+
name: "ntnyq/unocss",
|
|
878
913
|
plugins: {
|
|
879
914
|
unocss: import_eslint_plugin.default
|
|
880
915
|
},
|
|
@@ -888,11 +923,12 @@ var unocss = defineConfig([
|
|
|
888
923
|
|
|
889
924
|
// src/configs/command.ts
|
|
890
925
|
var import_config = __toESM(require("eslint-plugin-command/config"), 1);
|
|
891
|
-
var command = defineConfig([(0, import_config.default)()]);
|
|
926
|
+
var command = defineConfig([(0, import_config.default)({})]);
|
|
892
927
|
|
|
893
928
|
// src/configs/yml.ts
|
|
894
929
|
var yml = defineConfig([
|
|
895
930
|
{
|
|
931
|
+
name: "ntnyq/yaml",
|
|
896
932
|
files: [GLOB_YAML],
|
|
897
933
|
languageOptions: {
|
|
898
934
|
parser: parserYaml
|
|
@@ -912,6 +948,7 @@ var yml = defineConfig([
|
|
|
912
948
|
// src/configs/sort.ts
|
|
913
949
|
var sortPackageJson = defineConfig([
|
|
914
950
|
{
|
|
951
|
+
name: "ntnyq/sort/package-json",
|
|
915
952
|
files: ["**/package.json"],
|
|
916
953
|
rules: {
|
|
917
954
|
"jsonc/sort-keys": [
|
|
@@ -1010,6 +1047,7 @@ var sortPackageJson = defineConfig([
|
|
|
1010
1047
|
]);
|
|
1011
1048
|
var sortTsConfig = defineConfig([
|
|
1012
1049
|
{
|
|
1050
|
+
name: "ntnyq/sort/tsconfig",
|
|
1013
1051
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
1014
1052
|
rules: {
|
|
1015
1053
|
"jsonc/sort-keys": [
|
|
@@ -1127,6 +1165,7 @@ var sortTsConfig = defineConfig([
|
|
|
1127
1165
|
// src/configs/jsonc.ts
|
|
1128
1166
|
var jsonc = defineConfig([
|
|
1129
1167
|
{
|
|
1168
|
+
name: "ntnyq/jsonc",
|
|
1130
1169
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
|
|
1131
1170
|
plugins: {
|
|
1132
1171
|
jsonc: import_eslint_plugin_jsonc.default
|
|
@@ -1168,8 +1207,11 @@ var jsonc = defineConfig([
|
|
|
1168
1207
|
|
|
1169
1208
|
// src/configs/markdown.ts
|
|
1170
1209
|
var markdown = defineConfig([
|
|
1210
|
+
// TODO: Add config name for markdown plugin
|
|
1211
|
+
// wait for https://github.com/eslint/eslint-plugin-markdown/pull/256
|
|
1171
1212
|
...import_eslint_plugin_markdown.default.configs.recommended,
|
|
1172
1213
|
{
|
|
1214
|
+
name: "ntnyq/markdown/extensions",
|
|
1173
1215
|
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
1174
1216
|
rules: {
|
|
1175
1217
|
"no-undef": "off",
|
|
@@ -1195,10 +1237,10 @@ var markdown = defineConfig([
|
|
|
1195
1237
|
]);
|
|
1196
1238
|
|
|
1197
1239
|
// src/configs/vue.ts
|
|
1198
|
-
var
|
|
1240
|
+
var import_node_process2 = __toESM(require("process"), 1);
|
|
1199
1241
|
var import_local_pkg2 = require("local-pkg");
|
|
1200
1242
|
function getVueVersion() {
|
|
1201
|
-
const pkg = (0, import_local_pkg2.getPackageInfoSync)("vue", { paths: [
|
|
1243
|
+
const pkg = (0, import_local_pkg2.getPackageInfoSync)("vue", { paths: [import_node_process2.default.cwd()] });
|
|
1202
1244
|
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
1203
1245
|
return +pkg.version[0];
|
|
1204
1246
|
}
|
|
@@ -1219,10 +1261,12 @@ var vue3Rules = {
|
|
|
1219
1261
|
};
|
|
1220
1262
|
var vue = defineConfig([
|
|
1221
1263
|
...import_typescript_eslint.default.config({
|
|
1264
|
+
name: "ntnyq/vue/ts",
|
|
1222
1265
|
files: [GLOB_VUE],
|
|
1223
1266
|
extends: typescriptCore
|
|
1224
1267
|
}),
|
|
1225
1268
|
{
|
|
1269
|
+
name: "ntnyq/vue/core",
|
|
1226
1270
|
files: [GLOB_VUE],
|
|
1227
1271
|
plugins: {
|
|
1228
1272
|
vue: import_eslint_plugin_vue.default,
|
|
@@ -1467,7 +1511,8 @@ var presetJavaScript = [
|
|
|
1467
1511
|
...imports,
|
|
1468
1512
|
...unicorn,
|
|
1469
1513
|
...comments,
|
|
1470
|
-
...javascript
|
|
1514
|
+
...javascript,
|
|
1515
|
+
...regexp
|
|
1471
1516
|
];
|
|
1472
1517
|
var presetBasic = [...presetJavaScript, ...typescript];
|
|
1473
1518
|
var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsConfig];
|
|
@@ -1553,6 +1598,7 @@ function ntnyq(config = [], {
|
|
|
1553
1598
|
pluginMarkdown,
|
|
1554
1599
|
pluginNode,
|
|
1555
1600
|
pluginPrettier,
|
|
1601
|
+
pluginRegexp,
|
|
1556
1602
|
pluginUnicorn,
|
|
1557
1603
|
pluginUnoCSS,
|
|
1558
1604
|
pluginVue,
|
|
@@ -1564,6 +1610,7 @@ function ntnyq(config = [], {
|
|
|
1564
1610
|
presetJsonc,
|
|
1565
1611
|
presetLanguageExtensions,
|
|
1566
1612
|
prettier,
|
|
1613
|
+
regexp,
|
|
1567
1614
|
sortPackageJson,
|
|
1568
1615
|
sortTsConfig,
|
|
1569
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';
|
|
@@ -132,6 +134,8 @@ declare const jsx: FlatConfig[];
|
|
|
132
134
|
declare const typescriptCore: FlatConfig[];
|
|
133
135
|
declare const typescript: FlatConfig[];
|
|
134
136
|
|
|
137
|
+
declare const regexp: FlatConfig[];
|
|
138
|
+
|
|
135
139
|
declare const unocss: FlatConfig[];
|
|
136
140
|
|
|
137
141
|
declare const command: FlatConfig[];
|
|
@@ -156,4 +160,4 @@ type InteropDefault<T> = T extends {
|
|
|
156
160
|
} ? U : T;
|
|
157
161
|
declare function interopDefault<T>(m: T): InteropDefault<T>;
|
|
158
162
|
|
|
159
|
-
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, 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';
|
|
@@ -132,6 +134,8 @@ declare const jsx: FlatConfig[];
|
|
|
132
134
|
declare const typescriptCore: FlatConfig[];
|
|
133
135
|
declare const typescript: FlatConfig[];
|
|
134
136
|
|
|
137
|
+
declare const regexp: FlatConfig[];
|
|
138
|
+
|
|
135
139
|
declare const unocss: FlatConfig[];
|
|
136
140
|
|
|
137
141
|
declare const command: FlatConfig[];
|
|
@@ -156,4 +160,4 @@ type InteropDefault<T> = T extends {
|
|
|
156
160
|
} ? U : T;
|
|
157
161
|
declare function interopDefault<T>(m: T): InteropDefault<T>;
|
|
158
162
|
|
|
159
|
-
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, 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,12 +217,12 @@ 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
|
-
// Disabled
|
|
214
|
-
"unicorn/no-unsafe-regex": "off",
|
|
225
|
+
// Disabled for now
|
|
215
226
|
"unicorn/prefer-top-level-await": "off",
|
|
216
227
|
"unicorn/explicit-length-check": "off",
|
|
217
228
|
"unicorn/no-array-callback-reference": "off",
|
|
@@ -283,6 +294,7 @@ var unicorn = defineConfig([
|
|
|
283
294
|
import prettierConfig from "eslint-config-prettier";
|
|
284
295
|
var prettier = defineConfig([
|
|
285
296
|
{
|
|
297
|
+
name: "ntnyq/prettier",
|
|
286
298
|
plugins: {
|
|
287
299
|
prettier: default6
|
|
288
300
|
},
|
|
@@ -297,6 +309,7 @@ var prettier = defineConfig([
|
|
|
297
309
|
// src/configs/comments.ts
|
|
298
310
|
var comments = defineConfig([
|
|
299
311
|
{
|
|
312
|
+
name: "ntnyq/eslint-comments",
|
|
300
313
|
plugins: {
|
|
301
314
|
"eslint-comments": default8
|
|
302
315
|
},
|
|
@@ -311,8 +324,12 @@ var comments = defineConfig([
|
|
|
311
324
|
import globals from "globals";
|
|
312
325
|
import jsConfig from "@eslint/js";
|
|
313
326
|
var javascript = defineConfig([
|
|
314
|
-
jsConfig.configs.recommended,
|
|
315
327
|
{
|
|
328
|
+
name: "ntnyq/js/recommended",
|
|
329
|
+
...jsConfig.configs.recommended
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: "ntnyq/js/core",
|
|
316
333
|
languageOptions: {
|
|
317
334
|
globals: {
|
|
318
335
|
...globals.browser,
|
|
@@ -507,7 +524,6 @@ var javascript = defineConfig([
|
|
|
507
524
|
semi: ["error", "never"],
|
|
508
525
|
"semi-spacing": ["error", { before: false, after: true }],
|
|
509
526
|
"space-before-blocks": ["error", "always"],
|
|
510
|
-
"space-before-function-paren": ["error", "never"],
|
|
511
527
|
"space-in-parens": ["error", "never"],
|
|
512
528
|
"space-infix-ops": "error",
|
|
513
529
|
"space-unary-ops": ["error", { words: true, nonwords: false }],
|
|
@@ -523,7 +539,6 @@ var javascript = defineConfig([
|
|
|
523
539
|
],
|
|
524
540
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
525
541
|
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
526
|
-
"yield-star-spacing": ["error", "both"],
|
|
527
542
|
yoda: ["error", "never"],
|
|
528
543
|
// es6+
|
|
529
544
|
"no-var": "error",
|
|
@@ -659,12 +674,14 @@ var javascript = defineConfig([
|
|
|
659
674
|
}
|
|
660
675
|
},
|
|
661
676
|
{
|
|
677
|
+
name: "ntnyq/js/script",
|
|
662
678
|
files: ["**/scripts/*", "**/cli.*"],
|
|
663
679
|
rules: {
|
|
664
680
|
"no-console": "off"
|
|
665
681
|
}
|
|
666
682
|
},
|
|
667
683
|
{
|
|
684
|
+
name: "ntnyq/js/test",
|
|
668
685
|
files: ["**/*.{test,spec}.js?(x)"],
|
|
669
686
|
rules: {
|
|
670
687
|
"no-unused-expressions": "off",
|
|
@@ -674,6 +691,7 @@ var javascript = defineConfig([
|
|
|
674
691
|
]);
|
|
675
692
|
var jsx = defineConfig([
|
|
676
693
|
{
|
|
694
|
+
name: "ntnyq/jsx",
|
|
677
695
|
files: ["**/*.jsx"],
|
|
678
696
|
languageOptions: {
|
|
679
697
|
parserOptions: {
|
|
@@ -687,6 +705,7 @@ var jsx = defineConfig([
|
|
|
687
705
|
|
|
688
706
|
// src/configs/typescript.ts
|
|
689
707
|
var typescriptCore = tseslint.config({
|
|
708
|
+
name: "ntnyq/ts/core",
|
|
690
709
|
extends: [...tseslint.configs.recommended],
|
|
691
710
|
files: [GLOB_TS, GLOB_TSX],
|
|
692
711
|
languageOptions: {
|
|
@@ -733,7 +752,6 @@ var typescriptCore = tseslint.config({
|
|
|
733
752
|
"@typescript-eslint/no-explicit-any": "off",
|
|
734
753
|
"@typescript-eslint/no-empty-function": "off",
|
|
735
754
|
"@typescript-eslint/naming-convention": "off",
|
|
736
|
-
"@typescript-eslint/no-empty-interface": "off",
|
|
737
755
|
"@typescript-eslint/no-empty-object-type": "off",
|
|
738
756
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
739
757
|
"@typescript-eslint/triple-slash-reference": "off",
|
|
@@ -747,6 +765,7 @@ var typescriptCore = tseslint.config({
|
|
|
747
765
|
var typescript = defineConfig([
|
|
748
766
|
...typescriptCore,
|
|
749
767
|
{
|
|
768
|
+
name: "ntnyq/ts/dts",
|
|
750
769
|
files: ["**/*.d.ts"],
|
|
751
770
|
rules: {
|
|
752
771
|
"import/no-duplicates": "off",
|
|
@@ -754,6 +773,7 @@ var typescript = defineConfig([
|
|
|
754
773
|
}
|
|
755
774
|
},
|
|
756
775
|
{
|
|
776
|
+
name: "ntnyq/ts/test",
|
|
757
777
|
files: ["**/*.{spec,test}.ts?(x)"],
|
|
758
778
|
rules: {
|
|
759
779
|
"no-unused-expressions": "off",
|
|
@@ -761,6 +781,7 @@ var typescript = defineConfig([
|
|
|
761
781
|
}
|
|
762
782
|
},
|
|
763
783
|
{
|
|
784
|
+
name: "ntnyq/ts/cjs",
|
|
764
785
|
files: [GLOB_JS, "**/*.cjs"],
|
|
765
786
|
rules: {
|
|
766
787
|
"@typescript-eslint/no-var-requires": "off"
|
|
@@ -768,9 +789,21 @@ var typescript = defineConfig([
|
|
|
768
789
|
}
|
|
769
790
|
]);
|
|
770
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
|
+
|
|
771
803
|
// src/configs/unocss.ts
|
|
772
804
|
var unocss = defineConfig([
|
|
773
805
|
{
|
|
806
|
+
name: "ntnyq/unocss",
|
|
774
807
|
plugins: {
|
|
775
808
|
unocss: default4
|
|
776
809
|
},
|
|
@@ -784,11 +817,12 @@ var unocss = defineConfig([
|
|
|
784
817
|
|
|
785
818
|
// src/configs/command.ts
|
|
786
819
|
import createCommandPlugin from "eslint-plugin-command/config";
|
|
787
|
-
var command = defineConfig([createCommandPlugin()]);
|
|
820
|
+
var command = defineConfig([createCommandPlugin({})]);
|
|
788
821
|
|
|
789
822
|
// src/configs/yml.ts
|
|
790
823
|
var yml = defineConfig([
|
|
791
824
|
{
|
|
825
|
+
name: "ntnyq/yaml",
|
|
792
826
|
files: [GLOB_YAML],
|
|
793
827
|
languageOptions: {
|
|
794
828
|
parser: parserYaml
|
|
@@ -808,6 +842,7 @@ var yml = defineConfig([
|
|
|
808
842
|
// src/configs/sort.ts
|
|
809
843
|
var sortPackageJson = defineConfig([
|
|
810
844
|
{
|
|
845
|
+
name: "ntnyq/sort/package-json",
|
|
811
846
|
files: ["**/package.json"],
|
|
812
847
|
rules: {
|
|
813
848
|
"jsonc/sort-keys": [
|
|
@@ -906,6 +941,7 @@ var sortPackageJson = defineConfig([
|
|
|
906
941
|
]);
|
|
907
942
|
var sortTsConfig = defineConfig([
|
|
908
943
|
{
|
|
944
|
+
name: "ntnyq/sort/tsconfig",
|
|
909
945
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
910
946
|
rules: {
|
|
911
947
|
"jsonc/sort-keys": [
|
|
@@ -1023,6 +1059,7 @@ var sortTsConfig = defineConfig([
|
|
|
1023
1059
|
// src/configs/jsonc.ts
|
|
1024
1060
|
var jsonc = defineConfig([
|
|
1025
1061
|
{
|
|
1062
|
+
name: "ntnyq/jsonc",
|
|
1026
1063
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
|
|
1027
1064
|
plugins: {
|
|
1028
1065
|
jsonc: default10
|
|
@@ -1064,8 +1101,11 @@ var jsonc = defineConfig([
|
|
|
1064
1101
|
|
|
1065
1102
|
// src/configs/markdown.ts
|
|
1066
1103
|
var markdown = defineConfig([
|
|
1104
|
+
// TODO: Add config name for markdown plugin
|
|
1105
|
+
// wait for https://github.com/eslint/eslint-plugin-markdown/pull/256
|
|
1067
1106
|
...default7.configs.recommended,
|
|
1068
1107
|
{
|
|
1108
|
+
name: "ntnyq/markdown/extensions",
|
|
1069
1109
|
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
1070
1110
|
rules: {
|
|
1071
1111
|
"no-undef": "off",
|
|
@@ -1091,10 +1131,10 @@ var markdown = defineConfig([
|
|
|
1091
1131
|
]);
|
|
1092
1132
|
|
|
1093
1133
|
// src/configs/vue.ts
|
|
1094
|
-
import
|
|
1134
|
+
import process2 from "node:process";
|
|
1095
1135
|
import { getPackageInfoSync } from "local-pkg";
|
|
1096
1136
|
function getVueVersion() {
|
|
1097
|
-
const pkg = getPackageInfoSync("vue", { paths: [
|
|
1137
|
+
const pkg = getPackageInfoSync("vue", { paths: [process2.cwd()] });
|
|
1098
1138
|
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
1099
1139
|
return +pkg.version[0];
|
|
1100
1140
|
}
|
|
@@ -1115,10 +1155,12 @@ var vue3Rules = {
|
|
|
1115
1155
|
};
|
|
1116
1156
|
var vue = defineConfig([
|
|
1117
1157
|
...tseslint.config({
|
|
1158
|
+
name: "ntnyq/vue/ts",
|
|
1118
1159
|
files: [GLOB_VUE],
|
|
1119
1160
|
extends: typescriptCore
|
|
1120
1161
|
}),
|
|
1121
1162
|
{
|
|
1163
|
+
name: "ntnyq/vue/core",
|
|
1122
1164
|
files: [GLOB_VUE],
|
|
1123
1165
|
plugins: {
|
|
1124
1166
|
vue: default3,
|
|
@@ -1363,7 +1405,8 @@ var presetJavaScript = [
|
|
|
1363
1405
|
...imports,
|
|
1364
1406
|
...unicorn,
|
|
1365
1407
|
...comments,
|
|
1366
|
-
...javascript
|
|
1408
|
+
...javascript,
|
|
1409
|
+
...regexp
|
|
1367
1410
|
];
|
|
1368
1411
|
var presetBasic = [...presetJavaScript, ...typescript];
|
|
1369
1412
|
var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsConfig];
|
|
@@ -1448,6 +1491,7 @@ export {
|
|
|
1448
1491
|
default7 as pluginMarkdown,
|
|
1449
1492
|
default2 as pluginNode,
|
|
1450
1493
|
default6 as pluginPrettier,
|
|
1494
|
+
pluginRegexp,
|
|
1451
1495
|
default5 as pluginUnicorn,
|
|
1452
1496
|
default4 as pluginUnoCSS,
|
|
1453
1497
|
default3 as pluginVue,
|
|
@@ -1459,6 +1503,7 @@ export {
|
|
|
1459
1503
|
presetJsonc,
|
|
1460
1504
|
presetLanguageExtensions,
|
|
1461
1505
|
prettier,
|
|
1506
|
+
regexp,
|
|
1462
1507
|
sortPackageJson,
|
|
1463
1508
|
sortTsConfig,
|
|
1464
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",
|
|
@@ -58,21 +60,22 @@
|
|
|
58
60
|
"eslint-config-prettier": "^9.1.0",
|
|
59
61
|
"eslint-plugin-command": "^0.2.3",
|
|
60
62
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
61
|
-
"eslint-plugin-import-x": "^0.5.
|
|
63
|
+
"eslint-plugin-import-x": "^0.5.3",
|
|
62
64
|
"eslint-plugin-jsdoc": "^48.5.0",
|
|
63
65
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
64
66
|
"eslint-plugin-markdown": "^5.0.0",
|
|
65
67
|
"eslint-plugin-n": "^17.9.0",
|
|
66
68
|
"eslint-plugin-prettier": "^5.1.3",
|
|
69
|
+
"eslint-plugin-regexp": "^2.6.0",
|
|
67
70
|
"eslint-plugin-unicorn": "^54.0.0",
|
|
68
71
|
"eslint-plugin-unused-imports": "^4.0.0",
|
|
69
|
-
"eslint-plugin-vue": "^9.
|
|
72
|
+
"eslint-plugin-vue": "^9.27.0",
|
|
70
73
|
"eslint-plugin-yml": "^1.14.0",
|
|
71
|
-
"globals": "^15.
|
|
74
|
+
"globals": "^15.8.0",
|
|
72
75
|
"jsonc-eslint-parser": "^2.4.0",
|
|
73
76
|
"local-pkg": "^0.5.0",
|
|
74
77
|
"prettier": "^3.3.2",
|
|
75
|
-
"typescript-eslint": "^8.0.0-alpha.
|
|
78
|
+
"typescript-eslint": "^8.0.0-alpha.39",
|
|
76
79
|
"vue-eslint-parser": "^9.4.3",
|
|
77
80
|
"yaml-eslint-parser": "^1.2.3"
|
|
78
81
|
},
|
|
@@ -80,13 +83,14 @@
|
|
|
80
83
|
"@ntnyq/prettier-config": "^1.21.2",
|
|
81
84
|
"@types/node": "^20.14.9",
|
|
82
85
|
"bumpp": "^9.4.1",
|
|
83
|
-
"eslint": "^9.
|
|
86
|
+
"eslint": "^9.6.0",
|
|
84
87
|
"husky": "^9.0.11",
|
|
85
88
|
"nano-staged": "^0.8.0",
|
|
86
|
-
"npm-run-all2": "^6.2.
|
|
89
|
+
"npm-run-all2": "^6.2.2",
|
|
87
90
|
"rimraf": "^5.0.7",
|
|
88
91
|
"tsup": "^8.1.0",
|
|
89
|
-
"typescript": "^5.5.
|
|
92
|
+
"typescript": "^5.5.3",
|
|
93
|
+
"zx": "^8.1.4"
|
|
90
94
|
},
|
|
91
95
|
"engines": {
|
|
92
96
|
"node": ">=18.18"
|