@ntnyq/eslint-config 2.4.0 → 2.5.1
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 +57 -12
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +55 -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,14 @@ __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/postcss") || (0, import_local_pkg.isPackageExists)("@unocss/webpack") || (0, import_local_pkg.isPackageExists)("@unocss/nuxt");
|
|
110
116
|
|
|
111
117
|
// src/types.ts
|
|
112
118
|
function defineConfig(configs = []) {
|
|
@@ -193,6 +199,7 @@ var GLOB_EXCLUDE = [
|
|
|
193
199
|
// src/configs/ignores.ts
|
|
194
200
|
var ignores = defineConfig([
|
|
195
201
|
{
|
|
202
|
+
name: "ntnyq/ignores",
|
|
196
203
|
ignores: GLOB_EXCLUDE
|
|
197
204
|
}
|
|
198
205
|
]);
|
|
@@ -209,6 +216,7 @@ var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
|
|
|
209
216
|
var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
210
217
|
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
211
218
|
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
219
|
+
var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
|
|
212
220
|
var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
|
|
213
221
|
var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
|
|
214
222
|
var parserVue = __toESM(require("vue-eslint-parser"), 1);
|
|
@@ -221,6 +229,7 @@ function interopDefault(m) {
|
|
|
221
229
|
// src/configs/node.ts
|
|
222
230
|
var node = defineConfig([
|
|
223
231
|
{
|
|
232
|
+
name: "ntnyq/node",
|
|
224
233
|
plugins: {
|
|
225
234
|
node: import_eslint_plugin_n.default
|
|
226
235
|
},
|
|
@@ -240,6 +249,7 @@ var node = defineConfig([
|
|
|
240
249
|
// src/configs/jsdoc.ts
|
|
241
250
|
var jsdoc = defineConfig([
|
|
242
251
|
{
|
|
252
|
+
name: "ntnyq/jsdoc",
|
|
243
253
|
plugins: {
|
|
244
254
|
jsdoc: import_eslint_plugin_jsdoc.default
|
|
245
255
|
},
|
|
@@ -268,6 +278,7 @@ var jsdoc = defineConfig([
|
|
|
268
278
|
// src/configs/imports.ts
|
|
269
279
|
var imports = defineConfig([
|
|
270
280
|
{
|
|
281
|
+
name: "ntnyq/imports",
|
|
271
282
|
plugins: {
|
|
272
283
|
import: import_eslint_plugin_import_x.default
|
|
273
284
|
},
|
|
@@ -310,12 +321,12 @@ var imports = defineConfig([
|
|
|
310
321
|
// src/configs/unicorn.ts
|
|
311
322
|
var unicorn = defineConfig([
|
|
312
323
|
{
|
|
324
|
+
name: "ntnyq/unicorn",
|
|
313
325
|
plugins: {
|
|
314
326
|
unicorn: import_eslint_plugin_unicorn.default
|
|
315
327
|
},
|
|
316
328
|
rules: {
|
|
317
|
-
// Disabled
|
|
318
|
-
"unicorn/no-unsafe-regex": "off",
|
|
329
|
+
// Disabled for now
|
|
319
330
|
"unicorn/prefer-top-level-await": "off",
|
|
320
331
|
"unicorn/explicit-length-check": "off",
|
|
321
332
|
"unicorn/no-array-callback-reference": "off",
|
|
@@ -387,6 +398,7 @@ var unicorn = defineConfig([
|
|
|
387
398
|
var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
|
|
388
399
|
var prettier = defineConfig([
|
|
389
400
|
{
|
|
401
|
+
name: "ntnyq/prettier",
|
|
390
402
|
plugins: {
|
|
391
403
|
prettier: import_eslint_plugin_prettier.default
|
|
392
404
|
},
|
|
@@ -401,6 +413,7 @@ var prettier = defineConfig([
|
|
|
401
413
|
// src/configs/comments.ts
|
|
402
414
|
var comments = defineConfig([
|
|
403
415
|
{
|
|
416
|
+
name: "ntnyq/eslint-comments",
|
|
404
417
|
plugins: {
|
|
405
418
|
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
406
419
|
},
|
|
@@ -415,8 +428,12 @@ var comments = defineConfig([
|
|
|
415
428
|
var import_globals = __toESM(require("globals"), 1);
|
|
416
429
|
var import_js = __toESM(require("@eslint/js"), 1);
|
|
417
430
|
var javascript = defineConfig([
|
|
418
|
-
import_js.default.configs.recommended,
|
|
419
431
|
{
|
|
432
|
+
name: "ntnyq/js/recommended",
|
|
433
|
+
...import_js.default.configs.recommended
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
name: "ntnyq/js/core",
|
|
420
437
|
languageOptions: {
|
|
421
438
|
globals: {
|
|
422
439
|
...import_globals.default.browser,
|
|
@@ -611,7 +628,6 @@ var javascript = defineConfig([
|
|
|
611
628
|
semi: ["error", "never"],
|
|
612
629
|
"semi-spacing": ["error", { before: false, after: true }],
|
|
613
630
|
"space-before-blocks": ["error", "always"],
|
|
614
|
-
"space-before-function-paren": ["error", "never"],
|
|
615
631
|
"space-in-parens": ["error", "never"],
|
|
616
632
|
"space-infix-ops": "error",
|
|
617
633
|
"space-unary-ops": ["error", { words: true, nonwords: false }],
|
|
@@ -627,7 +643,6 @@ var javascript = defineConfig([
|
|
|
627
643
|
],
|
|
628
644
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
629
645
|
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
630
|
-
"yield-star-spacing": ["error", "both"],
|
|
631
646
|
yoda: ["error", "never"],
|
|
632
647
|
// es6+
|
|
633
648
|
"no-var": "error",
|
|
@@ -763,12 +778,14 @@ var javascript = defineConfig([
|
|
|
763
778
|
}
|
|
764
779
|
},
|
|
765
780
|
{
|
|
781
|
+
name: "ntnyq/js/script",
|
|
766
782
|
files: ["**/scripts/*", "**/cli.*"],
|
|
767
783
|
rules: {
|
|
768
784
|
"no-console": "off"
|
|
769
785
|
}
|
|
770
786
|
},
|
|
771
787
|
{
|
|
788
|
+
name: "ntnyq/js/test",
|
|
772
789
|
files: ["**/*.{test,spec}.js?(x)"],
|
|
773
790
|
rules: {
|
|
774
791
|
"no-unused-expressions": "off",
|
|
@@ -778,6 +795,7 @@ var javascript = defineConfig([
|
|
|
778
795
|
]);
|
|
779
796
|
var jsx = defineConfig([
|
|
780
797
|
{
|
|
798
|
+
name: "ntnyq/jsx",
|
|
781
799
|
files: ["**/*.jsx"],
|
|
782
800
|
languageOptions: {
|
|
783
801
|
parserOptions: {
|
|
@@ -791,6 +809,7 @@ var jsx = defineConfig([
|
|
|
791
809
|
|
|
792
810
|
// src/configs/typescript.ts
|
|
793
811
|
var typescriptCore = import_typescript_eslint.default.config({
|
|
812
|
+
name: "ntnyq/ts/core",
|
|
794
813
|
extends: [...import_typescript_eslint.default.configs.recommended],
|
|
795
814
|
files: [GLOB_TS, GLOB_TSX],
|
|
796
815
|
languageOptions: {
|
|
@@ -837,7 +856,6 @@ var typescriptCore = import_typescript_eslint.default.config({
|
|
|
837
856
|
"@typescript-eslint/no-explicit-any": "off",
|
|
838
857
|
"@typescript-eslint/no-empty-function": "off",
|
|
839
858
|
"@typescript-eslint/naming-convention": "off",
|
|
840
|
-
"@typescript-eslint/no-empty-interface": "off",
|
|
841
859
|
"@typescript-eslint/no-empty-object-type": "off",
|
|
842
860
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
843
861
|
"@typescript-eslint/triple-slash-reference": "off",
|
|
@@ -851,6 +869,7 @@ var typescriptCore = import_typescript_eslint.default.config({
|
|
|
851
869
|
var typescript = defineConfig([
|
|
852
870
|
...typescriptCore,
|
|
853
871
|
{
|
|
872
|
+
name: "ntnyq/ts/dts",
|
|
854
873
|
files: ["**/*.d.ts"],
|
|
855
874
|
rules: {
|
|
856
875
|
"import/no-duplicates": "off",
|
|
@@ -858,6 +877,7 @@ var typescript = defineConfig([
|
|
|
858
877
|
}
|
|
859
878
|
},
|
|
860
879
|
{
|
|
880
|
+
name: "ntnyq/ts/test",
|
|
861
881
|
files: ["**/*.{spec,test}.ts?(x)"],
|
|
862
882
|
rules: {
|
|
863
883
|
"no-unused-expressions": "off",
|
|
@@ -865,6 +885,7 @@ var typescript = defineConfig([
|
|
|
865
885
|
}
|
|
866
886
|
},
|
|
867
887
|
{
|
|
888
|
+
name: "ntnyq/ts/cjs",
|
|
868
889
|
files: [GLOB_JS, "**/*.cjs"],
|
|
869
890
|
rules: {
|
|
870
891
|
"@typescript-eslint/no-var-requires": "off"
|
|
@@ -872,9 +893,21 @@ var typescript = defineConfig([
|
|
|
872
893
|
}
|
|
873
894
|
]);
|
|
874
895
|
|
|
896
|
+
// src/configs/regexp.ts
|
|
897
|
+
var regexp = defineConfig([
|
|
898
|
+
/**
|
|
899
|
+
* https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/rules/recommended.ts
|
|
900
|
+
*/
|
|
901
|
+
{
|
|
902
|
+
name: "ntnyq/regexp",
|
|
903
|
+
...pluginRegexp.configs["flat/recommended"]
|
|
904
|
+
}
|
|
905
|
+
]);
|
|
906
|
+
|
|
875
907
|
// src/configs/unocss.ts
|
|
876
908
|
var unocss = defineConfig([
|
|
877
909
|
{
|
|
910
|
+
name: "ntnyq/unocss",
|
|
878
911
|
plugins: {
|
|
879
912
|
unocss: import_eslint_plugin.default
|
|
880
913
|
},
|
|
@@ -888,11 +921,12 @@ var unocss = defineConfig([
|
|
|
888
921
|
|
|
889
922
|
// src/configs/command.ts
|
|
890
923
|
var import_config = __toESM(require("eslint-plugin-command/config"), 1);
|
|
891
|
-
var command = defineConfig([(0, import_config.default)()]);
|
|
924
|
+
var command = defineConfig([(0, import_config.default)({})]);
|
|
892
925
|
|
|
893
926
|
// src/configs/yml.ts
|
|
894
927
|
var yml = defineConfig([
|
|
895
928
|
{
|
|
929
|
+
name: "ntnyq/yaml",
|
|
896
930
|
files: [GLOB_YAML],
|
|
897
931
|
languageOptions: {
|
|
898
932
|
parser: parserYaml
|
|
@@ -912,6 +946,7 @@ var yml = defineConfig([
|
|
|
912
946
|
// src/configs/sort.ts
|
|
913
947
|
var sortPackageJson = defineConfig([
|
|
914
948
|
{
|
|
949
|
+
name: "ntnyq/sort/package-json",
|
|
915
950
|
files: ["**/package.json"],
|
|
916
951
|
rules: {
|
|
917
952
|
"jsonc/sort-keys": [
|
|
@@ -1010,6 +1045,7 @@ var sortPackageJson = defineConfig([
|
|
|
1010
1045
|
]);
|
|
1011
1046
|
var sortTsConfig = defineConfig([
|
|
1012
1047
|
{
|
|
1048
|
+
name: "ntnyq/sort/tsconfig",
|
|
1013
1049
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
1014
1050
|
rules: {
|
|
1015
1051
|
"jsonc/sort-keys": [
|
|
@@ -1127,6 +1163,7 @@ var sortTsConfig = defineConfig([
|
|
|
1127
1163
|
// src/configs/jsonc.ts
|
|
1128
1164
|
var jsonc = defineConfig([
|
|
1129
1165
|
{
|
|
1166
|
+
name: "ntnyq/jsonc",
|
|
1130
1167
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
|
|
1131
1168
|
plugins: {
|
|
1132
1169
|
jsonc: import_eslint_plugin_jsonc.default
|
|
@@ -1168,8 +1205,11 @@ var jsonc = defineConfig([
|
|
|
1168
1205
|
|
|
1169
1206
|
// src/configs/markdown.ts
|
|
1170
1207
|
var markdown = defineConfig([
|
|
1208
|
+
// TODO: Add config name for markdown plugin
|
|
1209
|
+
// wait for https://github.com/eslint/eslint-plugin-markdown/pull/256
|
|
1171
1210
|
...import_eslint_plugin_markdown.default.configs.recommended,
|
|
1172
1211
|
{
|
|
1212
|
+
name: "ntnyq/markdown/extensions",
|
|
1173
1213
|
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
1174
1214
|
rules: {
|
|
1175
1215
|
"no-undef": "off",
|
|
@@ -1195,10 +1235,10 @@ var markdown = defineConfig([
|
|
|
1195
1235
|
]);
|
|
1196
1236
|
|
|
1197
1237
|
// src/configs/vue.ts
|
|
1198
|
-
var
|
|
1238
|
+
var import_node_process2 = __toESM(require("process"), 1);
|
|
1199
1239
|
var import_local_pkg2 = require("local-pkg");
|
|
1200
1240
|
function getVueVersion() {
|
|
1201
|
-
const pkg = (0, import_local_pkg2.getPackageInfoSync)("vue", { paths: [
|
|
1241
|
+
const pkg = (0, import_local_pkg2.getPackageInfoSync)("vue", { paths: [import_node_process2.default.cwd()] });
|
|
1202
1242
|
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
1203
1243
|
return +pkg.version[0];
|
|
1204
1244
|
}
|
|
@@ -1219,10 +1259,12 @@ var vue3Rules = {
|
|
|
1219
1259
|
};
|
|
1220
1260
|
var vue = defineConfig([
|
|
1221
1261
|
...import_typescript_eslint.default.config({
|
|
1262
|
+
name: "ntnyq/vue/ts",
|
|
1222
1263
|
files: [GLOB_VUE],
|
|
1223
1264
|
extends: typescriptCore
|
|
1224
1265
|
}),
|
|
1225
1266
|
{
|
|
1267
|
+
name: "ntnyq/vue/core",
|
|
1226
1268
|
files: [GLOB_VUE],
|
|
1227
1269
|
plugins: {
|
|
1228
1270
|
vue: import_eslint_plugin_vue.default,
|
|
@@ -1467,7 +1509,8 @@ var presetJavaScript = [
|
|
|
1467
1509
|
...imports,
|
|
1468
1510
|
...unicorn,
|
|
1469
1511
|
...comments,
|
|
1470
|
-
...javascript
|
|
1512
|
+
...javascript,
|
|
1513
|
+
...regexp
|
|
1471
1514
|
];
|
|
1472
1515
|
var presetBasic = [...presetJavaScript, ...typescript];
|
|
1473
1516
|
var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsConfig];
|
|
@@ -1553,6 +1596,7 @@ function ntnyq(config = [], {
|
|
|
1553
1596
|
pluginMarkdown,
|
|
1554
1597
|
pluginNode,
|
|
1555
1598
|
pluginPrettier,
|
|
1599
|
+
pluginRegexp,
|
|
1556
1600
|
pluginUnicorn,
|
|
1557
1601
|
pluginUnoCSS,
|
|
1558
1602
|
pluginVue,
|
|
@@ -1564,6 +1608,7 @@ function ntnyq(config = [], {
|
|
|
1564
1608
|
presetJsonc,
|
|
1565
1609
|
presetLanguageExtensions,
|
|
1566
1610
|
prettier,
|
|
1611
|
+
regexp,
|
|
1567
1612
|
sortPackageJson,
|
|
1568
1613
|
sortTsConfig,
|
|
1569
1614
|
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,12 @@
|
|
|
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/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
|
|
6
10
|
|
|
7
11
|
// src/types.ts
|
|
8
12
|
function defineConfig(configs = []) {
|
|
@@ -89,6 +93,7 @@ var GLOB_EXCLUDE = [
|
|
|
89
93
|
// src/configs/ignores.ts
|
|
90
94
|
var ignores = defineConfig([
|
|
91
95
|
{
|
|
96
|
+
name: "ntnyq/ignores",
|
|
92
97
|
ignores: GLOB_EXCLUDE
|
|
93
98
|
}
|
|
94
99
|
]);
|
|
@@ -105,6 +110,7 @@ import { default as default9 } from "eslint-plugin-yml";
|
|
|
105
110
|
import { default as default10 } from "eslint-plugin-jsonc";
|
|
106
111
|
import { default as default11 } from "eslint-plugin-import-x";
|
|
107
112
|
import { default as default12 } from "eslint-plugin-jsdoc";
|
|
113
|
+
import * as pluginRegexp from "eslint-plugin-regexp";
|
|
108
114
|
import tseslint from "typescript-eslint";
|
|
109
115
|
import * as parserYaml from "yaml-eslint-parser";
|
|
110
116
|
import * as parserVue from "vue-eslint-parser";
|
|
@@ -117,6 +123,7 @@ function interopDefault(m) {
|
|
|
117
123
|
// src/configs/node.ts
|
|
118
124
|
var node = defineConfig([
|
|
119
125
|
{
|
|
126
|
+
name: "ntnyq/node",
|
|
120
127
|
plugins: {
|
|
121
128
|
node: default2
|
|
122
129
|
},
|
|
@@ -136,6 +143,7 @@ var node = defineConfig([
|
|
|
136
143
|
// src/configs/jsdoc.ts
|
|
137
144
|
var jsdoc = defineConfig([
|
|
138
145
|
{
|
|
146
|
+
name: "ntnyq/jsdoc",
|
|
139
147
|
plugins: {
|
|
140
148
|
jsdoc: default12
|
|
141
149
|
},
|
|
@@ -164,6 +172,7 @@ var jsdoc = defineConfig([
|
|
|
164
172
|
// src/configs/imports.ts
|
|
165
173
|
var imports = defineConfig([
|
|
166
174
|
{
|
|
175
|
+
name: "ntnyq/imports",
|
|
167
176
|
plugins: {
|
|
168
177
|
import: default11
|
|
169
178
|
},
|
|
@@ -206,12 +215,12 @@ var imports = defineConfig([
|
|
|
206
215
|
// src/configs/unicorn.ts
|
|
207
216
|
var unicorn = defineConfig([
|
|
208
217
|
{
|
|
218
|
+
name: "ntnyq/unicorn",
|
|
209
219
|
plugins: {
|
|
210
220
|
unicorn: default5
|
|
211
221
|
},
|
|
212
222
|
rules: {
|
|
213
|
-
// Disabled
|
|
214
|
-
"unicorn/no-unsafe-regex": "off",
|
|
223
|
+
// Disabled for now
|
|
215
224
|
"unicorn/prefer-top-level-await": "off",
|
|
216
225
|
"unicorn/explicit-length-check": "off",
|
|
217
226
|
"unicorn/no-array-callback-reference": "off",
|
|
@@ -283,6 +292,7 @@ var unicorn = defineConfig([
|
|
|
283
292
|
import prettierConfig from "eslint-config-prettier";
|
|
284
293
|
var prettier = defineConfig([
|
|
285
294
|
{
|
|
295
|
+
name: "ntnyq/prettier",
|
|
286
296
|
plugins: {
|
|
287
297
|
prettier: default6
|
|
288
298
|
},
|
|
@@ -297,6 +307,7 @@ var prettier = defineConfig([
|
|
|
297
307
|
// src/configs/comments.ts
|
|
298
308
|
var comments = defineConfig([
|
|
299
309
|
{
|
|
310
|
+
name: "ntnyq/eslint-comments",
|
|
300
311
|
plugins: {
|
|
301
312
|
"eslint-comments": default8
|
|
302
313
|
},
|
|
@@ -311,8 +322,12 @@ var comments = defineConfig([
|
|
|
311
322
|
import globals from "globals";
|
|
312
323
|
import jsConfig from "@eslint/js";
|
|
313
324
|
var javascript = defineConfig([
|
|
314
|
-
jsConfig.configs.recommended,
|
|
315
325
|
{
|
|
326
|
+
name: "ntnyq/js/recommended",
|
|
327
|
+
...jsConfig.configs.recommended
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
name: "ntnyq/js/core",
|
|
316
331
|
languageOptions: {
|
|
317
332
|
globals: {
|
|
318
333
|
...globals.browser,
|
|
@@ -507,7 +522,6 @@ var javascript = defineConfig([
|
|
|
507
522
|
semi: ["error", "never"],
|
|
508
523
|
"semi-spacing": ["error", { before: false, after: true }],
|
|
509
524
|
"space-before-blocks": ["error", "always"],
|
|
510
|
-
"space-before-function-paren": ["error", "never"],
|
|
511
525
|
"space-in-parens": ["error", "never"],
|
|
512
526
|
"space-infix-ops": "error",
|
|
513
527
|
"space-unary-ops": ["error", { words: true, nonwords: false }],
|
|
@@ -523,7 +537,6 @@ var javascript = defineConfig([
|
|
|
523
537
|
],
|
|
524
538
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
525
539
|
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
526
|
-
"yield-star-spacing": ["error", "both"],
|
|
527
540
|
yoda: ["error", "never"],
|
|
528
541
|
// es6+
|
|
529
542
|
"no-var": "error",
|
|
@@ -659,12 +672,14 @@ var javascript = defineConfig([
|
|
|
659
672
|
}
|
|
660
673
|
},
|
|
661
674
|
{
|
|
675
|
+
name: "ntnyq/js/script",
|
|
662
676
|
files: ["**/scripts/*", "**/cli.*"],
|
|
663
677
|
rules: {
|
|
664
678
|
"no-console": "off"
|
|
665
679
|
}
|
|
666
680
|
},
|
|
667
681
|
{
|
|
682
|
+
name: "ntnyq/js/test",
|
|
668
683
|
files: ["**/*.{test,spec}.js?(x)"],
|
|
669
684
|
rules: {
|
|
670
685
|
"no-unused-expressions": "off",
|
|
@@ -674,6 +689,7 @@ var javascript = defineConfig([
|
|
|
674
689
|
]);
|
|
675
690
|
var jsx = defineConfig([
|
|
676
691
|
{
|
|
692
|
+
name: "ntnyq/jsx",
|
|
677
693
|
files: ["**/*.jsx"],
|
|
678
694
|
languageOptions: {
|
|
679
695
|
parserOptions: {
|
|
@@ -687,6 +703,7 @@ var jsx = defineConfig([
|
|
|
687
703
|
|
|
688
704
|
// src/configs/typescript.ts
|
|
689
705
|
var typescriptCore = tseslint.config({
|
|
706
|
+
name: "ntnyq/ts/core",
|
|
690
707
|
extends: [...tseslint.configs.recommended],
|
|
691
708
|
files: [GLOB_TS, GLOB_TSX],
|
|
692
709
|
languageOptions: {
|
|
@@ -733,7 +750,6 @@ var typescriptCore = tseslint.config({
|
|
|
733
750
|
"@typescript-eslint/no-explicit-any": "off",
|
|
734
751
|
"@typescript-eslint/no-empty-function": "off",
|
|
735
752
|
"@typescript-eslint/naming-convention": "off",
|
|
736
|
-
"@typescript-eslint/no-empty-interface": "off",
|
|
737
753
|
"@typescript-eslint/no-empty-object-type": "off",
|
|
738
754
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
739
755
|
"@typescript-eslint/triple-slash-reference": "off",
|
|
@@ -747,6 +763,7 @@ var typescriptCore = tseslint.config({
|
|
|
747
763
|
var typescript = defineConfig([
|
|
748
764
|
...typescriptCore,
|
|
749
765
|
{
|
|
766
|
+
name: "ntnyq/ts/dts",
|
|
750
767
|
files: ["**/*.d.ts"],
|
|
751
768
|
rules: {
|
|
752
769
|
"import/no-duplicates": "off",
|
|
@@ -754,6 +771,7 @@ var typescript = defineConfig([
|
|
|
754
771
|
}
|
|
755
772
|
},
|
|
756
773
|
{
|
|
774
|
+
name: "ntnyq/ts/test",
|
|
757
775
|
files: ["**/*.{spec,test}.ts?(x)"],
|
|
758
776
|
rules: {
|
|
759
777
|
"no-unused-expressions": "off",
|
|
@@ -761,6 +779,7 @@ var typescript = defineConfig([
|
|
|
761
779
|
}
|
|
762
780
|
},
|
|
763
781
|
{
|
|
782
|
+
name: "ntnyq/ts/cjs",
|
|
764
783
|
files: [GLOB_JS, "**/*.cjs"],
|
|
765
784
|
rules: {
|
|
766
785
|
"@typescript-eslint/no-var-requires": "off"
|
|
@@ -768,9 +787,21 @@ var typescript = defineConfig([
|
|
|
768
787
|
}
|
|
769
788
|
]);
|
|
770
789
|
|
|
790
|
+
// src/configs/regexp.ts
|
|
791
|
+
var regexp = defineConfig([
|
|
792
|
+
/**
|
|
793
|
+
* https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/rules/recommended.ts
|
|
794
|
+
*/
|
|
795
|
+
{
|
|
796
|
+
name: "ntnyq/regexp",
|
|
797
|
+
...pluginRegexp.configs["flat/recommended"]
|
|
798
|
+
}
|
|
799
|
+
]);
|
|
800
|
+
|
|
771
801
|
// src/configs/unocss.ts
|
|
772
802
|
var unocss = defineConfig([
|
|
773
803
|
{
|
|
804
|
+
name: "ntnyq/unocss",
|
|
774
805
|
plugins: {
|
|
775
806
|
unocss: default4
|
|
776
807
|
},
|
|
@@ -784,11 +815,12 @@ var unocss = defineConfig([
|
|
|
784
815
|
|
|
785
816
|
// src/configs/command.ts
|
|
786
817
|
import createCommandPlugin from "eslint-plugin-command/config";
|
|
787
|
-
var command = defineConfig([createCommandPlugin()]);
|
|
818
|
+
var command = defineConfig([createCommandPlugin({})]);
|
|
788
819
|
|
|
789
820
|
// src/configs/yml.ts
|
|
790
821
|
var yml = defineConfig([
|
|
791
822
|
{
|
|
823
|
+
name: "ntnyq/yaml",
|
|
792
824
|
files: [GLOB_YAML],
|
|
793
825
|
languageOptions: {
|
|
794
826
|
parser: parserYaml
|
|
@@ -808,6 +840,7 @@ var yml = defineConfig([
|
|
|
808
840
|
// src/configs/sort.ts
|
|
809
841
|
var sortPackageJson = defineConfig([
|
|
810
842
|
{
|
|
843
|
+
name: "ntnyq/sort/package-json",
|
|
811
844
|
files: ["**/package.json"],
|
|
812
845
|
rules: {
|
|
813
846
|
"jsonc/sort-keys": [
|
|
@@ -906,6 +939,7 @@ var sortPackageJson = defineConfig([
|
|
|
906
939
|
]);
|
|
907
940
|
var sortTsConfig = defineConfig([
|
|
908
941
|
{
|
|
942
|
+
name: "ntnyq/sort/tsconfig",
|
|
909
943
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
910
944
|
rules: {
|
|
911
945
|
"jsonc/sort-keys": [
|
|
@@ -1023,6 +1057,7 @@ var sortTsConfig = defineConfig([
|
|
|
1023
1057
|
// src/configs/jsonc.ts
|
|
1024
1058
|
var jsonc = defineConfig([
|
|
1025
1059
|
{
|
|
1060
|
+
name: "ntnyq/jsonc",
|
|
1026
1061
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
|
|
1027
1062
|
plugins: {
|
|
1028
1063
|
jsonc: default10
|
|
@@ -1064,8 +1099,11 @@ var jsonc = defineConfig([
|
|
|
1064
1099
|
|
|
1065
1100
|
// src/configs/markdown.ts
|
|
1066
1101
|
var markdown = defineConfig([
|
|
1102
|
+
// TODO: Add config name for markdown plugin
|
|
1103
|
+
// wait for https://github.com/eslint/eslint-plugin-markdown/pull/256
|
|
1067
1104
|
...default7.configs.recommended,
|
|
1068
1105
|
{
|
|
1106
|
+
name: "ntnyq/markdown/extensions",
|
|
1069
1107
|
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
1070
1108
|
rules: {
|
|
1071
1109
|
"no-undef": "off",
|
|
@@ -1091,10 +1129,10 @@ var markdown = defineConfig([
|
|
|
1091
1129
|
]);
|
|
1092
1130
|
|
|
1093
1131
|
// src/configs/vue.ts
|
|
1094
|
-
import
|
|
1132
|
+
import process2 from "node:process";
|
|
1095
1133
|
import { getPackageInfoSync } from "local-pkg";
|
|
1096
1134
|
function getVueVersion() {
|
|
1097
|
-
const pkg = getPackageInfoSync("vue", { paths: [
|
|
1135
|
+
const pkg = getPackageInfoSync("vue", { paths: [process2.cwd()] });
|
|
1098
1136
|
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
1099
1137
|
return +pkg.version[0];
|
|
1100
1138
|
}
|
|
@@ -1115,10 +1153,12 @@ var vue3Rules = {
|
|
|
1115
1153
|
};
|
|
1116
1154
|
var vue = defineConfig([
|
|
1117
1155
|
...tseslint.config({
|
|
1156
|
+
name: "ntnyq/vue/ts",
|
|
1118
1157
|
files: [GLOB_VUE],
|
|
1119
1158
|
extends: typescriptCore
|
|
1120
1159
|
}),
|
|
1121
1160
|
{
|
|
1161
|
+
name: "ntnyq/vue/core",
|
|
1122
1162
|
files: [GLOB_VUE],
|
|
1123
1163
|
plugins: {
|
|
1124
1164
|
vue: default3,
|
|
@@ -1363,7 +1403,8 @@ var presetJavaScript = [
|
|
|
1363
1403
|
...imports,
|
|
1364
1404
|
...unicorn,
|
|
1365
1405
|
...comments,
|
|
1366
|
-
...javascript
|
|
1406
|
+
...javascript,
|
|
1407
|
+
...regexp
|
|
1367
1408
|
];
|
|
1368
1409
|
var presetBasic = [...presetJavaScript, ...typescript];
|
|
1369
1410
|
var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsConfig];
|
|
@@ -1448,6 +1489,7 @@ export {
|
|
|
1448
1489
|
default7 as pluginMarkdown,
|
|
1449
1490
|
default2 as pluginNode,
|
|
1450
1491
|
default6 as pluginPrettier,
|
|
1492
|
+
pluginRegexp,
|
|
1451
1493
|
default5 as pluginUnicorn,
|
|
1452
1494
|
default4 as pluginUnoCSS,
|
|
1453
1495
|
default3 as pluginVue,
|
|
@@ -1459,6 +1501,7 @@ export {
|
|
|
1459
1501
|
presetJsonc,
|
|
1460
1502
|
presetLanguageExtensions,
|
|
1461
1503
|
prettier,
|
|
1504
|
+
regexp,
|
|
1462
1505
|
sortPackageJson,
|
|
1463
1506
|
sortTsConfig,
|
|
1464
1507
|
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.1",
|
|
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"
|