@svifty7/eslint-config 0.0.2 → 0.0.5
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 +0 -1
- package/dist/{index.d.ts → index.d.mts} +1904 -855
- package/dist/{index.js → index.mjs} +44 -23
- package/package.json +44 -43
|
@@ -327,8 +327,7 @@ const parserPlain = {
|
|
|
327
327
|
* Combine array and non-array configs into a single array.
|
|
328
328
|
*/
|
|
329
329
|
async function combine(...configs$1) {
|
|
330
|
-
|
|
331
|
-
return resolved.flat();
|
|
330
|
+
return (await Promise.all(configs$1)).flat();
|
|
332
331
|
}
|
|
333
332
|
/**
|
|
334
333
|
* Rename plugin prefixes in a rule object.
|
|
@@ -379,7 +378,9 @@ const StylisticConfigDefaults = {
|
|
|
379
378
|
blockSpacing: true,
|
|
380
379
|
quoteProps: "consistent-as-needed",
|
|
381
380
|
commaDangle: "always-multiline",
|
|
382
|
-
pluginName: "style"
|
|
381
|
+
pluginName: "style",
|
|
382
|
+
severity: "error",
|
|
383
|
+
experimental: false
|
|
383
384
|
};
|
|
384
385
|
async function stylistic(options = {}) {
|
|
385
386
|
const stylisticConfig = {
|
|
@@ -544,7 +545,6 @@ function mergePrettierOptions(options, overrides = {}) {
|
|
|
544
545
|
parser: config.parser,
|
|
545
546
|
plugins: config.plugins,
|
|
546
547
|
bracketSameLine: config.bracketSameLine,
|
|
547
|
-
printWidth: config.printWidth,
|
|
548
548
|
singleAttributePerLine: config.singleAttributePerLine,
|
|
549
549
|
tabWidth: config.tabWidth,
|
|
550
550
|
xmlQuoteAttributes: config.xmlQuoteAttributes,
|
|
@@ -554,7 +554,7 @@ function mergePrettierOptions(options, overrides = {}) {
|
|
|
554
554
|
};
|
|
555
555
|
return config;
|
|
556
556
|
}
|
|
557
|
-
async function formatters(stylistic$1 = {}) {
|
|
557
|
+
async function formatters(stylistic$1 = {}, prettier = {}) {
|
|
558
558
|
const { indent, quotes, semi } = {
|
|
559
559
|
...StylisticConfigDefaults,
|
|
560
560
|
...stylistic$1
|
|
@@ -564,7 +564,6 @@ async function formatters(stylistic$1 = {}) {
|
|
|
564
564
|
singleQuote: quotes === "single",
|
|
565
565
|
tabWidth: typeof indent === "number" ? indent : 2,
|
|
566
566
|
useTabs: indent === "tab",
|
|
567
|
-
printWidth: 80,
|
|
568
567
|
quoteProps: "consistent",
|
|
569
568
|
jsxSingleQuote: false,
|
|
570
569
|
trailingComma: "all",
|
|
@@ -578,11 +577,10 @@ async function formatters(stylistic$1 = {}) {
|
|
|
578
577
|
vueIndentScriptAndStyle: true,
|
|
579
578
|
endOfLine: "lf",
|
|
580
579
|
singleAttributePerLine: true,
|
|
581
|
-
|
|
582
|
-
experimentalTernaries: false,
|
|
583
|
-
experimentalOperatorPosition: "start"
|
|
580
|
+
...prettier
|
|
584
581
|
};
|
|
585
582
|
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
583
|
+
const tailwindPluginPath = resolveModule("prettier-plugin-tailwindcss", { paths: [fileURLToPath(import.meta.url)] });
|
|
586
584
|
const configs$1 = [{
|
|
587
585
|
name: "svifty7/formatter/setup",
|
|
588
586
|
plugins: { format: pluginFormat }
|
|
@@ -590,7 +588,7 @@ async function formatters(stylistic$1 = {}) {
|
|
|
590
588
|
configs$1.push({
|
|
591
589
|
files: [GLOB_SRC, GLOB_VUE],
|
|
592
590
|
name: "svifty7/formatter/prettier",
|
|
593
|
-
rules: { "format/prettier": ["error", prettierOptions] }
|
|
591
|
+
rules: { "format/prettier": ["error", tailwindPluginPath ? mergePrettierOptions(prettierOptions, { plugins: [tailwindPluginPath] }) : prettierOptions] }
|
|
594
592
|
});
|
|
595
593
|
configs$1.push({
|
|
596
594
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
@@ -612,7 +610,10 @@ async function formatters(stylistic$1 = {}) {
|
|
|
612
610
|
files: [GLOB_HTML],
|
|
613
611
|
languageOptions: { parser: parserPlain },
|
|
614
612
|
name: "svifty7/formatter/html",
|
|
615
|
-
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, {
|
|
613
|
+
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, {
|
|
614
|
+
parser: "html",
|
|
615
|
+
plugins: tailwindPluginPath ? [tailwindPluginPath] : void 0
|
|
616
|
+
})] }
|
|
616
617
|
});
|
|
617
618
|
configs$1.push({
|
|
618
619
|
files: [GLOB_MARKDOWN],
|
|
@@ -1139,32 +1140,50 @@ function perfectionist() {
|
|
|
1139
1140
|
rules: {
|
|
1140
1141
|
"perfectionist/sort-exports": ["error", {
|
|
1141
1142
|
order: "asc",
|
|
1142
|
-
type: "natural"
|
|
1143
|
+
type: "natural",
|
|
1144
|
+
newlinesBetween: 1,
|
|
1145
|
+
groups: [
|
|
1146
|
+
"type-export",
|
|
1147
|
+
{
|
|
1148
|
+
group: "multiline-export",
|
|
1149
|
+
newlinesInside: 1
|
|
1150
|
+
},
|
|
1151
|
+
"singleline-export"
|
|
1152
|
+
]
|
|
1143
1153
|
}],
|
|
1144
1154
|
"perfectionist/sort-imports": ["error", {
|
|
1145
1155
|
groups: [
|
|
1146
1156
|
"builtin",
|
|
1147
1157
|
"external",
|
|
1148
|
-
"type",
|
|
1149
1158
|
"internal",
|
|
1159
|
+
"tsconfig-path",
|
|
1160
|
+
"subpath",
|
|
1150
1161
|
"parent",
|
|
1151
1162
|
"sibling",
|
|
1152
1163
|
"index",
|
|
1153
|
-
"side-effect",
|
|
1154
1164
|
"unknown",
|
|
1165
|
+
"type-builtin",
|
|
1166
|
+
"type-external",
|
|
1167
|
+
[
|
|
1168
|
+
"type-internal",
|
|
1169
|
+
"type-tsconfig-path",
|
|
1170
|
+
"type-subpath"
|
|
1171
|
+
],
|
|
1155
1172
|
[
|
|
1156
|
-
"parent
|
|
1157
|
-
"sibling
|
|
1158
|
-
"index
|
|
1159
|
-
"internal-type"
|
|
1173
|
+
"type-parent",
|
|
1174
|
+
"type-sibling",
|
|
1175
|
+
"type-index"
|
|
1160
1176
|
],
|
|
1161
|
-
"
|
|
1177
|
+
"side-effect",
|
|
1178
|
+
"side-effect-style",
|
|
1179
|
+
"style"
|
|
1162
1180
|
],
|
|
1163
1181
|
internalPattern: ["^~/.+", "^@/.+"],
|
|
1164
|
-
newlinesBetween:
|
|
1182
|
+
newlinesBetween: 1,
|
|
1165
1183
|
order: "asc",
|
|
1166
1184
|
type: "natural",
|
|
1167
|
-
|
|
1185
|
+
tsconfig: { rootDir: process.cwd() },
|
|
1186
|
+
fallbackSort: { type: "unsorted" }
|
|
1168
1187
|
}],
|
|
1169
1188
|
"perfectionist/sort-named-exports": ["error", {
|
|
1170
1189
|
order: "asc",
|
|
@@ -2027,7 +2046,8 @@ function configure(options = {}, ...userConfigs) {
|
|
|
2027
2046
|
regexp: true,
|
|
2028
2047
|
typescript: isPackageExists("typescript") ? {} : void 0,
|
|
2029
2048
|
unicorn: true,
|
|
2030
|
-
vue: VuePackages.some((i) => isPackageExists(i)) ? {} : void 0
|
|
2049
|
+
vue: VuePackages.some((i) => isPackageExists(i)) ? {} : void 0,
|
|
2050
|
+
prettier: true
|
|
2031
2051
|
};
|
|
2032
2052
|
const { autoRenamePlugins, componentExts = [], gitignore: enableGitignore, jsx: enableJsx, pnpm: enableCatalogs, regexp: enableRegexp, typescript: enableTypeScript, unicorn: enableUnicorn, vue: enableVue } = Object.assign(defaultConfig, options);
|
|
2033
2053
|
let isInEditor = options.isInEditor;
|
|
@@ -2068,7 +2088,8 @@ function configure(options = {}, ...userConfigs) {
|
|
|
2068
2088
|
if (options.yaml ?? true) configs$1.push(yaml({ stylistic: stylisticOptions }));
|
|
2069
2089
|
if (options.toml ?? true) configs$1.push(toml({ stylistic: stylisticOptions }));
|
|
2070
2090
|
if (options.markdown ?? true) configs$1.push(markdown({ componentExts }));
|
|
2071
|
-
configs$1.push(formatters(
|
|
2091
|
+
if (typeof options.prettier === "object") configs$1.push(formatters(options.stylistic, options.prettier));
|
|
2092
|
+
else if (options.prettier ?? true) configs$1.push(formatters(options.stylistic));
|
|
2072
2093
|
configs$1.push(disables());
|
|
2073
2094
|
if ("files" in options) throw new Error("[@svifty7/eslint-config] The first argument should not contain the \"files\" property as the options are supposed to be global. Place it in the second or later config instead.");
|
|
2074
2095
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svifty7/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"description": "ESLint config by svifty7 based on @antfu/eslint-config",
|
|
6
6
|
"author": "svifty7 (https://github.com/svifty7)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -44,56 +44,57 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
47
|
-
"@eslint/markdown": "^
|
|
48
|
-
"@prettier/plugin-xml": "^3.4.
|
|
49
|
-
"@stylistic/eslint-plugin": "^
|
|
50
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
51
|
-
"@typescript-eslint/parser": "^8.
|
|
52
|
-
"@vitest/eslint-plugin": "^1.
|
|
47
|
+
"@eslint/markdown": "^7.5.1",
|
|
48
|
+
"@prettier/plugin-xml": "^3.4.2",
|
|
49
|
+
"@stylistic/eslint-plugin": "^5.6.1",
|
|
50
|
+
"@typescript-eslint/eslint-plugin": "^8.51.0",
|
|
51
|
+
"@typescript-eslint/parser": "^8.51.0",
|
|
52
|
+
"@vitest/eslint-plugin": "^1.6.4",
|
|
53
53
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
54
|
-
"eslint-flat-config-utils": "^2.
|
|
54
|
+
"eslint-flat-config-utils": "^2.1.4",
|
|
55
55
|
"eslint-merge-processors": "^2.0.0",
|
|
56
56
|
"eslint-plugin-antfu": "^3.1.1",
|
|
57
|
-
"eslint-plugin-command": "^3.
|
|
58
|
-
"eslint-plugin-format": "^1.0
|
|
59
|
-
"eslint-plugin-import-x": "^4.
|
|
60
|
-
"eslint-plugin-jsdoc": "^
|
|
61
|
-
"eslint-plugin-jsonc": "^2.
|
|
62
|
-
"eslint-plugin-n": "^17.
|
|
57
|
+
"eslint-plugin-command": "^3.4.0",
|
|
58
|
+
"eslint-plugin-format": "^1.1.0",
|
|
59
|
+
"eslint-plugin-import-x": "^4.16.1",
|
|
60
|
+
"eslint-plugin-jsdoc": "^61.5.0",
|
|
61
|
+
"eslint-plugin-jsonc": "^2.21.0",
|
|
62
|
+
"eslint-plugin-n": "^17.23.1",
|
|
63
63
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
64
|
-
"eslint-plugin-perfectionist": "^
|
|
65
|
-
"eslint-plugin-pnpm": "^
|
|
66
|
-
"eslint-plugin-regexp": "^2.
|
|
64
|
+
"eslint-plugin-perfectionist": "^5.1.0",
|
|
65
|
+
"eslint-plugin-pnpm": "^1.4.3",
|
|
66
|
+
"eslint-plugin-regexp": "^2.10.0",
|
|
67
67
|
"eslint-plugin-toml": "^0.12.0",
|
|
68
|
-
"eslint-plugin-unicorn": "^
|
|
69
|
-
"eslint-plugin-unused-imports": "^4.
|
|
70
|
-
"eslint-plugin-vue": "^10.
|
|
68
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
69
|
+
"eslint-plugin-unused-imports": "^4.3.0",
|
|
70
|
+
"eslint-plugin-vue": "^10.6.2",
|
|
71
71
|
"eslint-plugin-vuejs-accessibility": "^2.4.1",
|
|
72
|
-
"eslint-plugin-yml": "^1.
|
|
73
|
-
"globals": "^16.
|
|
74
|
-
"jsonc-eslint-parser": "^2.4.
|
|
75
|
-
"local-pkg": "^1.1.
|
|
76
|
-
"pnpm-workspace-yaml": "^
|
|
77
|
-
"prettier": "^3.
|
|
78
|
-
"toml-eslint-parser": "^0.10.
|
|
79
|
-
"vue-eslint-parser": "^10.
|
|
80
|
-
"yaml-eslint-parser": "^1.3.
|
|
72
|
+
"eslint-plugin-yml": "^1.19.1",
|
|
73
|
+
"globals": "^16.5.0",
|
|
74
|
+
"jsonc-eslint-parser": "^2.4.2",
|
|
75
|
+
"local-pkg": "^1.1.2",
|
|
76
|
+
"pnpm-workspace-yaml": "^1.4.3",
|
|
77
|
+
"prettier": "^3.7.4",
|
|
78
|
+
"toml-eslint-parser": "^0.10.1",
|
|
79
|
+
"vue-eslint-parser": "^10.2.0",
|
|
80
|
+
"yaml-eslint-parser": "^1.3.2"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@antfu/ni": "^
|
|
84
|
-
"@eslint/config-inspector": "^1.
|
|
85
|
-
"@types/node": "^22.
|
|
86
|
-
"bumpp": "^10.
|
|
87
|
-
"eslint": "^9.
|
|
88
|
-
"eslint-typegen": "^2.
|
|
89
|
-
"jiti": "^2.
|
|
90
|
-
"lint-staged": "^16.
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
83
|
+
"@antfu/ni": "^28.0.0",
|
|
84
|
+
"@eslint/config-inspector": "^1.4.2",
|
|
85
|
+
"@types/node": "^22.19.3",
|
|
86
|
+
"bumpp": "^10.3.2",
|
|
87
|
+
"eslint": "^9.39.2",
|
|
88
|
+
"eslint-typegen": "^2.3.0",
|
|
89
|
+
"jiti": "^2.6.1",
|
|
90
|
+
"lint-staged": "^16.2.7",
|
|
91
|
+
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
92
|
+
"simple-git-hooks": "^2.13.1",
|
|
93
|
+
"tinyglobby": "^0.2.15",
|
|
94
|
+
"tsdown": "^0.18.3",
|
|
95
|
+
"tsx": "^4.21.0",
|
|
96
|
+
"typescript": "^5.9.3",
|
|
97
|
+
"vue": "^3.5.26"
|
|
97
98
|
},
|
|
98
99
|
"simple-git-hooks": {
|
|
99
100
|
"pre-commit": "pnpm lint-staged"
|