@ntnyq/eslint-config 4.0.0-beta.1 → 4.0.0-beta.2
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/README.md +1 -1
- package/dist/index.d.ts +14020 -13944
- package/dist/index.js +178 -166
- package/package.json +6 -10
package/dist/index.js
CHANGED
|
@@ -52,10 +52,11 @@ import { default as default14 } from "@vitest/eslint-plugin";
|
|
|
52
52
|
import { default as default15 } from "eslint-plugin-unicorn";
|
|
53
53
|
import { default as default16 } from "eslint-plugin-import-x";
|
|
54
54
|
import { default as default17 } from "eslint-plugin-prettier";
|
|
55
|
-
import { default as default18 } from "eslint-plugin-
|
|
56
|
-
import { default as default19 } from "eslint-plugin-
|
|
57
|
-
import { default as default20 } from "eslint-plugin-
|
|
58
|
-
import { default as default21 } from "
|
|
55
|
+
import { default as default18 } from "eslint-plugin-no-only-tests";
|
|
56
|
+
import { default as default19 } from "eslint-plugin-github-action";
|
|
57
|
+
import { default as default20 } from "eslint-plugin-perfectionist";
|
|
58
|
+
import { default as default21 } from "eslint-plugin-unused-imports";
|
|
59
|
+
import { default as default22 } from "@eslint-community/eslint-plugin-eslint-comments";
|
|
59
60
|
|
|
60
61
|
// src/eslint/configs.ts
|
|
61
62
|
import { configs } from "typescript-eslint";
|
|
@@ -67,7 +68,7 @@ var createNodeResolver = default16.createNodeResolver;
|
|
|
67
68
|
// src/eslint/processors.ts
|
|
68
69
|
import { mergeProcessors } from "eslint-merge-processors";
|
|
69
70
|
import { processorPassThrough } from "eslint-merge-processors";
|
|
70
|
-
import { default as
|
|
71
|
+
import { default as default23 } from "eslint-processor-vue-blocks";
|
|
71
72
|
|
|
72
73
|
// src/globs.ts
|
|
73
74
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -376,7 +377,7 @@ var configVue = (options = {}) => {
|
|
|
376
377
|
if (!sfcBlocks) return processorVueSFC;
|
|
377
378
|
return mergeProcessors2([
|
|
378
379
|
processorVueSFC,
|
|
379
|
-
|
|
380
|
+
default23({
|
|
380
381
|
...sfcBlocks,
|
|
381
382
|
blocks: {
|
|
382
383
|
styles: true,
|
|
@@ -941,36 +942,147 @@ var configToml = (options = {}) => [
|
|
|
941
942
|
}
|
|
942
943
|
];
|
|
943
944
|
|
|
944
|
-
// src/
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
945
|
+
// src/utils/env.ts
|
|
946
|
+
import { resolve } from "node:path";
|
|
947
|
+
import process from "node:process";
|
|
948
|
+
import { isPackageExists } from "local-pkg";
|
|
949
|
+
var hasPinia = () => isPackageExists("pinia");
|
|
950
|
+
var hasVitest = () => isPackageExists("vitest");
|
|
951
|
+
var hasTypeScript = () => isPackageExists("typescript");
|
|
952
|
+
var hasShadcnVue = () => isPackageExists("radix-vue") && isPackageExists("clsx");
|
|
953
|
+
var hasUnoCSS = () => isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
|
|
954
|
+
var hasVue = () => isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vuepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
|
|
955
|
+
paths: [resolve(process.cwd(), "playground"), resolve(process.cwd(), "docs")]
|
|
956
|
+
});
|
|
957
|
+
|
|
958
|
+
// src/utils/toArray.ts
|
|
959
|
+
function toArray(val) {
|
|
960
|
+
val = val ?? [];
|
|
961
|
+
return Array.isArray(val) ? val : [val];
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
// src/utils/resolveSubOptions.ts
|
|
965
|
+
function resolveSubOptions(options, key) {
|
|
966
|
+
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
// src/utils/getOverrides.ts
|
|
970
|
+
function getOverrides(options, key) {
|
|
971
|
+
const subOptions = resolveSubOptions(options, key);
|
|
972
|
+
return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
// src/utils/combineConfigs.ts
|
|
976
|
+
async function combineConfigs(...configs2) {
|
|
977
|
+
const resolved = await Promise.all(configs2);
|
|
978
|
+
return resolved.flat();
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
// src/utils/ensurePackages.ts
|
|
982
|
+
import process3 from "node:process";
|
|
983
|
+
import { fileURLToPath } from "node:url";
|
|
984
|
+
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
985
|
+
|
|
986
|
+
// src/utils/isInGitHooksOrRunByNanoStagedOrRunByTSX.ts
|
|
987
|
+
import process2 from "node:process";
|
|
988
|
+
function isInGitHooksOrRunByNanoStagedOrRunByTSX() {
|
|
989
|
+
return !!(process2.env.GIT_PARAMS || process2.env.VSCODE_GIT_COMMAND || // lint staged files
|
|
990
|
+
process2.env.npm_lifecycle_script?.startsWith("nano-staged") || // run `scripts/generateType.ts`
|
|
991
|
+
process2.env.npm_lifecycle_script?.startsWith("tsx"));
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
// src/utils/ensurePackages.ts
|
|
995
|
+
var scopeUrl = fileURLToPath(new URL(".", import.meta.url));
|
|
996
|
+
var isCwdInScope = isPackageExists2("@ntnyq/eslint-config");
|
|
997
|
+
function isPackageInScope(name) {
|
|
998
|
+
return isPackageExists2(name, {
|
|
999
|
+
paths: [scopeUrl]
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
async function ensurePackages(packages) {
|
|
1003
|
+
if (process3.env.CI || !process3.stdout.isTTY || isInGitHooksOrRunByNanoStagedOrRunByTSX() || !isCwdInScope) {
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
const nonExistingPackages = packages.filter((pkg) => !!pkg && !isPackageInScope(pkg));
|
|
1007
|
+
if (nonExistingPackages.length === 0) {
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
const { confirm } = await import("@clack/prompts");
|
|
1011
|
+
const confirmInstall = await confirm({
|
|
1012
|
+
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
|
|
1013
|
+
});
|
|
1014
|
+
if (confirmInstall) {
|
|
1015
|
+
try {
|
|
1016
|
+
const { installPackage } = await import("@antfu/install-pkg");
|
|
1017
|
+
await installPackage(nonExistingPackages, { dev: true });
|
|
1018
|
+
} catch (err) {
|
|
1019
|
+
console.log(err);
|
|
954
1020
|
}
|
|
955
1021
|
}
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
// src/utils/interopDefault.ts
|
|
1025
|
+
async function interopDefault(mod) {
|
|
1026
|
+
const resolved = await mod;
|
|
1027
|
+
return resolved.default || resolved;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
// src/utils/mergePrettierOptions.ts
|
|
1031
|
+
function mergePrettierOptions(options = {}, overrides = {}) {
|
|
1032
|
+
const result = {
|
|
1033
|
+
...options,
|
|
1034
|
+
...overrides,
|
|
1035
|
+
plugins: [
|
|
1036
|
+
// built-in plugins
|
|
1037
|
+
...options.plugins || [],
|
|
1038
|
+
// custom plugins
|
|
1039
|
+
...overrides.plugins || []
|
|
1040
|
+
]
|
|
1041
|
+
};
|
|
1042
|
+
return result;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
// src/configs/test.ts
|
|
1046
|
+
var configTest = (options = {}) => {
|
|
1047
|
+
const {
|
|
1048
|
+
// default test files
|
|
1049
|
+
files = [...GLOB_TEST],
|
|
1050
|
+
vitest: enableVitest = hasVitest()
|
|
1051
|
+
} = options;
|
|
1052
|
+
const configs2 = [
|
|
1053
|
+
{
|
|
1054
|
+
name: "ntnyq/test/setup",
|
|
1055
|
+
plugins: {
|
|
1056
|
+
"no-only-tests": default18
|
|
1057
|
+
}
|
|
1058
|
+
},
|
|
961
1059
|
{
|
|
962
|
-
name: "ntnyq/
|
|
1060
|
+
name: "ntnyq/test/base",
|
|
1061
|
+
files,
|
|
1062
|
+
rules: {
|
|
1063
|
+
"no-unused-expressions": "off",
|
|
1064
|
+
"max-lines-per-function": "off",
|
|
1065
|
+
"no-only-tests/no-only-tests": "error",
|
|
1066
|
+
// Overrides rules
|
|
1067
|
+
...options.overrides
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
];
|
|
1071
|
+
if (enableVitest) {
|
|
1072
|
+
configs2.push({
|
|
1073
|
+
name: "ntnyq/test/vitest",
|
|
1074
|
+
files,
|
|
963
1075
|
plugins: {
|
|
964
1076
|
vitest: default14
|
|
965
1077
|
},
|
|
966
|
-
files: [...GLOB_TEST],
|
|
967
1078
|
rules: {
|
|
968
|
-
...
|
|
1079
|
+
...default14.configs.recommended.rules,
|
|
969
1080
|
// Overrides rules
|
|
970
1081
|
...options.overridesVitestRules
|
|
971
1082
|
}
|
|
972
|
-
}
|
|
973
|
-
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
return configs2;
|
|
974
1086
|
};
|
|
975
1087
|
|
|
976
1088
|
// src/configs/svgo.ts
|
|
@@ -1324,106 +1436,6 @@ var DEFAULT_PRETTIER_OPTIONS = {
|
|
|
1324
1436
|
vueIndentScriptAndStyle: false
|
|
1325
1437
|
};
|
|
1326
1438
|
|
|
1327
|
-
// src/utils/env.ts
|
|
1328
|
-
import { resolve } from "node:path";
|
|
1329
|
-
import process from "node:process";
|
|
1330
|
-
import { isPackageExists } from "local-pkg";
|
|
1331
|
-
var hasPinia = isPackageExists("pinia");
|
|
1332
|
-
var hasVitest = isPackageExists("vitest");
|
|
1333
|
-
var hasTypeScript = isPackageExists("typescript");
|
|
1334
|
-
var hasShadcnVue = isPackageExists("radix-vue") && isPackageExists("clsx");
|
|
1335
|
-
var hasUnoCSS = isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
|
|
1336
|
-
var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vuepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
|
|
1337
|
-
paths: [resolve(process.cwd(), "playground"), resolve(process.cwd(), "docs")]
|
|
1338
|
-
});
|
|
1339
|
-
|
|
1340
|
-
// src/utils/toArray.ts
|
|
1341
|
-
function toArray(val) {
|
|
1342
|
-
val = val ?? [];
|
|
1343
|
-
return Array.isArray(val) ? val : [val];
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
// src/utils/resolveSubOptions.ts
|
|
1347
|
-
function resolveSubOptions(options, key) {
|
|
1348
|
-
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
|
-
// src/utils/getOverrides.ts
|
|
1352
|
-
function getOverrides(options, key) {
|
|
1353
|
-
const subOptions = resolveSubOptions(options, key);
|
|
1354
|
-
return "overrides" in subOptions && subOptions.overrides ? subOptions.overrides : {};
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
// src/utils/combineConfigs.ts
|
|
1358
|
-
async function combineConfigs(...configs2) {
|
|
1359
|
-
const resolved = await Promise.all(configs2);
|
|
1360
|
-
return resolved.flat();
|
|
1361
|
-
}
|
|
1362
|
-
|
|
1363
|
-
// src/utils/ensurePackages.ts
|
|
1364
|
-
import process3 from "node:process";
|
|
1365
|
-
import { fileURLToPath } from "node:url";
|
|
1366
|
-
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
1367
|
-
|
|
1368
|
-
// src/utils/isInGitHooksOrRunByNanoStagedOrRunByTSX.ts
|
|
1369
|
-
import process2 from "node:process";
|
|
1370
|
-
function isInGitHooksOrRunByNanoStagedOrRunByTSX() {
|
|
1371
|
-
return !!(process2.env.GIT_PARAMS || process2.env.VSCODE_GIT_COMMAND || // lint staged files
|
|
1372
|
-
process2.env.npm_lifecycle_script?.startsWith("nano-staged") || // run `scripts/generateType.ts`
|
|
1373
|
-
process2.env.npm_lifecycle_script?.startsWith("tsx"));
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
// src/utils/ensurePackages.ts
|
|
1377
|
-
var scopeUrl = fileURLToPath(new URL(".", import.meta.url));
|
|
1378
|
-
var isCwdInScope = isPackageExists2("@ntnyq/eslint-config");
|
|
1379
|
-
function isPackageInScope(name) {
|
|
1380
|
-
return isPackageExists2(name, {
|
|
1381
|
-
paths: [scopeUrl]
|
|
1382
|
-
});
|
|
1383
|
-
}
|
|
1384
|
-
async function ensurePackages(packages) {
|
|
1385
|
-
if (process3.env.CI || !process3.stdout.isTTY || isInGitHooksOrRunByNanoStagedOrRunByTSX() || !isCwdInScope) {
|
|
1386
|
-
return;
|
|
1387
|
-
}
|
|
1388
|
-
const nonExistingPackages = packages.filter((pkg) => !!pkg && !isPackageInScope(pkg));
|
|
1389
|
-
if (nonExistingPackages.length === 0) {
|
|
1390
|
-
return;
|
|
1391
|
-
}
|
|
1392
|
-
const { confirm } = await import("@clack/prompts");
|
|
1393
|
-
const confirmInstall = await confirm({
|
|
1394
|
-
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
|
|
1395
|
-
});
|
|
1396
|
-
if (confirmInstall) {
|
|
1397
|
-
try {
|
|
1398
|
-
const { installPackage } = await import("@antfu/install-pkg");
|
|
1399
|
-
await installPackage(nonExistingPackages, { dev: true });
|
|
1400
|
-
} catch (err) {
|
|
1401
|
-
console.log(err);
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
// src/utils/interopDefault.ts
|
|
1407
|
-
async function interopDefault(mod) {
|
|
1408
|
-
const resolved = await mod;
|
|
1409
|
-
return resolved.default || resolved;
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
// src/utils/mergePrettierOptions.ts
|
|
1413
|
-
function mergePrettierOptions(options = {}, overrides = {}) {
|
|
1414
|
-
const result = {
|
|
1415
|
-
...options,
|
|
1416
|
-
...overrides,
|
|
1417
|
-
plugins: [
|
|
1418
|
-
// built-in plugins
|
|
1419
|
-
...options.plugins || [],
|
|
1420
|
-
// custom plugins
|
|
1421
|
-
...overrides.plugins || []
|
|
1422
|
-
]
|
|
1423
|
-
};
|
|
1424
|
-
return result;
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
1439
|
// src/configs/format.ts
|
|
1428
1440
|
var configFormat = (options = {}) => {
|
|
1429
1441
|
const {
|
|
@@ -1731,7 +1743,7 @@ import globals from "globals";
|
|
|
1731
1743
|
var configSpecials = (options = {}) => {
|
|
1732
1744
|
const {
|
|
1733
1745
|
// Enable shadcn-vue support
|
|
1734
|
-
shadcnVue: enableShadcnVue = hasShadcnVue
|
|
1746
|
+
shadcnVue: enableShadcnVue = hasShadcnVue()
|
|
1735
1747
|
} = options;
|
|
1736
1748
|
const configs2 = [
|
|
1737
1749
|
{
|
|
@@ -1778,7 +1790,7 @@ var configSpecials = (options = {}) => {
|
|
|
1778
1790
|
files: [`**/*.config*.${GLOB_SRC_EXT}`],
|
|
1779
1791
|
plugins: {
|
|
1780
1792
|
"import-x": default16,
|
|
1781
|
-
perfectionist:
|
|
1793
|
+
perfectionist: default20
|
|
1782
1794
|
},
|
|
1783
1795
|
rules: {
|
|
1784
1796
|
"no-console": "off",
|
|
@@ -1803,6 +1815,8 @@ var configSpecials = (options = {}) => {
|
|
|
1803
1815
|
name: "ntnyq/specials/shadcn-vue",
|
|
1804
1816
|
files: shadcnOptions.files || ["**/components/ui/**/*.ts", "**/components/ui/**/*.vue"],
|
|
1805
1817
|
rules: {
|
|
1818
|
+
"vue/define-emits-declaration": "off",
|
|
1819
|
+
"import-x/consistent-type-specifier-style": "off",
|
|
1806
1820
|
"@typescript-eslint/no-unused-vars": "off",
|
|
1807
1821
|
"@typescript-eslint/consistent-type-imports": "off",
|
|
1808
1822
|
// Overrides rules
|
|
@@ -1816,22 +1830,6 @@ var configSpecials = (options = {}) => {
|
|
|
1816
1830
|
return configs2;
|
|
1817
1831
|
};
|
|
1818
1832
|
|
|
1819
|
-
// src/configs/comments.ts
|
|
1820
|
-
var configComments = (options = {}) => [
|
|
1821
|
-
{
|
|
1822
|
-
name: "ntnyq/eslint-comments",
|
|
1823
|
-
plugins: {
|
|
1824
|
-
"@eslint-community/eslint-comments": default21
|
|
1825
|
-
},
|
|
1826
|
-
rules: {
|
|
1827
|
-
...default21.configs.recommended.rules,
|
|
1828
|
-
"@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
|
|
1829
|
-
// Overrides rules
|
|
1830
|
-
...options.overrides
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1833
|
-
];
|
|
1834
|
-
|
|
1835
1833
|
// src/configs/markdown.ts
|
|
1836
1834
|
var configMarkdown = (options = {}) => {
|
|
1837
1835
|
const {
|
|
@@ -2587,7 +2585,7 @@ var configPerfectionist = (options = {}) => {
|
|
|
2587
2585
|
{
|
|
2588
2586
|
name: "ntnyq/perfectionist/common",
|
|
2589
2587
|
plugins: {
|
|
2590
|
-
perfectionist:
|
|
2588
|
+
perfectionist: default20
|
|
2591
2589
|
},
|
|
2592
2590
|
rules: {
|
|
2593
2591
|
"perfectionist/sort-imports": [
|
|
@@ -2673,7 +2671,7 @@ var configPerfectionist = (options = {}) => {
|
|
|
2673
2671
|
name: "ntnyq/perfectionist/enums",
|
|
2674
2672
|
files: [`**/enums/${GLOB_SRC}`, `**/enums.${GLOB_SRC_EXT}`],
|
|
2675
2673
|
plugins: {
|
|
2676
|
-
perfectionist:
|
|
2674
|
+
perfectionist: default20
|
|
2677
2675
|
},
|
|
2678
2676
|
rules: {
|
|
2679
2677
|
"perfectionist/sort-enums": [
|
|
@@ -2698,7 +2696,7 @@ var configPerfectionist = (options = {}) => {
|
|
|
2698
2696
|
name: "ntnyq/perfectionist/types",
|
|
2699
2697
|
files: [...GLOB_TYPES],
|
|
2700
2698
|
plugins: {
|
|
2701
|
-
perfectionist:
|
|
2699
|
+
perfectionist: default20
|
|
2702
2700
|
},
|
|
2703
2701
|
rules: {
|
|
2704
2702
|
"perfectionist/sort-heritage-clauses": [
|
|
@@ -2754,7 +2752,7 @@ var configPerfectionist = (options = {}) => {
|
|
|
2754
2752
|
name: "ntnyq/perfectionist/constants",
|
|
2755
2753
|
files: [`**/constants/${GLOB_SRC}`, `**/constants.${GLOB_SRC_EXT}`],
|
|
2756
2754
|
plugins: {
|
|
2757
|
-
perfectionist:
|
|
2755
|
+
perfectionist: default20
|
|
2758
2756
|
},
|
|
2759
2757
|
rules: {
|
|
2760
2758
|
"perfectionist/sort-maps": [
|
|
@@ -2795,7 +2793,7 @@ var configUnusedImports = (options = {}) => [
|
|
|
2795
2793
|
{
|
|
2796
2794
|
name: "ntnyq/unused-imports",
|
|
2797
2795
|
plugins: {
|
|
2798
|
-
"unused-imports":
|
|
2796
|
+
"unused-imports": default21
|
|
2799
2797
|
},
|
|
2800
2798
|
rules: {
|
|
2801
2799
|
"@typescript-eslint/no-unused-vars": "off",
|
|
@@ -2819,6 +2817,22 @@ var configUnusedImports = (options = {}) => [
|
|
|
2819
2817
|
}
|
|
2820
2818
|
];
|
|
2821
2819
|
|
|
2820
|
+
// src/configs/eslintComments.ts
|
|
2821
|
+
var configESLintComments = (options = {}) => [
|
|
2822
|
+
{
|
|
2823
|
+
name: "ntnyq/eslint-comments",
|
|
2824
|
+
plugins: {
|
|
2825
|
+
"@eslint-community/eslint-comments": default22
|
|
2826
|
+
},
|
|
2827
|
+
rules: {
|
|
2828
|
+
...default22.configs.recommended.rules,
|
|
2829
|
+
"@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
|
|
2830
|
+
// Overrides rules
|
|
2831
|
+
...options.overrides
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
];
|
|
2835
|
+
|
|
2822
2836
|
// src/core.ts
|
|
2823
2837
|
function defineESLintConfig(options = {}, ...userConfigs) {
|
|
2824
2838
|
const {
|
|
@@ -2829,11 +2843,11 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2829
2843
|
/**
|
|
2830
2844
|
* Conditional by deps
|
|
2831
2845
|
*/
|
|
2832
|
-
vue: enableVue = hasVue,
|
|
2833
|
-
pinia: enablePinia = hasPinia,
|
|
2834
|
-
test: enableTest = hasVitest,
|
|
2835
|
-
unocss: enableUnoCSS = hasUnoCSS,
|
|
2836
|
-
typescript: enableTypeScript = hasTypeScript,
|
|
2846
|
+
vue: enableVue = hasVue(),
|
|
2847
|
+
pinia: enablePinia = hasPinia(),
|
|
2848
|
+
test: enableTest = hasVitest(),
|
|
2849
|
+
unocss: enableUnoCSS = hasUnoCSS(),
|
|
2850
|
+
typescript: enableTypeScript = hasTypeScript(),
|
|
2837
2851
|
/**
|
|
2838
2852
|
* Enabled by default
|
|
2839
2853
|
*/
|
|
@@ -2879,8 +2893,8 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2879
2893
|
overrides: getOverrides(options, "jsdoc"),
|
|
2880
2894
|
...resolveSubOptions(options, "jsdoc")
|
|
2881
2895
|
}),
|
|
2882
|
-
|
|
2883
|
-
overrides: getOverrides(options, "
|
|
2896
|
+
configESLintComments({
|
|
2897
|
+
overrides: getOverrides(options, "eslintComments")
|
|
2884
2898
|
}),
|
|
2885
2899
|
configJavaScript({
|
|
2886
2900
|
...resolveSubOptions(options, "javascript"),
|
|
@@ -2963,9 +2977,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2963
2977
|
if (enableTest) {
|
|
2964
2978
|
configs2.push(
|
|
2965
2979
|
configTest({
|
|
2966
|
-
|
|
2967
|
-
}),
|
|
2968
|
-
configVitest({
|
|
2980
|
+
...resolveSubOptions(options, "test"),
|
|
2969
2981
|
overrides: getOverrides(options, "test")
|
|
2970
2982
|
})
|
|
2971
2983
|
);
|
|
@@ -3079,8 +3091,8 @@ export {
|
|
|
3079
3091
|
combineConfigs,
|
|
3080
3092
|
configAntfu,
|
|
3081
3093
|
configCommand,
|
|
3082
|
-
configComments,
|
|
3083
3094
|
configDepend,
|
|
3095
|
+
configESLintComments,
|
|
3084
3096
|
configESLintPlugin,
|
|
3085
3097
|
configFormat,
|
|
3086
3098
|
configGitHubAction,
|
|
@@ -3107,7 +3119,6 @@ export {
|
|
|
3107
3119
|
configUnicorn,
|
|
3108
3120
|
configUnoCSS,
|
|
3109
3121
|
configUnusedImports,
|
|
3110
|
-
configVitest,
|
|
3111
3122
|
configVue,
|
|
3112
3123
|
configYml,
|
|
3113
3124
|
configs as configsTypescript,
|
|
@@ -3133,16 +3144,17 @@ export {
|
|
|
3133
3144
|
parserVue,
|
|
3134
3145
|
parserYaml,
|
|
3135
3146
|
default9 as pluginAntfu,
|
|
3136
|
-
|
|
3147
|
+
default22 as pluginComments,
|
|
3137
3148
|
pluginDepend,
|
|
3138
3149
|
default12 as pluginFormat,
|
|
3139
|
-
|
|
3150
|
+
default19 as pluginGitHubAction,
|
|
3140
3151
|
default16 as pluginImportX,
|
|
3141
3152
|
default10 as pluginJsdoc,
|
|
3142
3153
|
default11 as pluginJsonc,
|
|
3143
3154
|
default8 as pluginMarkdown,
|
|
3155
|
+
default18 as pluginNoOnlyTests,
|
|
3144
3156
|
default2 as pluginNode,
|
|
3145
|
-
|
|
3157
|
+
default20 as pluginPerfectionist,
|
|
3146
3158
|
default7 as pluginPinia,
|
|
3147
3159
|
default17 as pluginPrettier,
|
|
3148
3160
|
pluginRegexp,
|
|
@@ -3151,12 +3163,12 @@ export {
|
|
|
3151
3163
|
plugin as pluginTypeScript,
|
|
3152
3164
|
default15 as pluginUnicorn,
|
|
3153
3165
|
default13 as pluginUnoCSS,
|
|
3154
|
-
|
|
3166
|
+
default21 as pluginUnusedImports,
|
|
3155
3167
|
default14 as pluginVitest,
|
|
3156
3168
|
default3 as pluginVue,
|
|
3157
3169
|
default4 as pluginYml,
|
|
3158
3170
|
processorPassThrough,
|
|
3159
|
-
|
|
3171
|
+
default23 as processorVueBlocks,
|
|
3160
3172
|
resolveSubOptions,
|
|
3161
3173
|
toArray
|
|
3162
3174
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ntnyq/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.2",
|
|
5
5
|
"packageManager": "pnpm@9.15.5",
|
|
6
6
|
"description": "An opinionated ESLint config preset of ntnyq",
|
|
7
7
|
"keywords": [
|
|
@@ -64,12 +64,12 @@
|
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@antfu/install-pkg": "^1.0.0",
|
|
67
|
-
"@clack/prompts": "^0.
|
|
67
|
+
"@clack/prompts": "^0.10.0",
|
|
68
68
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
69
69
|
"@eslint/js": "^9.19.0",
|
|
70
70
|
"@eslint/markdown": "^6.2.2",
|
|
71
71
|
"@unocss/eslint-plugin": "^65.4.3",
|
|
72
|
-
"@vitest/eslint-plugin": "^1.1.
|
|
72
|
+
"@vitest/eslint-plugin": "^1.1.26",
|
|
73
73
|
"eslint-config-flat-gitignore": "^2.0.0",
|
|
74
74
|
"eslint-flat-config-utils": "^2.0.1",
|
|
75
75
|
"eslint-import-resolver-typescript": "^3.7.0",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"eslint-plugin-jsdoc": "^50.6.3",
|
|
84
84
|
"eslint-plugin-jsonc": "^2.19.1",
|
|
85
85
|
"eslint-plugin-n": "^17.15.1",
|
|
86
|
+
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
86
87
|
"eslint-plugin-ntnyq": "^0.9.2",
|
|
87
88
|
"eslint-plugin-perfectionist": "^4.8.0",
|
|
88
89
|
"eslint-plugin-pinia": "^0.4.1",
|
|
@@ -107,7 +108,7 @@
|
|
|
107
108
|
"devDependencies": {
|
|
108
109
|
"@ntnyq/prettier-config": "^1.22.1",
|
|
109
110
|
"@types/node": "^22.13.1",
|
|
110
|
-
"bumpp": "^10.0.
|
|
111
|
+
"bumpp": "^10.0.2",
|
|
111
112
|
"eslint": "^9.19.0",
|
|
112
113
|
"eslint-typegen": "^1.0.0",
|
|
113
114
|
"husky": "^9.1.7",
|
|
@@ -122,13 +123,8 @@
|
|
|
122
123
|
"engines": {
|
|
123
124
|
"node": ">=18.18.0"
|
|
124
125
|
},
|
|
125
|
-
"pnpm": {
|
|
126
|
-
"patchedDependencies": {
|
|
127
|
-
"@vitest/eslint-plugin": "patches/@vitest__eslint-plugin.patch"
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
126
|
"nano-staged": {
|
|
131
127
|
"*.{js,ts,mjs,cjs,vue,svg,json,jsonc,md,yaml,yml}": "eslint --fix",
|
|
132
|
-
"*.css": "prettier
|
|
128
|
+
"*.{css,scss,html}": "prettier -uw"
|
|
133
129
|
}
|
|
134
130
|
}
|