@ntnyq/eslint-config 3.2.2 → 3.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.js CHANGED
@@ -1,6 +1,71 @@
1
1
  // src/core.ts
2
2
  import { FlatConfigComposer } from "eslint-flat-config-utils";
3
3
 
4
+ // src/configs/vue.ts
5
+ import { mergeProcessors as mergeProcessors2 } from "eslint-merge-processors";
6
+
7
+ // src/eslint/utils.ts
8
+ import { config } from "typescript-eslint";
9
+
10
+ // src/eslint/parsers.ts
11
+ import tseslint from "typescript-eslint";
12
+ import * as parserVue from "vue-eslint-parser";
13
+ import * as parserToml from "toml-eslint-parser";
14
+ import * as parserYaml from "yaml-eslint-parser";
15
+ import * as parserJsonc from "jsonc-eslint-parser";
16
+ var parserTypeScript = tseslint.parser;
17
+ var parserPlain = {
18
+ meta: {
19
+ name: "plain-eslint-parser"
20
+ },
21
+ parseForESLint: (code) => ({
22
+ ast: {
23
+ body: [],
24
+ comments: [],
25
+ loc: { start: 0, end: code.length },
26
+ range: [0, code.length],
27
+ tokens: [],
28
+ type: "Program"
29
+ },
30
+ scopeManager: null,
31
+ services: { isPlain: true },
32
+ visitorKeys: {
33
+ Program: []
34
+ }
35
+ })
36
+ };
37
+
38
+ // src/eslint/plugins.ts
39
+ import * as pluginRegexp from "eslint-plugin-regexp";
40
+ import { default as default2 } from "eslint-plugin-n";
41
+ import { default as default3 } from "eslint-plugin-vue";
42
+ import { default as default4 } from "eslint-plugin-yml";
43
+ import { default as default5 } from "eslint-plugin-toml";
44
+ import { default as default6 } from "eslint-plugin-ntnyq";
45
+ import { default as default7 } from "@eslint/markdown";
46
+ import { default as default8 } from "eslint-plugin-antfu";
47
+ import { default as default9 } from "eslint-plugin-jsdoc";
48
+ import { default as default10 } from "eslint-plugin-jsonc";
49
+ import { plugin } from "typescript-eslint";
50
+ import { default as default11 } from "eslint-plugin-format";
51
+ import { default as default12 } from "@unocss/eslint-plugin";
52
+ import { default as default13 } from "@vitest/eslint-plugin";
53
+ import { default as default14 } from "eslint-plugin-import-x";
54
+ import { default as default15 } from "eslint-plugin-unicorn";
55
+ import { default as default16 } from "eslint-plugin-prettier";
56
+ import { default as default17 } from "eslint-plugin-github-action";
57
+ import { default as default18 } from "eslint-plugin-perfectionist";
58
+ import { default as default19 } from "eslint-plugin-unused-imports";
59
+ import { default as default20 } from "@eslint-community/eslint-plugin-eslint-comments";
60
+
61
+ // src/eslint/configs.ts
62
+ import { configs } from "typescript-eslint";
63
+
64
+ // src/eslint/processors.ts
65
+ import { mergeProcessors } from "eslint-merge-processors";
66
+ import { processorPassThrough } from "eslint-merge-processors";
67
+ import { default as default21 } from "eslint-processor-vue-blocks";
68
+
4
69
  // src/globs.ts
5
70
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
6
71
  var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
@@ -19,6 +84,7 @@ var GLOB_STYLE = "**/*.{c,le,sc}ss";
19
84
  var GLOB_CSS = "**/*.css";
20
85
  var GLOB_LESS = "**/*.less";
21
86
  var GLOB_SCSS = "**/*.scss";
87
+ var GLOB_POSTCSS = "**/*.{p,post}css";
22
88
  var GLOB_JSON = "**/*.json";
23
89
  var GLOB_JSON5 = "**/*.json5";
24
90
  var GLOB_JSONC = "**/*.jsonc";
@@ -42,6 +108,7 @@ var GLOB_ALL_SRC = [
42
108
  GLOB_HTML,
43
109
  GLOB_MARKDOWN
44
110
  ];
111
+ var GLOB_GITHUB_ACTION = "**/.github/workflows/*.y?(a)ml";
45
112
  var GLOB_NODE_MODULES = "**/node_modules/**";
46
113
  var GLOB_DIST = "**/dist/**";
47
114
  var GLOB_LOCKFILE = [
@@ -96,41 +163,16 @@ var GLOB_EXCLUDE = [
96
163
  "**/.yarnrc"
97
164
  ];
98
165
 
99
- // src/plugins.ts
100
- import tseslint from "typescript-eslint";
101
- import * as parserVue from "vue-eslint-parser";
102
- import * as parserToml from "toml-eslint-parser";
103
- import * as parserYaml from "yaml-eslint-parser";
104
- import * as parserJsonc from "jsonc-eslint-parser";
105
- import * as pluginRegexp from "eslint-plugin-regexp";
106
- import { default as default2 } from "eslint-plugin-n";
107
- import { default as default3 } from "eslint-plugin-vue";
108
- import { default as default4 } from "eslint-plugin-yml";
109
- import { default as default5 } from "eslint-plugin-toml";
110
- import { default as default6 } from "eslint-plugin-ntnyq";
111
- import { default as default7 } from "@eslint/markdown";
112
- import { default as default8 } from "eslint-plugin-antfu";
113
- import { default as default9 } from "eslint-plugin-jsdoc";
114
- import { default as default10 } from "eslint-plugin-jsonc";
115
- import { default as default11 } from "@unocss/eslint-plugin";
116
- import { default as default12 } from "@vitest/eslint-plugin";
117
- import { default as default13 } from "eslint-plugin-import-x";
118
- import { default as default14 } from "eslint-plugin-unicorn";
119
- import { default as default15 } from "eslint-plugin-prettier";
120
- import { default as default16 } from "eslint-plugin-perfectionist";
121
- import { default as default17 } from "eslint-plugin-unused-imports";
122
- import { default as default18 } from "@eslint-community/eslint-plugin-eslint-comments";
123
-
124
166
  // src/configs/typescript.ts
125
167
  import process from "node:process";
126
168
  var typescriptCore = (options = {}) => {
127
169
  const isTypeAware = !!options.tsconfigPath;
128
- const configs = tseslint.config({
170
+ const configs2 = config({
129
171
  name: "ntnyq/ts/core",
130
- extends: [...tseslint.configs.recommended],
172
+ extends: [...configs.recommended],
131
173
  files: [GLOB_TS, GLOB_TSX],
132
174
  languageOptions: {
133
- parser: tseslint.parser,
175
+ parser: parserTypeScript,
134
176
  parserOptions: {
135
177
  sourceType: "module",
136
178
  ...isTypeAware ? {
@@ -224,7 +266,7 @@ var typescriptCore = (options = {}) => {
224
266
  ...options.overrides
225
267
  }
226
268
  });
227
- return configs;
269
+ return configs2;
228
270
  };
229
271
  var typescript = (options = {}) => [
230
272
  ...typescriptCore(options),
@@ -436,31 +478,47 @@ var unCategorizedRules = {
436
478
  };
437
479
  var vue = (options = {}) => {
438
480
  const isVue3 = options.vueVersion !== 2;
481
+ const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
439
482
  return [
440
- ...tseslint.config({
483
+ ...config({
441
484
  name: "ntnyq/vue/ts",
442
485
  files: [GLOB_VUE],
443
486
  extends: typescriptCore()
444
487
  }),
445
488
  {
446
- name: "ntnyq/vue/core",
447
- files: [GLOB_VUE],
489
+ name: "ntnyq/vue/setup",
448
490
  plugins: {
449
491
  vue: default3,
450
- "@typescript-eslint": tseslint.plugin
492
+ "@typescript-eslint": plugin
451
493
  },
452
494
  languageOptions: {
453
- parser: parserVue,
454
495
  parserOptions: {
455
- parser: "@typescript-eslint/parser",
456
496
  sourceType: "module",
497
+ ecmaVersion: "latest",
457
498
  extraFileExtensions: [".vue"],
499
+ parser: "@typescript-eslint/parser",
458
500
  ecmaFeatures: {
459
501
  jsx: true
460
502
  }
461
503
  }
504
+ }
505
+ },
506
+ {
507
+ name: "ntnyq/vue/rules",
508
+ files: [GLOB_VUE],
509
+ languageOptions: {
510
+ parser: parserVue
462
511
  },
463
- processor: default3.processors[".vue"],
512
+ processor: sfcBlocks === false ? default3.processors[".vue"] : mergeProcessors2([
513
+ default3.processors[".vue"],
514
+ default21({
515
+ ...sfcBlocks,
516
+ blocks: {
517
+ styles: true,
518
+ ...sfcBlocks.blocks
519
+ }
520
+ })
521
+ ]),
464
522
  rules: {
465
523
  ...isVue3 ? vue3Rules : vue2Rules,
466
524
  "vue/html-self-closing": [
@@ -617,9 +675,9 @@ var node = (options = {}) => [
617
675
 
618
676
  // src/configs/sort.ts
619
677
  var sort = (options = {}) => {
620
- const configs = [];
678
+ const configs2 = [];
621
679
  if (options.tsconfig ?? true) {
622
- configs.push({
680
+ configs2.push({
623
681
  name: "ntnyq/sort/tsconfig",
624
682
  files: ["**/tsconfig.json", "**/tsconfig.*.json"],
625
683
  rules: {
@@ -735,7 +793,7 @@ var sort = (options = {}) => {
735
793
  });
736
794
  }
737
795
  if (options.packageJson ?? true) {
738
- configs.push({
796
+ configs2.push({
739
797
  name: "ntnyq/sort/package-json",
740
798
  files: ["**/package.json"],
741
799
  rules: {
@@ -867,7 +925,7 @@ var sort = (options = {}) => {
867
925
  });
868
926
  }
869
927
  if (options.i18nLocale ?? true) {
870
- configs.push(
928
+ configs2.push(
871
929
  {
872
930
  name: "ntnyq/sort/i18n-locale/json",
873
931
  files: ["**/{locales,i18n}/*.json"],
@@ -897,7 +955,7 @@ var sort = (options = {}) => {
897
955
  );
898
956
  }
899
957
  if (options.pnpmWorkspace ?? true) {
900
- configs.push({
958
+ configs2.push({
901
959
  name: "ntnyq/sort/pnpm-workspace",
902
960
  files: ["**/pnpm-workspace.yaml"],
903
961
  rules: {
@@ -911,7 +969,7 @@ var sort = (options = {}) => {
911
969
  }
912
970
  });
913
971
  }
914
- return configs;
972
+ return configs2;
915
973
  };
916
974
 
917
975
  // src/configs/toml.ts
@@ -968,11 +1026,11 @@ var vitest = (options = {}) => [
968
1026
  {
969
1027
  name: "ntnyq/vitest",
970
1028
  plugins: {
971
- vitest: default12
1029
+ vitest: default13
972
1030
  },
973
1031
  files: [...GLOB_TEST],
974
1032
  rules: {
975
- ...default12.configs.recommended.rules,
1033
+ ...default13.configs.recommended.rules,
976
1034
  // Overrides rules
977
1035
  ...options.overridesVitestRules
978
1036
  }
@@ -990,7 +1048,9 @@ var antfu = (options = {}) => [
990
1048
  // required `object-curly-newline` to be disabled
991
1049
  // 'antfu/consistent-list-newline': 'error',
992
1050
  "antfu/import-dedupe": "error",
993
- "antfu/top-level-function": "error",
1051
+ "antfu/no-import-dist": "error",
1052
+ "antfu/indent-unindent": "error",
1053
+ "antfu/no-import-node-modules-by-path": "error",
994
1054
  // Overrides rules
995
1055
  ...options.overrides
996
1056
  }
@@ -1090,9 +1150,9 @@ var ntnyq = (options = {}) => [
1090
1150
 
1091
1151
  // src/configs/regexp.ts
1092
1152
  var regexp = (options = {}) => {
1093
- const config = pluginRegexp.configs["flat/recommended"];
1153
+ const config2 = pluginRegexp.configs["flat/recommended"];
1094
1154
  const rules = {
1095
- ...config.rules
1155
+ ...config2.rules
1096
1156
  };
1097
1157
  if (options.level === "warn") {
1098
1158
  for (const key in rules) {
@@ -1103,7 +1163,7 @@ var regexp = (options = {}) => {
1103
1163
  }
1104
1164
  return [
1105
1165
  {
1106
- ...config,
1166
+ ...config2,
1107
1167
  name: "ntnyq/regexp",
1108
1168
  rules: {
1109
1169
  ...rules,
@@ -1119,7 +1179,7 @@ var unocss = (options = {}) => [
1119
1179
  {
1120
1180
  name: "ntnyq/unocss",
1121
1181
  plugins: {
1122
- unocss: default11
1182
+ unocss: default12
1123
1183
  },
1124
1184
  rules: {
1125
1185
  "unocss/order": "error",
@@ -1131,6 +1191,202 @@ var unocss = (options = {}) => [
1131
1191
  }
1132
1192
  ];
1133
1193
 
1194
+ // src/constants.ts
1195
+ var DEFAULT_PRETTIER_OPTIONS = {
1196
+ // Maximum line length
1197
+ printWidth: 100,
1198
+ // Specify the number of spaces per indentation-level
1199
+ tabWidth: 2,
1200
+ // Indent lines with tabs instead of spaces
1201
+ useTabs: false,
1202
+ // Use semicolons or not
1203
+ semi: false,
1204
+ // Use single quotes instead of double quotes
1205
+ singleQuote: true,
1206
+ // Change when properties in objects are quoted
1207
+ quoteProps: "as-needed",
1208
+ // Use single quotes instead of double quotes in JSX
1209
+ jsxSingleQuote: true,
1210
+ // Print trailing commas wherever possible when multi-line
1211
+ trailingComma: "all",
1212
+ // Print spaces between brackets in object literals.
1213
+ bracketSpacing: true,
1214
+ // Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being alone on the next line (does not apply to self closing elements)
1215
+ bracketSameLine: false,
1216
+ // Include parentheses around a sole arrow function parameter
1217
+ arrowParens: "avoid",
1218
+ // Format only a segment of a file.
1219
+ rangeStart: 0,
1220
+ rangeEnd: Number.POSITIVE_INFINITY,
1221
+ // Specify which parser to use.
1222
+ // parser: undefined,
1223
+ // Specify the file name to use to infer which parser to use.
1224
+ // filepath: undefined,
1225
+ // Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
1226
+ requirePragma: false,
1227
+ // Prettier can insert a special @format marker at the top of files specifying that the file has been formatted with prettier.
1228
+ insertPragma: false,
1229
+ // By default, Prettier will wrap markdown text as-is since some services use a line-break-sensitive renderer, e.g. GitHub comment and Bitbucket.
1230
+ proseWrap: "preserve",
1231
+ // Specify the global whitespace sensitivity for HTML files
1232
+ htmlWhitespaceSensitivity: "css",
1233
+ // Whether or not to indent the code inside <script> and <style> tags in Vue files
1234
+ vueIndentScriptAndStyle: false,
1235
+ // End of line
1236
+ endOfLine: "lf",
1237
+ // Control whether Prettier formats quoted code embedded in the file
1238
+ embeddedLanguageFormatting: "auto",
1239
+ // Enforce single attribute per line in HTML, Vue and JSX
1240
+ singleAttributePerLine: true
1241
+ };
1242
+
1243
+ // src/utils/env.ts
1244
+ import { resolve } from "node:path";
1245
+ import process2 from "node:process";
1246
+ import { isPackageExists } from "local-pkg";
1247
+ var hasTypeScript = isPackageExists("typescript");
1248
+ var hasVitest = isPackageExists("vitest");
1249
+ var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
1250
+ paths: [resolve(process2.cwd(), "playground")]
1251
+ });
1252
+ var hasUnoCSS = isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
1253
+
1254
+ // src/utils/toArray.ts
1255
+ function toArray(val) {
1256
+ val = val ?? [];
1257
+ return Array.isArray(val) ? val : [val];
1258
+ }
1259
+
1260
+ // src/utils/interopDefault.ts
1261
+ async function interopDefault(mod) {
1262
+ const resolved = await mod;
1263
+ return resolved.default || resolved;
1264
+ }
1265
+
1266
+ // src/utils/loadPlugin.ts
1267
+ async function loadPlugin(name) {
1268
+ const mod = await import(name).catch((err) => {
1269
+ console.error(err);
1270
+ throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
1271
+ });
1272
+ return interopDefault(mod);
1273
+ }
1274
+
1275
+ // src/utils/resolveSubOptions.ts
1276
+ function resolveSubOptions(options, key) {
1277
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
1278
+ }
1279
+
1280
+ // src/utils/getOverrides.ts
1281
+ function getOverrides(options, key) {
1282
+ const sub = resolveSubOptions(options, key);
1283
+ return "overrides" in sub && sub.overrides ? sub.overrides : {};
1284
+ }
1285
+
1286
+ // src/utils/mergePrettierOptions.ts
1287
+ function mergePrettierOptions(options = {}, overrides = {}) {
1288
+ const result = {
1289
+ ...options,
1290
+ ...overrides,
1291
+ plugins: [
1292
+ // built-in plugins
1293
+ ...options.plugins || [],
1294
+ // custom plugins
1295
+ ...overrides.plugins || []
1296
+ ]
1297
+ };
1298
+ return result;
1299
+ }
1300
+
1301
+ // src/configs/format.ts
1302
+ var format = (options = {}) => {
1303
+ const {
1304
+ css: enableCSS = true,
1305
+ html: enableHTML = true,
1306
+ // user custom options
1307
+ prettierOptions = {}
1308
+ } = options;
1309
+ const sharedPrettierOptions = {
1310
+ ...DEFAULT_PRETTIER_OPTIONS,
1311
+ ...prettierOptions
1312
+ };
1313
+ const configs2 = [
1314
+ {
1315
+ name: "ntnyq/format/setup",
1316
+ plugins: {
1317
+ format: default11
1318
+ }
1319
+ }
1320
+ ];
1321
+ if (enableCSS) {
1322
+ configs2.push(
1323
+ {
1324
+ name: "ntnyq/format/css",
1325
+ files: [GLOB_CSS, GLOB_POSTCSS],
1326
+ languageOptions: {
1327
+ parser: parserPlain
1328
+ },
1329
+ rules: {
1330
+ "format/prettier": [
1331
+ "error",
1332
+ mergePrettierOptions(sharedPrettierOptions, {
1333
+ parser: "css"
1334
+ })
1335
+ ]
1336
+ }
1337
+ },
1338
+ {
1339
+ name: "ntnyq/format/scss",
1340
+ files: [GLOB_SCSS],
1341
+ languageOptions: {
1342
+ parser: parserPlain
1343
+ },
1344
+ rules: {
1345
+ "format/prettier": [
1346
+ "error",
1347
+ mergePrettierOptions(sharedPrettierOptions, {
1348
+ parser: "scss"
1349
+ })
1350
+ ]
1351
+ }
1352
+ },
1353
+ {
1354
+ name: "ntnyq/format/less",
1355
+ files: [GLOB_LESS],
1356
+ languageOptions: {
1357
+ parser: parserPlain
1358
+ },
1359
+ rules: {
1360
+ "format/prettier": [
1361
+ "error",
1362
+ mergePrettierOptions(sharedPrettierOptions, {
1363
+ parser: "less"
1364
+ })
1365
+ ]
1366
+ }
1367
+ }
1368
+ );
1369
+ }
1370
+ if (enableHTML) {
1371
+ configs2.push({
1372
+ name: "ntnyq/format/html",
1373
+ files: [GLOB_HTML],
1374
+ languageOptions: {
1375
+ parser: parserPlain
1376
+ },
1377
+ rules: {
1378
+ "format/prettier": [
1379
+ "error",
1380
+ mergePrettierOptions(sharedPrettierOptions, {
1381
+ parser: "html"
1382
+ })
1383
+ ]
1384
+ }
1385
+ });
1386
+ }
1387
+ return configs2;
1388
+ };
1389
+
1134
1390
  // src/configs/command.ts
1135
1391
  import createCommandConfig from "eslint-plugin-command/config";
1136
1392
  var command = (options = {}) => [
@@ -1157,7 +1413,7 @@ var imports = (options = {}) => [
1157
1413
  {
1158
1414
  name: "ntnyq/imports",
1159
1415
  plugins: {
1160
- import: default13
1416
+ import: default14
1161
1417
  },
1162
1418
  settings: {
1163
1419
  "import/resolver": {
@@ -1198,7 +1454,7 @@ var unicorn = (options = {}) => [
1198
1454
  {
1199
1455
  name: "ntnyq/unicorn",
1200
1456
  plugins: {
1201
- unicorn: default14
1457
+ unicorn: default15
1202
1458
  },
1203
1459
  rules: {
1204
1460
  "unicorn/error-message": "error",
@@ -1317,10 +1573,10 @@ var comments = (options = {}) => [
1317
1573
  {
1318
1574
  name: "ntnyq/eslint-comments",
1319
1575
  plugins: {
1320
- "@eslint-community/eslint-comments": default18
1576
+ "@eslint-community/eslint-comments": default20
1321
1577
  },
1322
1578
  rules: {
1323
- ...default18.configs.recommended.rules,
1579
+ ...default20.configs.recommended.rules,
1324
1580
  "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
1325
1581
  // Overrides rules
1326
1582
  ...options.overrides
@@ -1332,9 +1588,9 @@ var comments = (options = {}) => [
1332
1588
  var markdown = (options = {}) => {
1333
1589
  if (!Array.isArray(default7.configs?.processor)) return [];
1334
1590
  return [
1335
- ...default7.configs.processor.map((config) => ({
1336
- ...config,
1337
- name: `ntnyq/${config.name}`
1591
+ ...default7.configs.processor.map((config2) => ({
1592
+ ...config2,
1593
+ name: `ntnyq/${config2.name}`
1338
1594
  })),
1339
1595
  {
1340
1596
  name: "ntnyq/markdown/disabled/code-blocks",
@@ -1377,7 +1633,7 @@ var prettier = (options = {}) => {
1377
1633
  {
1378
1634
  name: "ntnyq/prettier",
1379
1635
  plugins: {
1380
- prettier: default15
1636
+ prettier: default16
1381
1637
  },
1382
1638
  rules: {
1383
1639
  "vue/array-bracket-newline": "off",
@@ -1417,7 +1673,7 @@ var prettier = (options = {}) => {
1417
1673
  "vue/space-infix-ops": "off",
1418
1674
  "vue/space-unary-ops": "off",
1419
1675
  "vue/template-curly-spacing": "off",
1420
- ...default15.configs.recommended.rules,
1676
+ ...default16.configs.recommended.rules,
1421
1677
  "prettier/prettier": options.level || "warn",
1422
1678
  // Overrides rules
1423
1679
  ...options.overrides
@@ -1430,7 +1686,7 @@ var prettier = (options = {}) => {
1430
1686
  name: "ntnyq/prettier/disabled",
1431
1687
  files: [...disabledFiles, ...userDisabledFiles],
1432
1688
  plugins: {
1433
- prettier: default15
1689
+ prettier: default16
1434
1690
  },
1435
1691
  rules: {
1436
1692
  "prettier/prettier": "off"
@@ -1684,12 +1940,28 @@ var jsx = () => [
1684
1940
  }
1685
1941
  ];
1686
1942
 
1943
+ // src/configs/githubAction.ts
1944
+ var githubAction = (options = {}) => [
1945
+ {
1946
+ name: "ntnyq/github-action",
1947
+ files: [GLOB_GITHUB_ACTION],
1948
+ plugins: {
1949
+ "github-action": default17
1950
+ },
1951
+ rules: {
1952
+ "github-action/require-action-name": "error",
1953
+ // Overrides rules
1954
+ ...options.overrides
1955
+ }
1956
+ }
1957
+ ];
1958
+
1687
1959
  // src/configs/perfectionist.ts
1688
1960
  var perfectionist = (options = {}) => [
1689
1961
  {
1690
1962
  name: "ntnyq/perfectionist",
1691
1963
  plugins: {
1692
- perfectionist: default16
1964
+ perfectionist: default18
1693
1965
  },
1694
1966
  rules: {
1695
1967
  "perfectionist/sort-imports": [
@@ -1734,7 +2006,7 @@ var perfectionist = (options = {}) => [
1734
2006
  order: options.imports?.order || "asc",
1735
2007
  type: options.imports?.type || "natural",
1736
2008
  ignoreCase: true,
1737
- internalPattern: ["~/**", "@/**", "#**"],
2009
+ internalPattern: ["^~/.+", "^@/.+", "^#.+"],
1738
2010
  newlinesBetween: "ignore"
1739
2011
  }
1740
2012
  ],
@@ -1775,7 +2047,7 @@ var unusedImports = (options = {}) => [
1775
2047
  {
1776
2048
  name: "ntnyq/unused-imports",
1777
2049
  plugins: {
1778
- "unused-imports": default17
2050
+ "unused-imports": default19
1779
2051
  },
1780
2052
  rules: {
1781
2053
  "@typescript-eslint/no-unused-vars": "off",
@@ -1799,60 +2071,17 @@ var unusedImports = (options = {}) => [
1799
2071
  }
1800
2072
  ];
1801
2073
 
1802
- // src/utils/env.ts
1803
- import { resolve } from "node:path";
1804
- import process2 from "node:process";
1805
- import { isPackageExists } from "local-pkg";
1806
- var hasTypeScript = isPackageExists("typescript");
1807
- var hasVitest = isPackageExists("vitest");
1808
- var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
1809
- paths: [resolve(process2.cwd(), "playground")]
1810
- });
1811
- var hasUnoCSS = isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
1812
-
1813
- // src/utils/toArray.ts
1814
- function toArray(val) {
1815
- val = val ?? [];
1816
- return Array.isArray(val) ? val : [val];
1817
- }
1818
-
1819
- // src/utils/interopDefault.ts
1820
- async function interopDefault(mod) {
1821
- const resolved = await mod;
1822
- return resolved.default || resolved;
1823
- }
1824
-
1825
- // src/utils/loadPlugin.ts
1826
- async function loadPlugin(name) {
1827
- const mod = await import(name).catch((err) => {
1828
- console.error(err);
1829
- throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
1830
- });
1831
- return interopDefault(mod);
1832
- }
1833
-
1834
- // src/utils/resolveSubOptions.ts
1835
- function resolveSubOptions(options, key) {
1836
- return typeof options[key] === "boolean" ? {} : options[key] || {};
1837
- }
1838
-
1839
- // src/utils/getOverrides.ts
1840
- function getOverrides(options, key) {
1841
- const sub = resolveSubOptions(options, key);
1842
- return "overrides" in sub && sub.overrides ? sub.overrides : {};
1843
- }
1844
-
1845
2074
  // src/core.ts
1846
2075
  function defineESLintConfig(options = {}, userConfigs = []) {
1847
- const configs = [];
2076
+ const configs2 = [];
1848
2077
  if (options.gitignore ?? true) {
1849
- configs.push(
2078
+ configs2.push(
1850
2079
  ...gitignore({
1851
2080
  ...resolveSubOptions(options, "gitignore")
1852
2081
  })
1853
2082
  );
1854
2083
  }
1855
- configs.push(
2084
+ configs2.push(
1856
2085
  ...ignores(options.ignores),
1857
2086
  ...jsx(),
1858
2087
  ...node({
@@ -1867,7 +2096,7 @@ function defineESLintConfig(options = {}, userConfigs = []) {
1867
2096
  })
1868
2097
  );
1869
2098
  if (options.perfectionist ?? true) {
1870
- configs.push(
2099
+ configs2.push(
1871
2100
  ...perfectionist({
1872
2101
  ...resolveSubOptions(options, "perfectionist"),
1873
2102
  overrides: getOverrides(options, "perfectionist")
@@ -1875,14 +2104,14 @@ function defineESLintConfig(options = {}, userConfigs = []) {
1875
2104
  );
1876
2105
  }
1877
2106
  if (options.unicorn ?? true) {
1878
- configs.push(
2107
+ configs2.push(
1879
2108
  ...unicorn({
1880
2109
  overrides: getOverrides(options, "unicorn")
1881
2110
  })
1882
2111
  );
1883
2112
  }
1884
2113
  if (options.regexp ?? true) {
1885
- configs.push(
2114
+ configs2.push(
1886
2115
  ...regexp({
1887
2116
  ...resolveSubOptions(options, "regexp"),
1888
2117
  overrides: getOverrides(options, "regexp")
@@ -1890,21 +2119,21 @@ function defineESLintConfig(options = {}, userConfigs = []) {
1890
2119
  );
1891
2120
  }
1892
2121
  if (options.jsdoc ?? true) {
1893
- configs.push(
2122
+ configs2.push(
1894
2123
  ...jsdoc({
1895
2124
  overrides: getOverrides(options, "jsdoc")
1896
2125
  })
1897
2126
  );
1898
2127
  }
1899
2128
  if (options.comments ?? true) {
1900
- configs.push(
2129
+ configs2.push(
1901
2130
  ...comments({
1902
2131
  overrides: getOverrides(options, "comments")
1903
2132
  })
1904
2133
  );
1905
2134
  }
1906
2135
  if (options.typescript ?? hasTypeScript) {
1907
- configs.push(
2136
+ configs2.push(
1908
2137
  ...typescript({
1909
2138
  ...resolveSubOptions(options, "typescript"),
1910
2139
  overrides: getOverrides(options, "typescript")
@@ -1912,35 +2141,35 @@ function defineESLintConfig(options = {}, userConfigs = []) {
1912
2141
  );
1913
2142
  }
1914
2143
  if (options.yml ?? true) {
1915
- configs.push(
2144
+ configs2.push(
1916
2145
  ...yml({
1917
2146
  overrides: getOverrides(options, "yml")
1918
2147
  })
1919
2148
  );
1920
2149
  }
1921
2150
  if (options.toml ?? true) {
1922
- configs.push(
2151
+ configs2.push(
1923
2152
  ...toml({
1924
2153
  overrides: getOverrides(options, "toml")
1925
2154
  })
1926
2155
  );
1927
2156
  }
1928
2157
  if (options.jsonc ?? true) {
1929
- configs.push(
2158
+ configs2.push(
1930
2159
  ...jsonc({
1931
2160
  overrides: getOverrides(options, "jsonc")
1932
2161
  })
1933
2162
  );
1934
2163
  }
1935
2164
  if (options.sort ?? true) {
1936
- configs.push(
2165
+ configs2.push(
1937
2166
  ...sort({
1938
2167
  ...resolveSubOptions(options, "sort")
1939
2168
  })
1940
2169
  );
1941
2170
  }
1942
2171
  if (options.vue ?? hasVue) {
1943
- configs.push(
2172
+ configs2.push(
1944
2173
  ...vue({
1945
2174
  ...resolveSubOptions(options, "vue"),
1946
2175
  overrides: getOverrides(options, "vue")
@@ -1948,7 +2177,7 @@ function defineESLintConfig(options = {}, userConfigs = []) {
1948
2177
  );
1949
2178
  }
1950
2179
  if (options.test ?? hasVitest) {
1951
- configs.push(
2180
+ configs2.push(
1952
2181
  ...test({
1953
2182
  overrides: getOverrides(options, "test")
1954
2183
  }),
@@ -1958,26 +2187,40 @@ function defineESLintConfig(options = {}, userConfigs = []) {
1958
2187
  );
1959
2188
  }
1960
2189
  if (options.unocss ?? hasUnoCSS) {
1961
- configs.push(
2190
+ configs2.push(
1962
2191
  ...unocss({
1963
2192
  overrides: getOverrides(options, "unocss")
1964
2193
  })
1965
2194
  );
1966
2195
  }
1967
2196
  if (options.markdown ?? true) {
1968
- configs.push(
2197
+ configs2.push(
1969
2198
  ...markdown({
1970
2199
  overrides: getOverrides(options, "markdown")
1971
2200
  })
1972
2201
  );
1973
2202
  }
1974
2203
  if (options.command ?? true) {
1975
- configs.push(
2204
+ configs2.push(
1976
2205
  ...command({
1977
2206
  ...resolveSubOptions(options, "command")
1978
2207
  })
1979
2208
  );
1980
2209
  }
2210
+ if (options.antfu ?? true) {
2211
+ configs2.push(
2212
+ ...antfu({
2213
+ overrides: getOverrides(options, "antfu")
2214
+ })
2215
+ );
2216
+ }
2217
+ if (options.githubAction ?? true) {
2218
+ configs2.push(
2219
+ ...githubAction({
2220
+ overrides: getOverrides(options, "githubAction")
2221
+ })
2222
+ );
2223
+ }
1981
2224
  const configSpecials = specials();
1982
2225
  const configPrettier = options.prettier ?? true ? prettier({
1983
2226
  ...resolveSubOptions(options, "prettier"),
@@ -1985,7 +2228,7 @@ function defineESLintConfig(options = {}, userConfigs = []) {
1985
2228
  }) : [];
1986
2229
  const composer = new FlatConfigComposer();
1987
2230
  composer.append(
1988
- ...configs,
2231
+ ...configs2,
1989
2232
  ...toArray(userConfigs),
1990
2233
  ...configSpecials,
1991
2234
  ...configPrettier
@@ -1993,12 +2236,14 @@ function defineESLintConfig(options = {}, userConfigs = []) {
1993
2236
  return composer;
1994
2237
  }
1995
2238
  export {
2239
+ DEFAULT_PRETTIER_OPTIONS,
1996
2240
  GLOB_ALL_SRC,
1997
2241
  GLOB_ASTRO,
1998
2242
  GLOB_CSS,
1999
2243
  GLOB_DIST,
2000
2244
  GLOB_DTS,
2001
2245
  GLOB_EXCLUDE,
2246
+ GLOB_GITHUB_ACTION,
2002
2247
  GLOB_HTML,
2003
2248
  GLOB_JS,
2004
2249
  GLOB_JSON,
@@ -2011,6 +2256,7 @@ export {
2011
2256
  GLOB_MARKDOWN_CODE,
2012
2257
  GLOB_MARKDOWN_NESTED,
2013
2258
  GLOB_NODE_MODULES,
2259
+ GLOB_POSTCSS,
2014
2260
  GLOB_SCSS,
2015
2261
  GLOB_SRC,
2016
2262
  GLOB_SRC_EXT,
@@ -2025,8 +2271,11 @@ export {
2025
2271
  antfu,
2026
2272
  command,
2027
2273
  comments,
2274
+ config as createTypeScriptConfig,
2028
2275
  defineESLintConfig,
2276
+ format,
2029
2277
  getOverrides,
2278
+ githubAction,
2030
2279
  gitignore,
2031
2280
  hasTypeScript,
2032
2281
  hasUnoCSS,
@@ -2041,32 +2290,41 @@ export {
2041
2290
  jsx,
2042
2291
  loadPlugin,
2043
2292
  markdown,
2293
+ mergePrettierOptions,
2294
+ mergeProcessors,
2044
2295
  node,
2045
2296
  ntnyq,
2046
2297
  parserJsonc,
2298
+ parserPlain,
2047
2299
  parserToml,
2300
+ parserTypeScript,
2048
2301
  parserVue,
2049
2302
  parserYaml,
2050
2303
  perfectionist,
2051
2304
  default8 as pluginAntfu,
2052
- default18 as pluginComments,
2053
- default13 as pluginImport,
2305
+ default20 as pluginComments,
2306
+ default11 as pluginFormat,
2307
+ default17 as pluginGitHubAction,
2308
+ default14 as pluginImport,
2054
2309
  default9 as pluginJsdoc,
2055
2310
  default10 as pluginJsonc,
2056
2311
  default7 as pluginMarkdown,
2057
2312
  default2 as pluginNode,
2058
2313
  default6 as pluginNtnyq,
2059
- default16 as pluginPerfectionist,
2060
- default15 as pluginPrettier,
2314
+ default18 as pluginPerfectionist,
2315
+ default16 as pluginPrettier,
2061
2316
  pluginRegexp,
2062
2317
  default5 as pluginToml,
2063
- default14 as pluginUnicorn,
2064
- default11 as pluginUnoCSS,
2065
- default17 as pluginUnusedImports,
2066
- default12 as pluginVitest,
2318
+ plugin as pluginTypeScript,
2319
+ default15 as pluginUnicorn,
2320
+ default12 as pluginUnoCSS,
2321
+ default19 as pluginUnusedImports,
2322
+ default13 as pluginVitest,
2067
2323
  default3 as pluginVue,
2068
2324
  default4 as pluginYaml,
2069
2325
  prettier,
2326
+ processorPassThrough,
2327
+ default21 as processorVueBlocks,
2070
2328
  regexp,
2071
2329
  resolveSubOptions,
2072
2330
  sort,
@@ -2074,8 +2332,8 @@ export {
2074
2332
  test,
2075
2333
  toArray,
2076
2334
  toml,
2077
- tseslint,
2078
2335
  typescript,
2336
+ configs as typescriptConfigs,
2079
2337
  typescriptCore,
2080
2338
  unicorn,
2081
2339
  unocss,