@ntnyq/eslint-config 2.2.1 → 2.3.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 CHANGED
@@ -53,6 +53,7 @@ __export(src_exports, {
53
53
  GLOB_VUE: () => GLOB_VUE,
54
54
  GLOB_YAML: () => GLOB_YAML,
55
55
  comments: () => comments,
56
+ defineConfig: () => defineConfig,
56
57
  getVueVersion: () => getVueVersion,
57
58
  hasTypeScript: () => hasTypeScript,
58
59
  hasUnoCSS: () => hasUnoCSS,
@@ -106,6 +107,11 @@ var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
106
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");
107
108
  var hasUnoCSS = (0, import_local_pkg.isPackageExists)("unocss") || (0, import_local_pkg.isPackageExists)("@unocss/webpack") || (0, import_local_pkg.isPackageExists)("@unocss/nuxt");
108
109
 
110
+ // src/types.ts
111
+ function defineConfig(configs = []) {
112
+ return configs;
113
+ }
114
+
109
115
  // src/globs.ts
110
116
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
111
117
  var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
@@ -146,6 +152,11 @@ var GLOB_EXCLUDE = [
146
152
  GLOB_NODE_MODULES,
147
153
  GLOB_DIST,
148
154
  ...GLOB_LOCKFILE,
155
+ // Force lint
156
+ "!.github",
157
+ "!.vitepress",
158
+ "!.vuepress",
159
+ "!.vscode",
149
160
  "**/CHANGELOG*.md",
150
161
  "**/*.min.*",
151
162
  "**/LICENSE*",
@@ -161,9 +172,9 @@ var GLOB_EXCLUDE = [
161
172
  "**/output",
162
173
  "**/public",
163
174
  "**/static",
164
- "**/temp",
165
- "**/cache",
166
- "**/.vitepress/cache",
175
+ // VitePress VuePress
176
+ "**/?(.)temp",
177
+ "**/?(.)cache",
167
178
  "**/.eslintcache",
168
179
  "**/.stylelintcache",
169
180
  "**/.vite-inspect",
@@ -175,28 +186,16 @@ var GLOB_EXCLUDE = [
175
186
  "**/.vercel",
176
187
  "**/.changeset",
177
188
  "**/.npmrc",
178
- "**/.yarnrc",
179
- // Force lint
180
- "!.github",
181
- "!.vitepress",
182
- "!.vuepress",
183
- "!.vscode"
189
+ "**/.yarnrc"
184
190
  ];
185
191
 
186
- // src/presets.ts
187
- var import_eslint_define_config16 = require("eslint-define-config");
188
-
189
192
  // src/configs/ignores.ts
190
- var import_eslint_define_config = require("eslint-define-config");
191
- var ignores = (0, import_eslint_define_config.defineFlatConfig)([
193
+ var ignores = defineConfig([
192
194
  {
193
195
  ignores: GLOB_EXCLUDE
194
196
  }
195
197
  ]);
196
198
 
197
- // src/configs/node.ts
198
- var import_eslint_define_config2 = require("eslint-define-config");
199
-
200
199
  // src/plugins.ts
201
200
  var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
202
201
  var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
@@ -219,7 +218,7 @@ function interopDefault(m) {
219
218
  }
220
219
 
221
220
  // src/configs/node.ts
222
- var node = (0, import_eslint_define_config2.defineFlatConfig)([
221
+ var node = defineConfig([
223
222
  {
224
223
  plugins: {
225
224
  node: import_eslint_plugin_n.default
@@ -238,8 +237,7 @@ var node = (0, import_eslint_define_config2.defineFlatConfig)([
238
237
  ]);
239
238
 
240
239
  // src/configs/jsdoc.ts
241
- var import_eslint_define_config3 = require("eslint-define-config");
242
- var jsdoc = (0, import_eslint_define_config3.defineFlatConfig)([
240
+ var jsdoc = defineConfig([
243
241
  {
244
242
  plugins: {
245
243
  jsdoc: import_eslint_plugin_jsdoc.default
@@ -267,8 +265,7 @@ var jsdoc = (0, import_eslint_define_config3.defineFlatConfig)([
267
265
  ]);
268
266
 
269
267
  // src/configs/imports.ts
270
- var import_eslint_define_config4 = require("eslint-define-config");
271
- var imports = (0, import_eslint_define_config4.defineFlatConfig)([
268
+ var imports = defineConfig([
272
269
  {
273
270
  plugins: {
274
271
  import: import_eslint_plugin_import_x.default
@@ -310,8 +307,7 @@ var imports = (0, import_eslint_define_config4.defineFlatConfig)([
310
307
  ]);
311
308
 
312
309
  // src/configs/unicorn.ts
313
- var import_eslint_define_config5 = require("eslint-define-config");
314
- var unicorn = (0, import_eslint_define_config5.defineFlatConfig)([
310
+ var unicorn = defineConfig([
315
311
  {
316
312
  plugins: {
317
313
  unicorn: import_eslint_plugin_unicorn.default
@@ -387,8 +383,7 @@ var unicorn = (0, import_eslint_define_config5.defineFlatConfig)([
387
383
 
388
384
  // src/configs/prettier.ts
389
385
  var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
390
- var import_eslint_define_config6 = require("eslint-define-config");
391
- var prettier = (0, import_eslint_define_config6.defineFlatConfig)([
386
+ var prettier = defineConfig([
392
387
  {
393
388
  plugins: {
394
389
  prettier: import_eslint_plugin_prettier.default
@@ -402,8 +397,7 @@ var prettier = (0, import_eslint_define_config6.defineFlatConfig)([
402
397
  ]);
403
398
 
404
399
  // src/configs/comments.ts
405
- var import_eslint_define_config7 = require("eslint-define-config");
406
- var comments = (0, import_eslint_define_config7.defineFlatConfig)([
400
+ var comments = defineConfig([
407
401
  {
408
402
  plugins: {
409
403
  "eslint-comments": import_eslint_plugin_eslint_comments.default
@@ -418,8 +412,7 @@ var comments = (0, import_eslint_define_config7.defineFlatConfig)([
418
412
  // src/configs/javascript.ts
419
413
  var import_globals = __toESM(require("globals"), 1);
420
414
  var import_js = __toESM(require("@eslint/js"), 1);
421
- var import_eslint_define_config8 = require("eslint-define-config");
422
- var javascript = (0, import_eslint_define_config8.defineFlatConfig)([
415
+ var javascript = defineConfig([
423
416
  import_js.default.configs.recommended,
424
417
  {
425
418
  languageOptions: {
@@ -781,7 +774,7 @@ var javascript = (0, import_eslint_define_config8.defineFlatConfig)([
781
774
  }
782
775
  }
783
776
  ]);
784
- var jsx = (0, import_eslint_define_config8.defineFlatConfig)([
777
+ var jsx = defineConfig([
785
778
  {
786
779
  files: ["**/*.jsx"],
787
780
  languageOptions: {
@@ -795,7 +788,6 @@ var jsx = (0, import_eslint_define_config8.defineFlatConfig)([
795
788
  ]);
796
789
 
797
790
  // src/configs/typescript.ts
798
- var import_eslint_define_config9 = require("eslint-define-config");
799
791
  var typescriptCore = import_typescript_eslint.default.config({
800
792
  extends: [...import_typescript_eslint.default.configs.recommended],
801
793
  files: [GLOB_TS, GLOB_TSX],
@@ -854,7 +846,7 @@ var typescriptCore = import_typescript_eslint.default.config({
854
846
  "@typescript-eslint/consistent-indexed-object-style": "off"
855
847
  }
856
848
  });
857
- var typescript = (0, import_eslint_define_config9.defineFlatConfig)([
849
+ var typescript = defineConfig([
858
850
  ...typescriptCore,
859
851
  {
860
852
  files: ["**/*.d.ts"],
@@ -879,8 +871,7 @@ var typescript = (0, import_eslint_define_config9.defineFlatConfig)([
879
871
  ]);
880
872
 
881
873
  // src/configs/unocss.ts
882
- var import_eslint_define_config10 = require("eslint-define-config");
883
- var unocss = (0, import_eslint_define_config10.defineFlatConfig)([
874
+ var unocss = defineConfig([
884
875
  {
885
876
  plugins: {
886
877
  unocss: import_eslint_plugin.default
@@ -894,8 +885,7 @@ var unocss = (0, import_eslint_define_config10.defineFlatConfig)([
894
885
  ]);
895
886
 
896
887
  // src/configs/yml.ts
897
- var import_eslint_define_config11 = require("eslint-define-config");
898
- var yml = (0, import_eslint_define_config11.defineFlatConfig)([
888
+ var yml = defineConfig([
899
889
  {
900
890
  files: [GLOB_YAML],
901
891
  languageOptions: {
@@ -914,8 +904,7 @@ var yml = (0, import_eslint_define_config11.defineFlatConfig)([
914
904
  ]);
915
905
 
916
906
  // src/configs/sort.ts
917
- var import_eslint_define_config12 = require("eslint-define-config");
918
- var sortPackageJson = (0, import_eslint_define_config12.defineFlatConfig)([
907
+ var sortPackageJson = defineConfig([
919
908
  {
920
909
  files: ["**/package.json"],
921
910
  rules: {
@@ -1013,7 +1002,7 @@ var sortPackageJson = (0, import_eslint_define_config12.defineFlatConfig)([
1013
1002
  }
1014
1003
  }
1015
1004
  ]);
1016
- var sortTsConfig = (0, import_eslint_define_config12.defineFlatConfig)([
1005
+ var sortTsConfig = defineConfig([
1017
1006
  {
1018
1007
  files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1019
1008
  rules: {
@@ -1130,8 +1119,7 @@ var sortTsConfig = (0, import_eslint_define_config12.defineFlatConfig)([
1130
1119
  ]);
1131
1120
 
1132
1121
  // src/configs/jsonc.ts
1133
- var import_eslint_define_config13 = require("eslint-define-config");
1134
- var jsonc = (0, import_eslint_define_config13.defineFlatConfig)([
1122
+ var jsonc = defineConfig([
1135
1123
  {
1136
1124
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
1137
1125
  plugins: {
@@ -1173,8 +1161,7 @@ var jsonc = (0, import_eslint_define_config13.defineFlatConfig)([
1173
1161
  ]);
1174
1162
 
1175
1163
  // src/configs/markdown.ts
1176
- var import_eslint_define_config14 = require("eslint-define-config");
1177
- var markdown = (0, import_eslint_define_config14.defineFlatConfig)([
1164
+ var markdown = defineConfig([
1178
1165
  ...import_eslint_plugin_markdown.default.configs.recommended,
1179
1166
  {
1180
1167
  files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
@@ -1204,7 +1191,6 @@ var markdown = (0, import_eslint_define_config14.defineFlatConfig)([
1204
1191
  // src/configs/vue.ts
1205
1192
  var import_node_process = __toESM(require("process"), 1);
1206
1193
  var import_local_pkg2 = require("local-pkg");
1207
- var import_eslint_define_config15 = require("eslint-define-config");
1208
1194
  function getVueVersion() {
1209
1195
  const pkg = (0, import_local_pkg2.getPackageInfoSync)("vue", { paths: [import_node_process.default.cwd()] });
1210
1196
  if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
@@ -1225,7 +1211,7 @@ var vue3Rules = {
1225
1211
  ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
1226
1212
  ...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules
1227
1213
  };
1228
- var vue = (0, import_eslint_define_config15.defineFlatConfig)([
1214
+ var vue = defineConfig([
1229
1215
  ...import_typescript_eslint.default.config({
1230
1216
  files: [GLOB_VUE],
1231
1217
  extends: typescriptCore
@@ -1488,7 +1474,7 @@ function ntnyq(config = [], {
1488
1474
  prettier: enablePrettier = true,
1489
1475
  markdown: enableMarkdown = true
1490
1476
  } = {}) {
1491
- const configs = (0, import_eslint_define_config16.defineFlatConfig)([...presetBasic, ...yml, ...presetJsonc]);
1477
+ const configs = defineConfig([...presetBasic, ...yml, ...presetJsonc]);
1492
1478
  if (enableVue) {
1493
1479
  configs.push(...vue);
1494
1480
  }
@@ -1531,6 +1517,7 @@ function ntnyq(config = [], {
1531
1517
  GLOB_VUE,
1532
1518
  GLOB_YAML,
1533
1519
  comments,
1520
+ defineConfig,
1534
1521
  getVueVersion,
1535
1522
  hasTypeScript,
1536
1523
  hasUnoCSS,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,4 @@
1
- import * as eslint_define_config from 'eslint-define-config';
2
- import { FlatESLintConfig } from 'eslint-define-config';
1
+ import { Linter, ESLint } from 'eslint';
3
2
  export { default as pluginNode } from 'eslint-plugin-n';
4
3
  export { default as pluginVue } from 'eslint-plugin-vue';
5
4
  export { default as pluginUnoCSS } from '@unocss/eslint-plugin';
@@ -23,6 +22,31 @@ declare const hasTypeScript: boolean;
23
22
  declare const hasVue: boolean;
24
23
  declare const hasUnoCSS: boolean;
25
24
 
25
+ /**
26
+ * @file Types
27
+ */
28
+
29
+ /**
30
+ * ESLint config
31
+ */
32
+ type FlatConfig = Linter.FlatConfig;
33
+ /**
34
+ * ESLint Plugin
35
+ */
36
+ type ESLintPlugin = ESLint.Plugin;
37
+ /**
38
+ * ESLint rules
39
+ */
40
+ type RuleRecord = Linter.RulesRecord;
41
+ /**
42
+ * ESLint rules entry
43
+ */
44
+ type RuleRecordEntry = Record<string, RuleRecord>;
45
+ /**
46
+ * Define ESLint config
47
+ */
48
+ declare function defineConfig(configs?: FlatConfig[]): FlatConfig[];
49
+
26
50
  /**
27
51
  * @file globs constants
28
52
  */
@@ -56,70 +80,70 @@ declare const GLOB_EXCLUDE: string[];
56
80
  /**
57
81
  * JavaScript preset
58
82
  */
59
- declare const presetJavaScript: FlatESLintConfig[];
83
+ declare const presetJavaScript: FlatConfig[];
60
84
  /**
61
85
  * JavaScript & TypeScript
62
86
  */
63
- declare const presetBasic: FlatESLintConfig[];
87
+ declare const presetBasic: FlatConfig[];
64
88
  /**
65
89
  * JSON and sort json keys
66
90
  */
67
- declare const presetJsonc: FlatESLintConfig[];
91
+ declare const presetJsonc: FlatConfig[];
68
92
  /**
69
93
  * JSON YAML Markdown
70
94
  */
71
- declare const presetLanguageExtensions: FlatESLintConfig[];
72
- declare const presetCommon: FlatESLintConfig[];
95
+ declare const presetLanguageExtensions: FlatConfig[];
96
+ declare const presetCommon: FlatConfig[];
73
97
  /**
74
98
  * All supported framework
75
99
  */
76
- declare const presetAll: FlatESLintConfig[];
100
+ declare const presetAll: FlatConfig[];
77
101
  /**
78
102
  * Custom framework support
79
103
  */
80
- declare function ntnyq(config?: FlatESLintConfig | FlatESLintConfig[], { vue: enableVue, unocss: enableUnoCSS, prettier: enablePrettier, markdown: enableMarkdown, }?: {
104
+ declare function ntnyq(config?: FlatConfig | FlatConfig[], { vue: enableVue, unocss: enableUnoCSS, prettier: enablePrettier, markdown: enableMarkdown, }?: {
81
105
  vue?: boolean | undefined;
82
106
  unocss?: boolean | undefined;
83
107
  prettier?: boolean | undefined;
84
108
  markdown?: boolean | undefined;
85
- }): FlatESLintConfig[];
109
+ }): FlatConfig[];
86
110
 
87
111
  /**
88
112
  * @see https://eslint.org/docs/latest/use/configure/configuration-files-new#globally-ignoring-files-with-ignores
89
113
  */
90
- declare const ignores: eslint_define_config.FlatESLintConfig[];
114
+ declare const ignores: FlatConfig[];
91
115
 
92
- declare const node: eslint_define_config.FlatESLintConfig[];
116
+ declare const node: FlatConfig[];
93
117
 
94
- declare const jsdoc: eslint_define_config.FlatESLintConfig[];
118
+ declare const jsdoc: FlatConfig[];
95
119
 
96
- declare const imports: eslint_define_config.FlatESLintConfig[];
120
+ declare const imports: FlatConfig[];
97
121
 
98
- declare const unicorn: eslint_define_config.FlatESLintConfig[];
122
+ declare const unicorn: FlatConfig[];
99
123
 
100
- declare const prettier: FlatESLintConfig[];
124
+ declare const prettier: FlatConfig[];
101
125
 
102
- declare const comments: eslint_define_config.FlatESLintConfig[];
126
+ declare const comments: FlatConfig[];
103
127
 
104
- declare const javascript: eslint_define_config.FlatESLintConfig[];
105
- declare const jsx: eslint_define_config.FlatESLintConfig[];
128
+ declare const javascript: FlatConfig[];
129
+ declare const jsx: FlatConfig[];
106
130
 
107
- declare const typescriptCore: FlatESLintConfig[];
108
- declare const typescript: FlatESLintConfig[];
131
+ declare const typescriptCore: FlatConfig[];
132
+ declare const typescript: FlatConfig[];
109
133
 
110
- declare const unocss: eslint_define_config.FlatESLintConfig[];
134
+ declare const unocss: FlatConfig[];
111
135
 
112
- declare const yml: eslint_define_config.FlatESLintConfig[];
136
+ declare const yml: FlatConfig[];
113
137
 
114
- declare const sortPackageJson: eslint_define_config.FlatESLintConfig[];
115
- declare const sortTsConfig: eslint_define_config.FlatESLintConfig[];
138
+ declare const sortPackageJson: FlatConfig[];
139
+ declare const sortTsConfig: FlatConfig[];
116
140
 
117
- declare const jsonc: eslint_define_config.FlatESLintConfig[];
141
+ declare const jsonc: FlatConfig[];
118
142
 
119
- declare const markdown: eslint_define_config.FlatESLintConfig[];
143
+ declare const markdown: FlatConfig[];
120
144
 
121
145
  declare function getVueVersion(): number;
122
- declare const vue: FlatESLintConfig[];
146
+ declare const vue: FlatConfig[];
123
147
 
124
148
  /**
125
149
  * @file plugins & parsers
@@ -129,4 +153,4 @@ type InteropDefault<T> = T extends {
129
153
  } ? U : T;
130
154
  declare function interopDefault<T>(m: T): InteropDefault<T>;
131
155
 
132
- export { 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, comments, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import * as eslint_define_config from 'eslint-define-config';
2
- import { FlatESLintConfig } from 'eslint-define-config';
1
+ import { Linter, ESLint } from 'eslint';
3
2
  export { default as pluginNode } from 'eslint-plugin-n';
4
3
  export { default as pluginVue } from 'eslint-plugin-vue';
5
4
  export { default as pluginUnoCSS } from '@unocss/eslint-plugin';
@@ -23,6 +22,31 @@ declare const hasTypeScript: boolean;
23
22
  declare const hasVue: boolean;
24
23
  declare const hasUnoCSS: boolean;
25
24
 
25
+ /**
26
+ * @file Types
27
+ */
28
+
29
+ /**
30
+ * ESLint config
31
+ */
32
+ type FlatConfig = Linter.FlatConfig;
33
+ /**
34
+ * ESLint Plugin
35
+ */
36
+ type ESLintPlugin = ESLint.Plugin;
37
+ /**
38
+ * ESLint rules
39
+ */
40
+ type RuleRecord = Linter.RulesRecord;
41
+ /**
42
+ * ESLint rules entry
43
+ */
44
+ type RuleRecordEntry = Record<string, RuleRecord>;
45
+ /**
46
+ * Define ESLint config
47
+ */
48
+ declare function defineConfig(configs?: FlatConfig[]): FlatConfig[];
49
+
26
50
  /**
27
51
  * @file globs constants
28
52
  */
@@ -56,70 +80,70 @@ declare const GLOB_EXCLUDE: string[];
56
80
  /**
57
81
  * JavaScript preset
58
82
  */
59
- declare const presetJavaScript: FlatESLintConfig[];
83
+ declare const presetJavaScript: FlatConfig[];
60
84
  /**
61
85
  * JavaScript & TypeScript
62
86
  */
63
- declare const presetBasic: FlatESLintConfig[];
87
+ declare const presetBasic: FlatConfig[];
64
88
  /**
65
89
  * JSON and sort json keys
66
90
  */
67
- declare const presetJsonc: FlatESLintConfig[];
91
+ declare const presetJsonc: FlatConfig[];
68
92
  /**
69
93
  * JSON YAML Markdown
70
94
  */
71
- declare const presetLanguageExtensions: FlatESLintConfig[];
72
- declare const presetCommon: FlatESLintConfig[];
95
+ declare const presetLanguageExtensions: FlatConfig[];
96
+ declare const presetCommon: FlatConfig[];
73
97
  /**
74
98
  * All supported framework
75
99
  */
76
- declare const presetAll: FlatESLintConfig[];
100
+ declare const presetAll: FlatConfig[];
77
101
  /**
78
102
  * Custom framework support
79
103
  */
80
- declare function ntnyq(config?: FlatESLintConfig | FlatESLintConfig[], { vue: enableVue, unocss: enableUnoCSS, prettier: enablePrettier, markdown: enableMarkdown, }?: {
104
+ declare function ntnyq(config?: FlatConfig | FlatConfig[], { vue: enableVue, unocss: enableUnoCSS, prettier: enablePrettier, markdown: enableMarkdown, }?: {
81
105
  vue?: boolean | undefined;
82
106
  unocss?: boolean | undefined;
83
107
  prettier?: boolean | undefined;
84
108
  markdown?: boolean | undefined;
85
- }): FlatESLintConfig[];
109
+ }): FlatConfig[];
86
110
 
87
111
  /**
88
112
  * @see https://eslint.org/docs/latest/use/configure/configuration-files-new#globally-ignoring-files-with-ignores
89
113
  */
90
- declare const ignores: eslint_define_config.FlatESLintConfig[];
114
+ declare const ignores: FlatConfig[];
91
115
 
92
- declare const node: eslint_define_config.FlatESLintConfig[];
116
+ declare const node: FlatConfig[];
93
117
 
94
- declare const jsdoc: eslint_define_config.FlatESLintConfig[];
118
+ declare const jsdoc: FlatConfig[];
95
119
 
96
- declare const imports: eslint_define_config.FlatESLintConfig[];
120
+ declare const imports: FlatConfig[];
97
121
 
98
- declare const unicorn: eslint_define_config.FlatESLintConfig[];
122
+ declare const unicorn: FlatConfig[];
99
123
 
100
- declare const prettier: FlatESLintConfig[];
124
+ declare const prettier: FlatConfig[];
101
125
 
102
- declare const comments: eslint_define_config.FlatESLintConfig[];
126
+ declare const comments: FlatConfig[];
103
127
 
104
- declare const javascript: eslint_define_config.FlatESLintConfig[];
105
- declare const jsx: eslint_define_config.FlatESLintConfig[];
128
+ declare const javascript: FlatConfig[];
129
+ declare const jsx: FlatConfig[];
106
130
 
107
- declare const typescriptCore: FlatESLintConfig[];
108
- declare const typescript: FlatESLintConfig[];
131
+ declare const typescriptCore: FlatConfig[];
132
+ declare const typescript: FlatConfig[];
109
133
 
110
- declare const unocss: eslint_define_config.FlatESLintConfig[];
134
+ declare const unocss: FlatConfig[];
111
135
 
112
- declare const yml: eslint_define_config.FlatESLintConfig[];
136
+ declare const yml: FlatConfig[];
113
137
 
114
- declare const sortPackageJson: eslint_define_config.FlatESLintConfig[];
115
- declare const sortTsConfig: eslint_define_config.FlatESLintConfig[];
138
+ declare const sortPackageJson: FlatConfig[];
139
+ declare const sortTsConfig: FlatConfig[];
116
140
 
117
- declare const jsonc: eslint_define_config.FlatESLintConfig[];
141
+ declare const jsonc: FlatConfig[];
118
142
 
119
- declare const markdown: eslint_define_config.FlatESLintConfig[];
143
+ declare const markdown: FlatConfig[];
120
144
 
121
145
  declare function getVueVersion(): number;
122
- declare const vue: FlatESLintConfig[];
146
+ declare const vue: FlatConfig[];
123
147
 
124
148
  /**
125
149
  * @file plugins & parsers
@@ -129,4 +153,4 @@ type InteropDefault<T> = T extends {
129
153
  } ? U : T;
130
154
  declare function interopDefault<T>(m: T): InteropDefault<T>;
131
155
 
132
- export { 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, comments, 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 };
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 };
package/dist/index.js CHANGED
@@ -4,6 +4,11 @@ var hasTypeScript = isPackageExists("typescript");
4
4
  var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli");
5
5
  var hasUnoCSS = isPackageExists("unocss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
6
6
 
7
+ // src/types.ts
8
+ function defineConfig(configs = []) {
9
+ return configs;
10
+ }
11
+
7
12
  // src/globs.ts
8
13
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
9
14
  var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
@@ -44,6 +49,11 @@ var GLOB_EXCLUDE = [
44
49
  GLOB_NODE_MODULES,
45
50
  GLOB_DIST,
46
51
  ...GLOB_LOCKFILE,
52
+ // Force lint
53
+ "!.github",
54
+ "!.vitepress",
55
+ "!.vuepress",
56
+ "!.vscode",
47
57
  "**/CHANGELOG*.md",
48
58
  "**/*.min.*",
49
59
  "**/LICENSE*",
@@ -59,9 +69,9 @@ var GLOB_EXCLUDE = [
59
69
  "**/output",
60
70
  "**/public",
61
71
  "**/static",
62
- "**/temp",
63
- "**/cache",
64
- "**/.vitepress/cache",
72
+ // VitePress VuePress
73
+ "**/?(.)temp",
74
+ "**/?(.)cache",
65
75
  "**/.eslintcache",
66
76
  "**/.stylelintcache",
67
77
  "**/.vite-inspect",
@@ -73,28 +83,16 @@ var GLOB_EXCLUDE = [
73
83
  "**/.vercel",
74
84
  "**/.changeset",
75
85
  "**/.npmrc",
76
- "**/.yarnrc",
77
- // Force lint
78
- "!.github",
79
- "!.vitepress",
80
- "!.vuepress",
81
- "!.vscode"
86
+ "**/.yarnrc"
82
87
  ];
83
88
 
84
- // src/presets.ts
85
- import { defineFlatConfig as defineFlatConfig16 } from "eslint-define-config";
86
-
87
89
  // src/configs/ignores.ts
88
- import { defineFlatConfig } from "eslint-define-config";
89
- var ignores = defineFlatConfig([
90
+ var ignores = defineConfig([
90
91
  {
91
92
  ignores: GLOB_EXCLUDE
92
93
  }
93
94
  ]);
94
95
 
95
- // src/configs/node.ts
96
- import { defineFlatConfig as defineFlatConfig2 } from "eslint-define-config";
97
-
98
96
  // src/plugins.ts
99
97
  import { default as default2 } from "eslint-plugin-n";
100
98
  import { default as default3 } from "eslint-plugin-vue";
@@ -117,7 +115,7 @@ function interopDefault(m) {
117
115
  }
118
116
 
119
117
  // src/configs/node.ts
120
- var node = defineFlatConfig2([
118
+ var node = defineConfig([
121
119
  {
122
120
  plugins: {
123
121
  node: default2
@@ -136,8 +134,7 @@ var node = defineFlatConfig2([
136
134
  ]);
137
135
 
138
136
  // src/configs/jsdoc.ts
139
- import { defineFlatConfig as defineFlatConfig3 } from "eslint-define-config";
140
- var jsdoc = defineFlatConfig3([
137
+ var jsdoc = defineConfig([
141
138
  {
142
139
  plugins: {
143
140
  jsdoc: default12
@@ -165,8 +162,7 @@ var jsdoc = defineFlatConfig3([
165
162
  ]);
166
163
 
167
164
  // src/configs/imports.ts
168
- import { defineFlatConfig as defineFlatConfig4 } from "eslint-define-config";
169
- var imports = defineFlatConfig4([
165
+ var imports = defineConfig([
170
166
  {
171
167
  plugins: {
172
168
  import: default11
@@ -208,8 +204,7 @@ var imports = defineFlatConfig4([
208
204
  ]);
209
205
 
210
206
  // src/configs/unicorn.ts
211
- import { defineFlatConfig as defineFlatConfig5 } from "eslint-define-config";
212
- var unicorn = defineFlatConfig5([
207
+ var unicorn = defineConfig([
213
208
  {
214
209
  plugins: {
215
210
  unicorn: default5
@@ -285,8 +280,7 @@ var unicorn = defineFlatConfig5([
285
280
 
286
281
  // src/configs/prettier.ts
287
282
  import prettierConfig from "eslint-config-prettier";
288
- import { defineFlatConfig as defineFlatConfig6 } from "eslint-define-config";
289
- var prettier = defineFlatConfig6([
283
+ var prettier = defineConfig([
290
284
  {
291
285
  plugins: {
292
286
  prettier: default6
@@ -300,8 +294,7 @@ var prettier = defineFlatConfig6([
300
294
  ]);
301
295
 
302
296
  // src/configs/comments.ts
303
- import { defineFlatConfig as defineFlatConfig7 } from "eslint-define-config";
304
- var comments = defineFlatConfig7([
297
+ var comments = defineConfig([
305
298
  {
306
299
  plugins: {
307
300
  "eslint-comments": default8
@@ -316,8 +309,7 @@ var comments = defineFlatConfig7([
316
309
  // src/configs/javascript.ts
317
310
  import globals from "globals";
318
311
  import jsConfig from "@eslint/js";
319
- import { defineFlatConfig as defineFlatConfig8 } from "eslint-define-config";
320
- var javascript = defineFlatConfig8([
312
+ var javascript = defineConfig([
321
313
  jsConfig.configs.recommended,
322
314
  {
323
315
  languageOptions: {
@@ -679,7 +671,7 @@ var javascript = defineFlatConfig8([
679
671
  }
680
672
  }
681
673
  ]);
682
- var jsx = defineFlatConfig8([
674
+ var jsx = defineConfig([
683
675
  {
684
676
  files: ["**/*.jsx"],
685
677
  languageOptions: {
@@ -693,7 +685,6 @@ var jsx = defineFlatConfig8([
693
685
  ]);
694
686
 
695
687
  // src/configs/typescript.ts
696
- import { defineFlatConfig as defineFlatConfig9 } from "eslint-define-config";
697
688
  var typescriptCore = tseslint.config({
698
689
  extends: [...tseslint.configs.recommended],
699
690
  files: [GLOB_TS, GLOB_TSX],
@@ -752,7 +743,7 @@ var typescriptCore = tseslint.config({
752
743
  "@typescript-eslint/consistent-indexed-object-style": "off"
753
744
  }
754
745
  });
755
- var typescript = defineFlatConfig9([
746
+ var typescript = defineConfig([
756
747
  ...typescriptCore,
757
748
  {
758
749
  files: ["**/*.d.ts"],
@@ -777,8 +768,7 @@ var typescript = defineFlatConfig9([
777
768
  ]);
778
769
 
779
770
  // src/configs/unocss.ts
780
- import { defineFlatConfig as defineFlatConfig10 } from "eslint-define-config";
781
- var unocss = defineFlatConfig10([
771
+ var unocss = defineConfig([
782
772
  {
783
773
  plugins: {
784
774
  unocss: default4
@@ -792,8 +782,7 @@ var unocss = defineFlatConfig10([
792
782
  ]);
793
783
 
794
784
  // src/configs/yml.ts
795
- import { defineFlatConfig as defineFlatConfig11 } from "eslint-define-config";
796
- var yml = defineFlatConfig11([
785
+ var yml = defineConfig([
797
786
  {
798
787
  files: [GLOB_YAML],
799
788
  languageOptions: {
@@ -812,8 +801,7 @@ var yml = defineFlatConfig11([
812
801
  ]);
813
802
 
814
803
  // src/configs/sort.ts
815
- import { defineFlatConfig as defineFlatConfig12 } from "eslint-define-config";
816
- var sortPackageJson = defineFlatConfig12([
804
+ var sortPackageJson = defineConfig([
817
805
  {
818
806
  files: ["**/package.json"],
819
807
  rules: {
@@ -911,7 +899,7 @@ var sortPackageJson = defineFlatConfig12([
911
899
  }
912
900
  }
913
901
  ]);
914
- var sortTsConfig = defineFlatConfig12([
902
+ var sortTsConfig = defineConfig([
915
903
  {
916
904
  files: ["**/tsconfig.json", "**/tsconfig.*.json"],
917
905
  rules: {
@@ -1028,8 +1016,7 @@ var sortTsConfig = defineFlatConfig12([
1028
1016
  ]);
1029
1017
 
1030
1018
  // src/configs/jsonc.ts
1031
- import { defineFlatConfig as defineFlatConfig13 } from "eslint-define-config";
1032
- var jsonc = defineFlatConfig13([
1019
+ var jsonc = defineConfig([
1033
1020
  {
1034
1021
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
1035
1022
  plugins: {
@@ -1071,8 +1058,7 @@ var jsonc = defineFlatConfig13([
1071
1058
  ]);
1072
1059
 
1073
1060
  // src/configs/markdown.ts
1074
- import { defineFlatConfig as defineFlatConfig14 } from "eslint-define-config";
1075
- var markdown = defineFlatConfig14([
1061
+ var markdown = defineConfig([
1076
1062
  ...default7.configs.recommended,
1077
1063
  {
1078
1064
  files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
@@ -1102,7 +1088,6 @@ var markdown = defineFlatConfig14([
1102
1088
  // src/configs/vue.ts
1103
1089
  import process from "node:process";
1104
1090
  import { getPackageInfoSync } from "local-pkg";
1105
- import { defineFlatConfig as defineFlatConfig15 } from "eslint-define-config";
1106
1091
  function getVueVersion() {
1107
1092
  const pkg = getPackageInfoSync("vue", { paths: [process.cwd()] });
1108
1093
  if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
@@ -1123,7 +1108,7 @@ var vue3Rules = {
1123
1108
  ...default3.configs["vue3-strongly-recommended"].rules,
1124
1109
  ...default3.configs["vue3-recommended"].rules
1125
1110
  };
1126
- var vue = defineFlatConfig15([
1111
+ var vue = defineConfig([
1127
1112
  ...tseslint.config({
1128
1113
  files: [GLOB_VUE],
1129
1114
  extends: typescriptCore
@@ -1386,7 +1371,7 @@ function ntnyq(config = [], {
1386
1371
  prettier: enablePrettier = true,
1387
1372
  markdown: enableMarkdown = true
1388
1373
  } = {}) {
1389
- const configs = defineFlatConfig16([...presetBasic, ...yml, ...presetJsonc]);
1374
+ const configs = defineConfig([...presetBasic, ...yml, ...presetJsonc]);
1390
1375
  if (enableVue) {
1391
1376
  configs.push(...vue);
1392
1377
  }
@@ -1428,6 +1413,7 @@ export {
1428
1413
  GLOB_VUE,
1429
1414
  GLOB_YAML,
1430
1415
  comments,
1416
+ defineConfig,
1431
1417
  getVueVersion,
1432
1418
  hasTypeScript,
1433
1419
  hasUnoCSS,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ntnyq/eslint-config",
3
3
  "type": "module",
4
- "version": "2.2.1",
4
+ "version": "2.3.0",
5
5
  "packageManager": "pnpm@9.4.0",
6
6
  "description": "ESLint flat config of ntnyq",
7
7
  "keywords": [
@@ -52,13 +52,13 @@
52
52
  "eslint": "^9.0.0"
53
53
  },
54
54
  "dependencies": {
55
- "@eslint/js": "^9.5.0",
55
+ "@eslint/js": "^9.6.0",
56
+ "@types/eslint": "^8.56.10",
56
57
  "@unocss/eslint-plugin": "^0.61.0",
57
58
  "eslint-config-prettier": "^9.1.0",
58
- "eslint-define-config": "^2.1.0",
59
59
  "eslint-plugin-eslint-comments": "^3.2.0",
60
- "eslint-plugin-import-x": "^0.5.1",
61
- "eslint-plugin-jsdoc": "^48.2.15",
60
+ "eslint-plugin-import-x": "^0.5.2",
61
+ "eslint-plugin-jsdoc": "^48.5.0",
62
62
  "eslint-plugin-jsonc": "^2.16.0",
63
63
  "eslint-plugin-markdown": "^5.0.0",
64
64
  "eslint-plugin-n": "^17.9.0",
@@ -71,13 +71,13 @@
71
71
  "jsonc-eslint-parser": "^2.4.0",
72
72
  "local-pkg": "^0.5.0",
73
73
  "prettier": "^3.3.2",
74
- "typescript-eslint": "^8.0.0-alpha.30",
74
+ "typescript-eslint": "^8.0.0-alpha.34",
75
75
  "vue-eslint-parser": "^9.4.3",
76
76
  "yaml-eslint-parser": "^1.2.3"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@ntnyq/prettier-config": "^1.21.2",
80
- "@types/node": "^20.14.8",
80
+ "@types/node": "^20.14.9",
81
81
  "bumpp": "^9.4.1",
82
82
  "eslint": "^9.5.0",
83
83
  "husky": "^9.0.11",