@cany748/eslint-config 5.0.0 → 7.0.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.d.mts +3448 -1251
- package/dist/index.mjs +179 -92
- package/package.json +32 -30
package/dist/index.mjs
CHANGED
|
@@ -10,18 +10,6 @@ import { configs } from "eslint-plugin-regexp";
|
|
|
10
10
|
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
11
11
|
import { isPackageExists } from "local-pkg";
|
|
12
12
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
13
|
-
//#region src/configs/comments.ts
|
|
14
|
-
function comments() {
|
|
15
|
-
return [{
|
|
16
|
-
name: "@eslint-community/eslint-comments",
|
|
17
|
-
plugins: { "@eslint-community/eslint-comments": pluginComments },
|
|
18
|
-
rules: {
|
|
19
|
-
...pluginComments.configs.recommended.rules,
|
|
20
|
-
"@eslint-community/eslint-comments/disable-enable-pair": "off"
|
|
21
|
-
}
|
|
22
|
-
}];
|
|
23
|
-
}
|
|
24
|
-
//#endregion
|
|
25
13
|
//#region src/globs.ts
|
|
26
14
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
27
15
|
const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -39,14 +27,10 @@ const GLOB_JSON5 = "**/*.json5";
|
|
|
39
27
|
const GLOB_JSONC = "**/*.jsonc";
|
|
40
28
|
const GLOB_MARKDOWN = "**/*.md";
|
|
41
29
|
const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
42
|
-
const GLOB_SVELTE = "**/*.svelte";
|
|
43
30
|
const GLOB_VUE = "**/*.vue";
|
|
44
31
|
const GLOB_YAML = "**/*.y?(a)ml";
|
|
45
|
-
const GLOB_TOML = "**/*.toml";
|
|
46
32
|
const GLOB_XML = "**/*.xml";
|
|
47
33
|
const GLOB_HTML = "**/*.htm?(l)";
|
|
48
|
-
const GLOB_ASTRO = "**/*.astro";
|
|
49
|
-
const GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
50
34
|
const GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
51
35
|
const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
52
36
|
const GLOB_TESTS = [
|
|
@@ -62,7 +46,6 @@ const GLOB_ALL_SRC = [
|
|
|
62
46
|
GLOB_JSON,
|
|
63
47
|
GLOB_JSON5,
|
|
64
48
|
GLOB_MARKDOWN,
|
|
65
|
-
GLOB_SVELTE,
|
|
66
49
|
GLOB_VUE,
|
|
67
50
|
GLOB_YAML,
|
|
68
51
|
GLOB_XML,
|
|
@@ -98,15 +81,145 @@ const GLOB_EXCLUDE = [
|
|
|
98
81
|
"**/.output",
|
|
99
82
|
"**/.vite-inspect",
|
|
100
83
|
"**/.yarn",
|
|
101
|
-
"**/vite.config.*.timestamp-*",
|
|
102
84
|
"**/CHANGELOG*.md",
|
|
103
|
-
"**/*.min.*",
|
|
104
85
|
"**/LICENSE*",
|
|
86
|
+
"**/*.min.*",
|
|
105
87
|
"**/__snapshots__",
|
|
88
|
+
"**/vite.config.*.timestamp-*",
|
|
106
89
|
"**/auto-import?(s).d.ts",
|
|
107
|
-
"**/components.d.ts"
|
|
90
|
+
"**/components.d.ts",
|
|
91
|
+
"**/.context",
|
|
92
|
+
"**/.claude",
|
|
93
|
+
"**/.agents",
|
|
94
|
+
"**/.*/skills"
|
|
108
95
|
];
|
|
109
96
|
//#endregion
|
|
97
|
+
//#region src/utils.ts
|
|
98
|
+
const parserPlain = {
|
|
99
|
+
meta: { name: "parser-plain" },
|
|
100
|
+
parseForESLint: (code) => ({
|
|
101
|
+
ast: {
|
|
102
|
+
body: [],
|
|
103
|
+
comments: [],
|
|
104
|
+
loc: {
|
|
105
|
+
end: code.length,
|
|
106
|
+
start: 0
|
|
107
|
+
},
|
|
108
|
+
range: [0, code.length],
|
|
109
|
+
tokens: [],
|
|
110
|
+
type: "Program"
|
|
111
|
+
},
|
|
112
|
+
scopeManager: null,
|
|
113
|
+
services: { isPlain: true },
|
|
114
|
+
visitorKeys: { Program: [] }
|
|
115
|
+
})
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
Combine array and non-array configs into a single array.
|
|
119
|
+
*/
|
|
120
|
+
async function combine(...configs) {
|
|
121
|
+
return (await Promise.all(configs)).flat();
|
|
122
|
+
}
|
|
123
|
+
function toArray(value) {
|
|
124
|
+
return Array.isArray(value) ? value : [value];
|
|
125
|
+
}
|
|
126
|
+
async function interopDefault(m) {
|
|
127
|
+
const resolved = await m;
|
|
128
|
+
return resolved.default || resolved;
|
|
129
|
+
}
|
|
130
|
+
function isInGitHooksOrLintStaged() {
|
|
131
|
+
return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
|
132
|
+
}
|
|
133
|
+
function isInEditorEnv() {
|
|
134
|
+
if (process.env.CI || isInGitHooksOrLintStaged()) return false;
|
|
135
|
+
return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM || process.env.ZED_ENVIRONMENT && !process.env.ZED_TERM);
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/configs/antislop.ts
|
|
139
|
+
async function antislop(options = {}) {
|
|
140
|
+
const { overrides = {}, slop = true, sonarjs = true } = options;
|
|
141
|
+
const [pluginSlop, pluginSonarjs] = await Promise.all([slop ? interopDefault(import("eslint-plugin-slop")) : void 0, sonarjs ? interopDefault(import("eslint-plugin-sonarjs")) : void 0]);
|
|
142
|
+
return [
|
|
143
|
+
{
|
|
144
|
+
name: "antislop/setup",
|
|
145
|
+
plugins: {
|
|
146
|
+
...slop && { slop: pluginSlop },
|
|
147
|
+
...sonarjs && { sonarjs: pluginSonarjs }
|
|
148
|
+
},
|
|
149
|
+
...typeof slop === "object" && { settings: { slop } }
|
|
150
|
+
},
|
|
151
|
+
...slop ? [{
|
|
152
|
+
files: [
|
|
153
|
+
GLOB_SRC,
|
|
154
|
+
GLOB_STYLE,
|
|
155
|
+
GLOB_JSON,
|
|
156
|
+
GLOB_JSON5,
|
|
157
|
+
GLOB_JSONC,
|
|
158
|
+
GLOB_MARKDOWN,
|
|
159
|
+
GLOB_VUE,
|
|
160
|
+
GLOB_HTML,
|
|
161
|
+
GLOB_GRAPHQL
|
|
162
|
+
],
|
|
163
|
+
/**
|
|
164
|
+
Markdown code fences are already scanned as part of the raw
|
|
165
|
+
Markdown text, so exclude the virtual embedded-code files to
|
|
166
|
+
avoid reporting the same em dash twice
|
|
167
|
+
*/
|
|
168
|
+
ignores: [GLOB_MARKDOWN_CODE],
|
|
169
|
+
name: "antislop/rules/universal",
|
|
170
|
+
rules: { "slop/no-em-dash": "error" }
|
|
171
|
+
}] : [],
|
|
172
|
+
{
|
|
173
|
+
files: [GLOB_SRC],
|
|
174
|
+
name: "antislop/rules/javascript",
|
|
175
|
+
rules: {
|
|
176
|
+
...slop && {
|
|
177
|
+
"slop/max-comment-length": "error",
|
|
178
|
+
"slop/no-chained-type-assertions": "error",
|
|
179
|
+
"slop/no-jargon": "error",
|
|
180
|
+
"slop/no-trivial-functions": "error",
|
|
181
|
+
"slop/no-trivial-type-aliases": "error",
|
|
182
|
+
"slop/prefer-jsdoc": "error"
|
|
183
|
+
},
|
|
184
|
+
...sonarjs && {
|
|
185
|
+
"sonarjs/cognitive-complexity": ["error", 15],
|
|
186
|
+
"sonarjs/no-all-duplicated-branches": "error",
|
|
187
|
+
"sonarjs/no-collapsible-if": "error",
|
|
188
|
+
"sonarjs/no-commented-code": "error",
|
|
189
|
+
"sonarjs/no-dead-store": "error",
|
|
190
|
+
"sonarjs/no-duplicated-branches": "error",
|
|
191
|
+
"sonarjs/no-element-overwrite": "error",
|
|
192
|
+
"sonarjs/no-empty-collection": "error",
|
|
193
|
+
"sonarjs/no-gratuitous-expressions": "error",
|
|
194
|
+
"sonarjs/no-identical-conditions": "error",
|
|
195
|
+
"sonarjs/no-identical-expressions": "error",
|
|
196
|
+
"sonarjs/no-identical-functions": "error",
|
|
197
|
+
"sonarjs/no-invariant-returns": "error",
|
|
198
|
+
"sonarjs/no-inverted-boolean-check": "error",
|
|
199
|
+
"sonarjs/no-redundant-boolean": "error",
|
|
200
|
+
"sonarjs/no-redundant-jump": "error",
|
|
201
|
+
"sonarjs/no-unused-collection": "error",
|
|
202
|
+
"sonarjs/no-use-of-empty-return-value": "error",
|
|
203
|
+
"sonarjs/prefer-single-boolean-return": "error"
|
|
204
|
+
},
|
|
205
|
+
...overrides
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
];
|
|
209
|
+
}
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/configs/comments.ts
|
|
212
|
+
function comments() {
|
|
213
|
+
return [{
|
|
214
|
+
name: "@eslint-community/eslint-comments",
|
|
215
|
+
plugins: { "@eslint-community/eslint-comments": pluginComments },
|
|
216
|
+
rules: {
|
|
217
|
+
...pluginComments.configs.recommended.rules,
|
|
218
|
+
"@eslint-community/eslint-comments/disable-enable-pair": "off"
|
|
219
|
+
}
|
|
220
|
+
}];
|
|
221
|
+
}
|
|
222
|
+
//#endregion
|
|
110
223
|
//#region src/configs/disables.ts
|
|
111
224
|
function disables() {
|
|
112
225
|
return [
|
|
@@ -165,53 +278,12 @@ function e18e(options = {}) {
|
|
|
165
278
|
...modernization ? { ...configs.modernization.rules } : {},
|
|
166
279
|
...moduleReplacements ? { ...configs.moduleReplacements.rules } : {},
|
|
167
280
|
...performanceImprovements ? { ...configs.performanceImprovements.rules } : {},
|
|
281
|
+
...type === "lib" ? {} : { "e18e/prefer-static-regex": "off" },
|
|
168
282
|
...overrides
|
|
169
283
|
}
|
|
170
284
|
}];
|
|
171
285
|
}
|
|
172
286
|
//#endregion
|
|
173
|
-
//#region src/utils.ts
|
|
174
|
-
const parserPlain = {
|
|
175
|
-
meta: { name: "parser-plain" },
|
|
176
|
-
parseForESLint: (code) => ({
|
|
177
|
-
ast: {
|
|
178
|
-
body: [],
|
|
179
|
-
comments: [],
|
|
180
|
-
loc: {
|
|
181
|
-
end: code.length,
|
|
182
|
-
start: 0
|
|
183
|
-
},
|
|
184
|
-
range: [0, code.length],
|
|
185
|
-
tokens: [],
|
|
186
|
-
type: "Program"
|
|
187
|
-
},
|
|
188
|
-
scopeManager: null,
|
|
189
|
-
services: { isPlain: true },
|
|
190
|
-
visitorKeys: { Program: [] }
|
|
191
|
-
})
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* Combine array and non-array configs into a single array.
|
|
195
|
-
*/
|
|
196
|
-
async function combine(...configs) {
|
|
197
|
-
return (await Promise.all(configs)).flat();
|
|
198
|
-
}
|
|
199
|
-
function toArray(value) {
|
|
200
|
-
return Array.isArray(value) ? value : [value];
|
|
201
|
-
}
|
|
202
|
-
async function interopDefault(m) {
|
|
203
|
-
const resolved = await m;
|
|
204
|
-
return resolved.default || resolved;
|
|
205
|
-
}
|
|
206
|
-
function isInGitHooksOrLintStaged() {
|
|
207
|
-
return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
|
208
|
-
}
|
|
209
|
-
function isInEditorEnv() {
|
|
210
|
-
if (process.env.CI) return false;
|
|
211
|
-
if (isInGitHooksOrLintStaged()) return false;
|
|
212
|
-
return !!(process.env.VSCODE_PID || process.env.VSCODE_CWD || process.env.JETBRAINS_IDE || process.env.VIM || process.env.NVIM);
|
|
213
|
-
}
|
|
214
|
-
//#endregion
|
|
215
287
|
//#region src/configs/formatters.ts
|
|
216
288
|
function formatters(options = true) {
|
|
217
289
|
if (options === true) options = {
|
|
@@ -229,35 +301,35 @@ function formatters(options = true) {
|
|
|
229
301
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
230
302
|
languageOptions: { parser: parserPlain },
|
|
231
303
|
name: "formatter/css",
|
|
232
|
-
rules: { "prettier/prettier": ["
|
|
304
|
+
rules: { "prettier/prettier": ["warn", { parser: "css" }] }
|
|
233
305
|
}, {
|
|
234
306
|
files: [GLOB_SCSS],
|
|
235
307
|
languageOptions: { parser: parserPlain },
|
|
236
308
|
name: "formatter/scss",
|
|
237
|
-
rules: { "prettier/prettier": ["
|
|
309
|
+
rules: { "prettier/prettier": ["warn", { parser: "scss" }] }
|
|
238
310
|
}, {
|
|
239
311
|
files: [GLOB_LESS],
|
|
240
312
|
languageOptions: { parser: parserPlain },
|
|
241
313
|
name: "formatter/less",
|
|
242
|
-
rules: { "prettier/prettier": ["
|
|
314
|
+
rules: { "prettier/prettier": ["warn", { parser: "less" }] }
|
|
243
315
|
});
|
|
244
316
|
if (options.graphql) configs.push({
|
|
245
317
|
files: [GLOB_GRAPHQL],
|
|
246
318
|
languageOptions: { parser: parserPlain },
|
|
247
319
|
name: "formatter/graphql",
|
|
248
|
-
rules: { "prettier/prettier": ["
|
|
320
|
+
rules: { "prettier/prettier": ["warn", { parser: "graphql" }] }
|
|
249
321
|
});
|
|
250
322
|
if (options.html) configs.push({
|
|
251
323
|
files: [GLOB_HTML],
|
|
252
324
|
languageOptions: { parser: parserPlain },
|
|
253
325
|
name: "formatter/html",
|
|
254
|
-
rules: { "prettier/prettier": ["
|
|
326
|
+
rules: { "prettier/prettier": ["warn", { parser: "html" }] }
|
|
255
327
|
});
|
|
256
328
|
if (options.markdown) configs.push({
|
|
257
329
|
files: [GLOB_MARKDOWN],
|
|
258
330
|
languageOptions: { parser: parserPlain },
|
|
259
331
|
name: "formatter/markdown",
|
|
260
|
-
rules: { "prettier/prettier": ["
|
|
332
|
+
rules: { "prettier/prettier": ["warn", { parser: "markdown" }] }
|
|
261
333
|
});
|
|
262
334
|
return configs;
|
|
263
335
|
}
|
|
@@ -625,9 +697,9 @@ function regexp(options = {}) {
|
|
|
625
697
|
//#endregion
|
|
626
698
|
//#region src/configs/sort.ts
|
|
627
699
|
/**
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
700
|
+
Sort package.json
|
|
701
|
+
|
|
702
|
+
Requires `jsonc` config
|
|
631
703
|
*/
|
|
632
704
|
function sortPackageJson() {
|
|
633
705
|
return [{
|
|
@@ -675,6 +747,7 @@ function sortPackageJson() {
|
|
|
675
747
|
"activationEvents",
|
|
676
748
|
"contributes",
|
|
677
749
|
"scripts",
|
|
750
|
+
"scripts-info",
|
|
678
751
|
"peerDependencies",
|
|
679
752
|
"peerDependenciesMeta",
|
|
680
753
|
"dependencies",
|
|
@@ -737,9 +810,9 @@ function sortPackageJson() {
|
|
|
737
810
|
}];
|
|
738
811
|
}
|
|
739
812
|
/**
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
813
|
+
Sort tsconfig.json
|
|
814
|
+
|
|
815
|
+
Requires `jsonc` config
|
|
743
816
|
*/
|
|
744
817
|
function sortTsconfig() {
|
|
745
818
|
return [{
|
|
@@ -863,7 +936,7 @@ let _pluginTest;
|
|
|
863
936
|
async function test(options = {}) {
|
|
864
937
|
const { files = GLOB_TESTS, isInEditor = false, overrides = {} } = options;
|
|
865
938
|
const [pluginVitest, pluginNoOnlyTests] = await Promise.all([interopDefault(import("@vitest/eslint-plugin")), interopDefault(import("eslint-plugin-no-only-tests"))]);
|
|
866
|
-
_pluginTest
|
|
939
|
+
_pluginTest ||= {
|
|
867
940
|
...pluginVitest,
|
|
868
941
|
rules: {
|
|
869
942
|
...pluginVitest.rules,
|
|
@@ -901,7 +974,7 @@ async function typescript(options = {}) {
|
|
|
901
974
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
902
975
|
];
|
|
903
976
|
const filesTypeAware = options.filesTypeAware ?? ["**/*.?([cm])ts", "**/*.?([cm])tsx"];
|
|
904
|
-
const ignoresTypeAware = options.ignoresTypeAware ?? [`**/*.md
|
|
977
|
+
const ignoresTypeAware = options.ignoresTypeAware ?? [`**/*.md/**`];
|
|
905
978
|
const tsconfigPath = options?.tsconfigPath;
|
|
906
979
|
const isTypeAware = !!tsconfigPath;
|
|
907
980
|
const [pluginTs, parserTs] = await Promise.all([interopDefault(import("@typescript-eslint/eslint-plugin")), interopDefault(import("@typescript-eslint/parser"))]);
|
|
@@ -1005,18 +1078,26 @@ function unicorn() {
|
|
|
1005
1078
|
return [{
|
|
1006
1079
|
name: "unicorn",
|
|
1007
1080
|
plugins: { unicorn: pluginUnicorn },
|
|
1081
|
+
files: [GLOB_SRC, GLOB_VUE],
|
|
1008
1082
|
rules: {
|
|
1009
1083
|
...pluginUnicorn.configs.recommended.rules,
|
|
1084
|
+
"unicorn/consistent-boolean-name": "off",
|
|
1085
|
+
"unicorn/consistent-conditional-object-spread": "off",
|
|
1010
1086
|
"unicorn/consistent-function-scoping": "off",
|
|
1011
1087
|
"unicorn/filename-case": "off",
|
|
1012
1088
|
"unicorn/import-style": "off",
|
|
1089
|
+
"unicorn/name-replacements": "off",
|
|
1013
1090
|
"unicorn/no-array-callback-reference": "off",
|
|
1091
|
+
"unicorn/no-computed-property-existence-check": "off",
|
|
1014
1092
|
"unicorn/no-null": "off",
|
|
1093
|
+
"unicorn/no-top-level-assignment-in-function": "off",
|
|
1094
|
+
"unicorn/no-top-level-side-effects": "off",
|
|
1095
|
+
"unicorn/prefer-await": "off",
|
|
1096
|
+
"unicorn/prefer-global-this": "off",
|
|
1015
1097
|
"unicorn/prefer-string-replace-all": "off",
|
|
1016
1098
|
"unicorn/prefer-structured-clone": "off",
|
|
1017
1099
|
"unicorn/prefer-top-level-await": "off",
|
|
1018
|
-
"unicorn/prevent-abbreviations": "off"
|
|
1019
|
-
"unicorn/prefer-global-this": "off"
|
|
1100
|
+
"unicorn/prevent-abbreviations": "off"
|
|
1020
1101
|
}
|
|
1021
1102
|
}];
|
|
1022
1103
|
}
|
|
@@ -1141,25 +1222,27 @@ const VuePackages = [
|
|
|
1141
1222
|
"@slidev/cli"
|
|
1142
1223
|
];
|
|
1143
1224
|
/**
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1225
|
+
Construct an array of ESLint flat config items.
|
|
1226
|
+
|
|
1227
|
+
@param {OptionsConfig & TypedFlatConfigItem} options
|
|
1228
|
+
The options for generating the ESLint configurations.
|
|
1229
|
+
@param {Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[]>[]} userConfigs
|
|
1230
|
+
The user configurations to be merged with the generated configurations.
|
|
1231
|
+
@returns {Promise<TypedFlatConfigItem[]>}
|
|
1232
|
+
The merged ESLint configurations.
|
|
1152
1233
|
*/
|
|
1153
1234
|
const factoryConfig = function(options = {}, ...userConfigs) {
|
|
1154
|
-
const { componentExts = [], formatters: enableFormatters = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsonc: enableJSONC = true, node: enableNode = true, e18e: enableE18e = true, regexp: enableRegexp = true, test: enableTest = true, typescript: enableTypeScript = isPackageExists("typescript"), unocss: enableUnoCSS = isPackageExists("unocss"), vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
1235
|
+
const { antislop: enableAntislop = false, componentExts = [], formatters: enableFormatters = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsonc: enableJSONC = true, node: enableNode = true, e18e: enableE18e = true, regexp: enableRegexp = true, test: enableTest = true, typescript: enableTypeScript = isPackageExists("typescript"), unocss: enableUnoCSS = isPackageExists("unocss"), vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
1155
1236
|
let isInEditor = options.isInEditor;
|
|
1156
1237
|
if (isInEditor == null) {
|
|
1157
1238
|
isInEditor = isInEditorEnv();
|
|
1158
1239
|
if (isInEditor) console.log("[@cany748/eslint-config] Detected running in editor, some rules are disabled.");
|
|
1159
1240
|
}
|
|
1160
1241
|
const configs = [];
|
|
1161
|
-
if (enableGitignore)
|
|
1162
|
-
|
|
1242
|
+
if (enableGitignore) {
|
|
1243
|
+
if (typeof enableGitignore === "boolean") configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({ strict: false })]));
|
|
1244
|
+
else configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
1245
|
+
}
|
|
1163
1246
|
configs.push(comments(), ignores(userIgnores), javascript({
|
|
1164
1247
|
isInEditor,
|
|
1165
1248
|
overrides: options.javascript?.overrides
|
|
@@ -1172,17 +1255,21 @@ const factoryConfig = function(options = {}, ...userConfigs) {
|
|
|
1172
1255
|
...enableE18e === true ? {} : enableE18e
|
|
1173
1256
|
}));
|
|
1174
1257
|
if (enableTypeScript) configs.push(typescript({
|
|
1175
|
-
...typeof enableTypeScript === "boolean" ? {} : enableTypeScript
|
|
1258
|
+
...typeof enableTypeScript === "boolean" ? {} : enableTypeScript,
|
|
1176
1259
|
componentExts,
|
|
1177
1260
|
type: options.type
|
|
1178
1261
|
}));
|
|
1262
|
+
if (enableAntislop) configs.push(antislop({
|
|
1263
|
+
...typeof enableAntislop === "boolean" ? {} : enableAntislop,
|
|
1264
|
+
typescript: !!enableTypeScript
|
|
1265
|
+
}));
|
|
1179
1266
|
if (enableRegexp) configs.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
|
|
1180
1267
|
if (enableTest) configs.push(test({
|
|
1181
1268
|
isInEditor,
|
|
1182
1269
|
overrides: typeof enableTest === "boolean" ? {} : enableTest?.overrides
|
|
1183
1270
|
}));
|
|
1184
1271
|
if (enableVue) configs.push(vue({
|
|
1185
|
-
...typeof enableVue === "boolean" ? {} : enableVue
|
|
1272
|
+
...typeof enableVue === "boolean" ? {} : enableVue,
|
|
1186
1273
|
typescript: !!enableTypeScript
|
|
1187
1274
|
}));
|
|
1188
1275
|
if (enableUnoCSS) configs.push(unocss());
|
|
@@ -1200,4 +1287,4 @@ const factoryConfig = function(options = {}, ...userConfigs) {
|
|
|
1200
1287
|
return composer;
|
|
1201
1288
|
};
|
|
1202
1289
|
//#endregion
|
|
1203
|
-
export { GLOB_ALL_SRC,
|
|
1290
|
+
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, antislop, combine, comments, disables, e18e, factoryConfig, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, javascript, jsonc, node, parserPlain, regexp, sortPackageJson, sortTsconfig, test, toArray, typescript, unicorn, unocss, vue };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cany748/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "7.0.0",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.mjs"
|
|
7
7
|
},
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@unocss/eslint-plugin": "^66.
|
|
16
|
-
"eslint-plugin-vue": "^10.
|
|
17
|
-
"typescript-eslint": "^8.
|
|
15
|
+
"@unocss/eslint-plugin": "^66.10.5",
|
|
16
|
+
"eslint-plugin-vue": "^10.11.1",
|
|
17
|
+
"typescript-eslint": "^8.71.1"
|
|
18
18
|
},
|
|
19
19
|
"peerDependenciesMeta": {
|
|
20
20
|
"@unocss/eslint-plugin": {
|
|
@@ -28,37 +28,39 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@e18e/eslint-plugin": "^0.
|
|
32
|
-
"@eslint-community/eslint-plugin-eslint-comments": "^4.
|
|
33
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
34
|
-
"eslint": "^10.
|
|
35
|
-
"eslint-config-flat-gitignore": "^2.
|
|
31
|
+
"@e18e/eslint-plugin": "^0.8.1",
|
|
32
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.8.1",
|
|
33
|
+
"@vitest/eslint-plugin": "^1.6.27",
|
|
34
|
+
"eslint": "^10.12.0",
|
|
35
|
+
"eslint-config-flat-gitignore": "^2.4.0",
|
|
36
36
|
"eslint-config-prettier": "^10.1.8",
|
|
37
|
-
"eslint-flat-config-utils": "^3.
|
|
38
|
-
"eslint-plugin-import-x": "^4.
|
|
39
|
-
"eslint-plugin-jsonc": "^3.
|
|
40
|
-
"eslint-plugin-n": "^
|
|
41
|
-
"eslint-plugin-no-only-tests": "^3.
|
|
42
|
-
"eslint-plugin-prettier": "^5.5.
|
|
43
|
-
"eslint-plugin-regexp": "^3.1
|
|
44
|
-
"eslint-plugin-
|
|
37
|
+
"eslint-flat-config-utils": "^3.2.0",
|
|
38
|
+
"eslint-plugin-import-x": "^4.17.1",
|
|
39
|
+
"eslint-plugin-jsonc": "^3.4.2",
|
|
40
|
+
"eslint-plugin-n": "^18.4.1",
|
|
41
|
+
"eslint-plugin-no-only-tests": "^3.4.0",
|
|
42
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
43
|
+
"eslint-plugin-regexp": "^3.3.1",
|
|
44
|
+
"eslint-plugin-slop": "^0.1.3",
|
|
45
|
+
"eslint-plugin-sonarjs": "^4.2.2",
|
|
46
|
+
"eslint-plugin-unicorn": "^77.0.0",
|
|
45
47
|
"eslint-plugin-unused-imports": "^4.4.1",
|
|
46
|
-
"globals": "^17.
|
|
47
|
-
"jiti": "^2.
|
|
48
|
-
"local-pkg": "^1.1
|
|
49
|
-
"prettier": "^3.
|
|
48
|
+
"globals": "^17.13.0",
|
|
49
|
+
"jiti": "^2.7.0",
|
|
50
|
+
"local-pkg": "^1.2.1",
|
|
51
|
+
"prettier": "^3.9.9"
|
|
50
52
|
},
|
|
51
53
|
"devDependencies": {
|
|
52
|
-
"@types/node": "^
|
|
53
|
-
"@unocss/eslint-plugin": "^66.
|
|
54
|
-
"bumpp": "^
|
|
55
|
-
"eslint-plugin-vue": "^10.
|
|
54
|
+
"@types/node": "^26.6.4",
|
|
55
|
+
"@unocss/eslint-plugin": "^66.10.5",
|
|
56
|
+
"bumpp": "^12.3.0",
|
|
57
|
+
"eslint-plugin-vue": "^10.11.1",
|
|
56
58
|
"eslint-typegen": "^2.3.1",
|
|
57
|
-
"lint-staged": "^
|
|
58
|
-
"simple-git-hooks": "^2.
|
|
59
|
-
"tsdown": "^0.
|
|
60
|
-
"typescript": "^6.0.
|
|
61
|
-
"typescript-eslint": "^8.
|
|
59
|
+
"lint-staged": "^17.6.0",
|
|
60
|
+
"simple-git-hooks": "^2.14.0",
|
|
61
|
+
"tsdown": "^0.23.0",
|
|
62
|
+
"typescript": "^6.0.3",
|
|
63
|
+
"typescript-eslint": "^8.71.1"
|
|
62
64
|
},
|
|
63
65
|
"simple-git-hooks": {
|
|
64
66
|
"pre-commit": "pnpm lint-staged"
|