@ntnyq/eslint-config 2.2.0 → 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,20 +152,29 @@ 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*",
152
163
  "**/__snapshots__",
164
+ // unplugin-auto-import
153
165
  "**/auto-import?(s).d.ts",
166
+ // unplugin-vue-components
154
167
  "**/components.d.ts",
168
+ // unplugin-vue-router
169
+ "**/typed-router.d.ts",
155
170
  "**/coverage",
156
171
  "**/fixtures",
157
172
  "**/output",
158
173
  "**/public",
159
174
  "**/static",
160
- "**/temp",
161
- "**/cache",
162
- "**/.vitepress/cache",
175
+ // VitePress VuePress
176
+ "**/?(.)temp",
177
+ "**/?(.)cache",
163
178
  "**/.eslintcache",
164
179
  "**/.stylelintcache",
165
180
  "**/.vite-inspect",
@@ -171,28 +186,16 @@ var GLOB_EXCLUDE = [
171
186
  "**/.vercel",
172
187
  "**/.changeset",
173
188
  "**/.npmrc",
174
- "**/.yarnrc",
175
- // Force lint
176
- "!.github",
177
- "!.vitepress",
178
- "!.vuepress",
179
- "!.vscode"
189
+ "**/.yarnrc"
180
190
  ];
181
191
 
182
- // src/presets.ts
183
- var import_eslint_define_config16 = require("eslint-define-config");
184
-
185
192
  // src/configs/ignores.ts
186
- var import_eslint_define_config = require("eslint-define-config");
187
- var ignores = (0, import_eslint_define_config.defineFlatConfig)([
193
+ var ignores = defineConfig([
188
194
  {
189
195
  ignores: GLOB_EXCLUDE
190
196
  }
191
197
  ]);
192
198
 
193
- // src/configs/node.ts
194
- var import_eslint_define_config2 = require("eslint-define-config");
195
-
196
199
  // src/plugins.ts
197
200
  var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
198
201
  var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
@@ -215,7 +218,7 @@ function interopDefault(m) {
215
218
  }
216
219
 
217
220
  // src/configs/node.ts
218
- var node = (0, import_eslint_define_config2.defineFlatConfig)([
221
+ var node = defineConfig([
219
222
  {
220
223
  plugins: {
221
224
  node: import_eslint_plugin_n.default
@@ -234,8 +237,7 @@ var node = (0, import_eslint_define_config2.defineFlatConfig)([
234
237
  ]);
235
238
 
236
239
  // src/configs/jsdoc.ts
237
- var import_eslint_define_config3 = require("eslint-define-config");
238
- var jsdoc = (0, import_eslint_define_config3.defineFlatConfig)([
240
+ var jsdoc = defineConfig([
239
241
  {
240
242
  plugins: {
241
243
  jsdoc: import_eslint_plugin_jsdoc.default
@@ -263,8 +265,7 @@ var jsdoc = (0, import_eslint_define_config3.defineFlatConfig)([
263
265
  ]);
264
266
 
265
267
  // src/configs/imports.ts
266
- var import_eslint_define_config4 = require("eslint-define-config");
267
- var imports = (0, import_eslint_define_config4.defineFlatConfig)([
268
+ var imports = defineConfig([
268
269
  {
269
270
  plugins: {
270
271
  import: import_eslint_plugin_import_x.default
@@ -306,8 +307,7 @@ var imports = (0, import_eslint_define_config4.defineFlatConfig)([
306
307
  ]);
307
308
 
308
309
  // src/configs/unicorn.ts
309
- var import_eslint_define_config5 = require("eslint-define-config");
310
- var unicorn = (0, import_eslint_define_config5.defineFlatConfig)([
310
+ var unicorn = defineConfig([
311
311
  {
312
312
  plugins: {
313
313
  unicorn: import_eslint_plugin_unicorn.default
@@ -383,8 +383,7 @@ var unicorn = (0, import_eslint_define_config5.defineFlatConfig)([
383
383
 
384
384
  // src/configs/prettier.ts
385
385
  var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
386
- var import_eslint_define_config6 = require("eslint-define-config");
387
- var prettier = (0, import_eslint_define_config6.defineFlatConfig)([
386
+ var prettier = defineConfig([
388
387
  {
389
388
  plugins: {
390
389
  prettier: import_eslint_plugin_prettier.default
@@ -398,8 +397,7 @@ var prettier = (0, import_eslint_define_config6.defineFlatConfig)([
398
397
  ]);
399
398
 
400
399
  // src/configs/comments.ts
401
- var import_eslint_define_config7 = require("eslint-define-config");
402
- var comments = (0, import_eslint_define_config7.defineFlatConfig)([
400
+ var comments = defineConfig([
403
401
  {
404
402
  plugins: {
405
403
  "eslint-comments": import_eslint_plugin_eslint_comments.default
@@ -414,8 +412,7 @@ var comments = (0, import_eslint_define_config7.defineFlatConfig)([
414
412
  // src/configs/javascript.ts
415
413
  var import_globals = __toESM(require("globals"), 1);
416
414
  var import_js = __toESM(require("@eslint/js"), 1);
417
- var import_eslint_define_config8 = require("eslint-define-config");
418
- var javascript = (0, import_eslint_define_config8.defineFlatConfig)([
415
+ var javascript = defineConfig([
419
416
  import_js.default.configs.recommended,
420
417
  {
421
418
  languageOptions: {
@@ -777,7 +774,7 @@ var javascript = (0, import_eslint_define_config8.defineFlatConfig)([
777
774
  }
778
775
  }
779
776
  ]);
780
- var jsx = (0, import_eslint_define_config8.defineFlatConfig)([
777
+ var jsx = defineConfig([
781
778
  {
782
779
  files: ["**/*.jsx"],
783
780
  languageOptions: {
@@ -791,7 +788,6 @@ var jsx = (0, import_eslint_define_config8.defineFlatConfig)([
791
788
  ]);
792
789
 
793
790
  // src/configs/typescript.ts
794
- var import_eslint_define_config9 = require("eslint-define-config");
795
791
  var typescriptCore = import_typescript_eslint.default.config({
796
792
  extends: [...import_typescript_eslint.default.configs.recommended],
797
793
  files: [GLOB_TS, GLOB_TSX],
@@ -850,7 +846,7 @@ var typescriptCore = import_typescript_eslint.default.config({
850
846
  "@typescript-eslint/consistent-indexed-object-style": "off"
851
847
  }
852
848
  });
853
- var typescript = (0, import_eslint_define_config9.defineFlatConfig)([
849
+ var typescript = defineConfig([
854
850
  ...typescriptCore,
855
851
  {
856
852
  files: ["**/*.d.ts"],
@@ -875,8 +871,7 @@ var typescript = (0, import_eslint_define_config9.defineFlatConfig)([
875
871
  ]);
876
872
 
877
873
  // src/configs/unocss.ts
878
- var import_eslint_define_config10 = require("eslint-define-config");
879
- var unocss = (0, import_eslint_define_config10.defineFlatConfig)([
874
+ var unocss = defineConfig([
880
875
  {
881
876
  plugins: {
882
877
  unocss: import_eslint_plugin.default
@@ -890,8 +885,7 @@ var unocss = (0, import_eslint_define_config10.defineFlatConfig)([
890
885
  ]);
891
886
 
892
887
  // src/configs/yml.ts
893
- var import_eslint_define_config11 = require("eslint-define-config");
894
- var yml = (0, import_eslint_define_config11.defineFlatConfig)([
888
+ var yml = defineConfig([
895
889
  {
896
890
  files: [GLOB_YAML],
897
891
  languageOptions: {
@@ -910,8 +904,7 @@ var yml = (0, import_eslint_define_config11.defineFlatConfig)([
910
904
  ]);
911
905
 
912
906
  // src/configs/sort.ts
913
- var import_eslint_define_config12 = require("eslint-define-config");
914
- var sortPackageJson = (0, import_eslint_define_config12.defineFlatConfig)([
907
+ var sortPackageJson = defineConfig([
915
908
  {
916
909
  files: ["**/package.json"],
917
910
  rules: {
@@ -1009,7 +1002,7 @@ var sortPackageJson = (0, import_eslint_define_config12.defineFlatConfig)([
1009
1002
  }
1010
1003
  }
1011
1004
  ]);
1012
- var sortTsConfig = (0, import_eslint_define_config12.defineFlatConfig)([
1005
+ var sortTsConfig = defineConfig([
1013
1006
  {
1014
1007
  files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1015
1008
  rules: {
@@ -1126,8 +1119,7 @@ var sortTsConfig = (0, import_eslint_define_config12.defineFlatConfig)([
1126
1119
  ]);
1127
1120
 
1128
1121
  // src/configs/jsonc.ts
1129
- var import_eslint_define_config13 = require("eslint-define-config");
1130
- var jsonc = (0, import_eslint_define_config13.defineFlatConfig)([
1122
+ var jsonc = defineConfig([
1131
1123
  {
1132
1124
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
1133
1125
  plugins: {
@@ -1169,8 +1161,7 @@ var jsonc = (0, import_eslint_define_config13.defineFlatConfig)([
1169
1161
  ]);
1170
1162
 
1171
1163
  // src/configs/markdown.ts
1172
- var import_eslint_define_config14 = require("eslint-define-config");
1173
- var markdown = (0, import_eslint_define_config14.defineFlatConfig)([
1164
+ var markdown = defineConfig([
1174
1165
  ...import_eslint_plugin_markdown.default.configs.recommended,
1175
1166
  {
1176
1167
  files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
@@ -1200,7 +1191,6 @@ var markdown = (0, import_eslint_define_config14.defineFlatConfig)([
1200
1191
  // src/configs/vue.ts
1201
1192
  var import_node_process = __toESM(require("process"), 1);
1202
1193
  var import_local_pkg2 = require("local-pkg");
1203
- var import_eslint_define_config15 = require("eslint-define-config");
1204
1194
  function getVueVersion() {
1205
1195
  const pkg = (0, import_local_pkg2.getPackageInfoSync)("vue", { paths: [import_node_process.default.cwd()] });
1206
1196
  if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
@@ -1221,7 +1211,7 @@ var vue3Rules = {
1221
1211
  ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
1222
1212
  ...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules
1223
1213
  };
1224
- var vue = (0, import_eslint_define_config15.defineFlatConfig)([
1214
+ var vue = defineConfig([
1225
1215
  ...import_typescript_eslint.default.config({
1226
1216
  files: [GLOB_VUE],
1227
1217
  extends: typescriptCore
@@ -1484,7 +1474,7 @@ function ntnyq(config = [], {
1484
1474
  prettier: enablePrettier = true,
1485
1475
  markdown: enableMarkdown = true
1486
1476
  } = {}) {
1487
- const configs = (0, import_eslint_define_config16.defineFlatConfig)([...presetBasic, ...yml, ...presetJsonc]);
1477
+ const configs = defineConfig([...presetBasic, ...yml, ...presetJsonc]);
1488
1478
  if (enableVue) {
1489
1479
  configs.push(...vue);
1490
1480
  }
@@ -1527,6 +1517,7 @@ function ntnyq(config = [], {
1527
1517
  GLOB_VUE,
1528
1518
  GLOB_YAML,
1529
1519
  comments,
1520
+ defineConfig,
1530
1521
  getVueVersion,
1531
1522
  hasTypeScript,
1532
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,20 +49,29 @@ 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*",
50
60
  "**/__snapshots__",
61
+ // unplugin-auto-import
51
62
  "**/auto-import?(s).d.ts",
63
+ // unplugin-vue-components
52
64
  "**/components.d.ts",
65
+ // unplugin-vue-router
66
+ "**/typed-router.d.ts",
53
67
  "**/coverage",
54
68
  "**/fixtures",
55
69
  "**/output",
56
70
  "**/public",
57
71
  "**/static",
58
- "**/temp",
59
- "**/cache",
60
- "**/.vitepress/cache",
72
+ // VitePress VuePress
73
+ "**/?(.)temp",
74
+ "**/?(.)cache",
61
75
  "**/.eslintcache",
62
76
  "**/.stylelintcache",
63
77
  "**/.vite-inspect",
@@ -69,28 +83,16 @@ var GLOB_EXCLUDE = [
69
83
  "**/.vercel",
70
84
  "**/.changeset",
71
85
  "**/.npmrc",
72
- "**/.yarnrc",
73
- // Force lint
74
- "!.github",
75
- "!.vitepress",
76
- "!.vuepress",
77
- "!.vscode"
86
+ "**/.yarnrc"
78
87
  ];
79
88
 
80
- // src/presets.ts
81
- import { defineFlatConfig as defineFlatConfig16 } from "eslint-define-config";
82
-
83
89
  // src/configs/ignores.ts
84
- import { defineFlatConfig } from "eslint-define-config";
85
- var ignores = defineFlatConfig([
90
+ var ignores = defineConfig([
86
91
  {
87
92
  ignores: GLOB_EXCLUDE
88
93
  }
89
94
  ]);
90
95
 
91
- // src/configs/node.ts
92
- import { defineFlatConfig as defineFlatConfig2 } from "eslint-define-config";
93
-
94
96
  // src/plugins.ts
95
97
  import { default as default2 } from "eslint-plugin-n";
96
98
  import { default as default3 } from "eslint-plugin-vue";
@@ -113,7 +115,7 @@ function interopDefault(m) {
113
115
  }
114
116
 
115
117
  // src/configs/node.ts
116
- var node = defineFlatConfig2([
118
+ var node = defineConfig([
117
119
  {
118
120
  plugins: {
119
121
  node: default2
@@ -132,8 +134,7 @@ var node = defineFlatConfig2([
132
134
  ]);
133
135
 
134
136
  // src/configs/jsdoc.ts
135
- import { defineFlatConfig as defineFlatConfig3 } from "eslint-define-config";
136
- var jsdoc = defineFlatConfig3([
137
+ var jsdoc = defineConfig([
137
138
  {
138
139
  plugins: {
139
140
  jsdoc: default12
@@ -161,8 +162,7 @@ var jsdoc = defineFlatConfig3([
161
162
  ]);
162
163
 
163
164
  // src/configs/imports.ts
164
- import { defineFlatConfig as defineFlatConfig4 } from "eslint-define-config";
165
- var imports = defineFlatConfig4([
165
+ var imports = defineConfig([
166
166
  {
167
167
  plugins: {
168
168
  import: default11
@@ -204,8 +204,7 @@ var imports = defineFlatConfig4([
204
204
  ]);
205
205
 
206
206
  // src/configs/unicorn.ts
207
- import { defineFlatConfig as defineFlatConfig5 } from "eslint-define-config";
208
- var unicorn = defineFlatConfig5([
207
+ var unicorn = defineConfig([
209
208
  {
210
209
  plugins: {
211
210
  unicorn: default5
@@ -281,8 +280,7 @@ var unicorn = defineFlatConfig5([
281
280
 
282
281
  // src/configs/prettier.ts
283
282
  import prettierConfig from "eslint-config-prettier";
284
- import { defineFlatConfig as defineFlatConfig6 } from "eslint-define-config";
285
- var prettier = defineFlatConfig6([
283
+ var prettier = defineConfig([
286
284
  {
287
285
  plugins: {
288
286
  prettier: default6
@@ -296,8 +294,7 @@ var prettier = defineFlatConfig6([
296
294
  ]);
297
295
 
298
296
  // src/configs/comments.ts
299
- import { defineFlatConfig as defineFlatConfig7 } from "eslint-define-config";
300
- var comments = defineFlatConfig7([
297
+ var comments = defineConfig([
301
298
  {
302
299
  plugins: {
303
300
  "eslint-comments": default8
@@ -312,8 +309,7 @@ var comments = defineFlatConfig7([
312
309
  // src/configs/javascript.ts
313
310
  import globals from "globals";
314
311
  import jsConfig from "@eslint/js";
315
- import { defineFlatConfig as defineFlatConfig8 } from "eslint-define-config";
316
- var javascript = defineFlatConfig8([
312
+ var javascript = defineConfig([
317
313
  jsConfig.configs.recommended,
318
314
  {
319
315
  languageOptions: {
@@ -675,7 +671,7 @@ var javascript = defineFlatConfig8([
675
671
  }
676
672
  }
677
673
  ]);
678
- var jsx = defineFlatConfig8([
674
+ var jsx = defineConfig([
679
675
  {
680
676
  files: ["**/*.jsx"],
681
677
  languageOptions: {
@@ -689,7 +685,6 @@ var jsx = defineFlatConfig8([
689
685
  ]);
690
686
 
691
687
  // src/configs/typescript.ts
692
- import { defineFlatConfig as defineFlatConfig9 } from "eslint-define-config";
693
688
  var typescriptCore = tseslint.config({
694
689
  extends: [...tseslint.configs.recommended],
695
690
  files: [GLOB_TS, GLOB_TSX],
@@ -748,7 +743,7 @@ var typescriptCore = tseslint.config({
748
743
  "@typescript-eslint/consistent-indexed-object-style": "off"
749
744
  }
750
745
  });
751
- var typescript = defineFlatConfig9([
746
+ var typescript = defineConfig([
752
747
  ...typescriptCore,
753
748
  {
754
749
  files: ["**/*.d.ts"],
@@ -773,8 +768,7 @@ var typescript = defineFlatConfig9([
773
768
  ]);
774
769
 
775
770
  // src/configs/unocss.ts
776
- import { defineFlatConfig as defineFlatConfig10 } from "eslint-define-config";
777
- var unocss = defineFlatConfig10([
771
+ var unocss = defineConfig([
778
772
  {
779
773
  plugins: {
780
774
  unocss: default4
@@ -788,8 +782,7 @@ var unocss = defineFlatConfig10([
788
782
  ]);
789
783
 
790
784
  // src/configs/yml.ts
791
- import { defineFlatConfig as defineFlatConfig11 } from "eslint-define-config";
792
- var yml = defineFlatConfig11([
785
+ var yml = defineConfig([
793
786
  {
794
787
  files: [GLOB_YAML],
795
788
  languageOptions: {
@@ -808,8 +801,7 @@ var yml = defineFlatConfig11([
808
801
  ]);
809
802
 
810
803
  // src/configs/sort.ts
811
- import { defineFlatConfig as defineFlatConfig12 } from "eslint-define-config";
812
- var sortPackageJson = defineFlatConfig12([
804
+ var sortPackageJson = defineConfig([
813
805
  {
814
806
  files: ["**/package.json"],
815
807
  rules: {
@@ -907,7 +899,7 @@ var sortPackageJson = defineFlatConfig12([
907
899
  }
908
900
  }
909
901
  ]);
910
- var sortTsConfig = defineFlatConfig12([
902
+ var sortTsConfig = defineConfig([
911
903
  {
912
904
  files: ["**/tsconfig.json", "**/tsconfig.*.json"],
913
905
  rules: {
@@ -1024,8 +1016,7 @@ var sortTsConfig = defineFlatConfig12([
1024
1016
  ]);
1025
1017
 
1026
1018
  // src/configs/jsonc.ts
1027
- import { defineFlatConfig as defineFlatConfig13 } from "eslint-define-config";
1028
- var jsonc = defineFlatConfig13([
1019
+ var jsonc = defineConfig([
1029
1020
  {
1030
1021
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, "**/*rc"],
1031
1022
  plugins: {
@@ -1067,8 +1058,7 @@ var jsonc = defineFlatConfig13([
1067
1058
  ]);
1068
1059
 
1069
1060
  // src/configs/markdown.ts
1070
- import { defineFlatConfig as defineFlatConfig14 } from "eslint-define-config";
1071
- var markdown = defineFlatConfig14([
1061
+ var markdown = defineConfig([
1072
1062
  ...default7.configs.recommended,
1073
1063
  {
1074
1064
  files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
@@ -1098,7 +1088,6 @@ var markdown = defineFlatConfig14([
1098
1088
  // src/configs/vue.ts
1099
1089
  import process from "node:process";
1100
1090
  import { getPackageInfoSync } from "local-pkg";
1101
- import { defineFlatConfig as defineFlatConfig15 } from "eslint-define-config";
1102
1091
  function getVueVersion() {
1103
1092
  const pkg = getPackageInfoSync("vue", { paths: [process.cwd()] });
1104
1093
  if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
@@ -1119,7 +1108,7 @@ var vue3Rules = {
1119
1108
  ...default3.configs["vue3-strongly-recommended"].rules,
1120
1109
  ...default3.configs["vue3-recommended"].rules
1121
1110
  };
1122
- var vue = defineFlatConfig15([
1111
+ var vue = defineConfig([
1123
1112
  ...tseslint.config({
1124
1113
  files: [GLOB_VUE],
1125
1114
  extends: typescriptCore
@@ -1382,7 +1371,7 @@ function ntnyq(config = [], {
1382
1371
  prettier: enablePrettier = true,
1383
1372
  markdown: enableMarkdown = true
1384
1373
  } = {}) {
1385
- const configs = defineFlatConfig16([...presetBasic, ...yml, ...presetJsonc]);
1374
+ const configs = defineConfig([...presetBasic, ...yml, ...presetJsonc]);
1386
1375
  if (enableVue) {
1387
1376
  configs.push(...vue);
1388
1377
  }
@@ -1424,6 +1413,7 @@ export {
1424
1413
  GLOB_VUE,
1425
1414
  GLOB_YAML,
1426
1415
  comments,
1416
+ defineConfig,
1427
1417
  getVueVersion,
1428
1418
  hasTypeScript,
1429
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.0",
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",