@ntnyq/eslint-config 3.2.2 → 3.3.1

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