@kazupon/eslint-config 0.10.1 → 0.12.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/README.md +16 -4
- package/dist/config.d.cts +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/configs/comments.d.cts +2 -2
- package/dist/configs/comments.d.ts +2 -2
- package/dist/configs/index.d.cts +1 -0
- package/dist/configs/index.d.ts +1 -0
- package/dist/configs/javascript.d.cts +2 -2
- package/dist/configs/javascript.d.ts +2 -2
- package/dist/configs/jsdoc.d.cts +2 -2
- package/dist/configs/jsdoc.d.ts +2 -2
- package/dist/configs/jsonc.d.cts +2 -2
- package/dist/configs/jsonc.d.ts +2 -2
- package/dist/configs/prettier.d.cts +2 -2
- package/dist/configs/prettier.d.ts +2 -2
- package/dist/configs/promise.d.cts +2 -2
- package/dist/configs/promise.d.ts +2 -2
- package/dist/configs/regexp.d.cts +2 -2
- package/dist/configs/regexp.d.ts +2 -2
- package/dist/configs/svelte.d.cts +21 -0
- package/dist/configs/svelte.d.ts +21 -0
- package/dist/configs/toml.d.cts +2 -2
- package/dist/configs/toml.d.ts +2 -2
- package/dist/configs/typescript.d.cts +1 -1
- package/dist/configs/typescript.d.ts +1 -1
- package/dist/configs/unicorn.d.cts +2 -2
- package/dist/configs/unicorn.d.ts +2 -2
- package/dist/configs/vue.d.cts +2 -2
- package/dist/configs/vue.d.ts +2 -2
- package/dist/configs/yml.d.cts +2 -2
- package/dist/configs/yml.d.ts +2 -2
- package/dist/globs.d.cts +1 -0
- package/dist/globs.d.ts +1 -0
- package/dist/index.cjs +227 -121
- package/dist/index.js +136 -104
- package/dist/types/gens/eslint.d.cts +2 -1
- package/dist/types/gens/eslint.d.ts +2 -1
- package/dist/types/gens/javascript.d.cts +5 -9
- package/dist/types/gens/javascript.d.ts +5 -9
- package/dist/types/gens/promise.d.cts +10 -4
- package/dist/types/gens/promise.d.ts +10 -4
- package/dist/types/gens/svelte.d.cts +491 -0
- package/dist/types/gens/svelte.d.ts +491 -0
- package/dist/types/gens/typescript.d.cts +62 -737
- package/dist/types/gens/typescript.d.ts +62 -737
- package/dist/types/index.d.cts +2 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/overrides.d.cts +2 -2
- package/dist/types/overrides.d.ts +2 -2
- package/package.json +17 -7
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ function defineConfig(...configs) {
|
|
|
11
11
|
//#region src/utils.ts
|
|
12
12
|
async function interopDefault(mod) {
|
|
13
13
|
const resolved = await mod;
|
|
14
|
-
return
|
|
14
|
+
return resolved.default || resolved;
|
|
15
15
|
}
|
|
16
16
|
async function loadPlugin(name) {
|
|
17
17
|
const mod = await import(name).catch((error) => {
|
|
@@ -25,31 +25,31 @@ async function loadPlugin(name) {
|
|
|
25
25
|
//#region src/configs/javascript.ts
|
|
26
26
|
async function javascript(options = {}) {
|
|
27
27
|
const { rules: overrideRules = {} } = options;
|
|
28
|
-
const js = await loadPlugin(
|
|
28
|
+
const js = await loadPlugin("@eslint/js");
|
|
29
29
|
return [{
|
|
30
|
-
name:
|
|
31
|
-
...
|
|
30
|
+
name: "eslint/defaults/rules",
|
|
31
|
+
...js.configs.recommended
|
|
32
32
|
}, {
|
|
33
|
-
name:
|
|
33
|
+
name: "@kazupon/javascript/@eslint/js",
|
|
34
34
|
languageOptions: {
|
|
35
35
|
ecmaVersion: 2022,
|
|
36
36
|
globals: {
|
|
37
37
|
...globals.browser,
|
|
38
38
|
...globals.node,
|
|
39
39
|
...globals.es2022,
|
|
40
|
-
document:
|
|
41
|
-
navigator:
|
|
42
|
-
window:
|
|
40
|
+
document: "readonly",
|
|
41
|
+
navigator: "readonly",
|
|
42
|
+
window: "readonly"
|
|
43
43
|
},
|
|
44
44
|
parserOptions: {
|
|
45
|
-
ecmaFeatures: {jsx: true},
|
|
45
|
+
ecmaFeatures: { jsx: true },
|
|
46
46
|
ecmaVersion: 2022,
|
|
47
|
-
sourceType:
|
|
47
|
+
sourceType: "module"
|
|
48
48
|
},
|
|
49
|
-
sourceType:
|
|
49
|
+
sourceType: "module"
|
|
50
50
|
},
|
|
51
|
-
linterOptions: {reportUnusedDisableDirectives: true},
|
|
52
|
-
rules: {...overrideRules}
|
|
51
|
+
linterOptions: { reportUnusedDisableDirectives: true },
|
|
52
|
+
rules: { ...overrideRules }
|
|
53
53
|
}];
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -57,58 +57,59 @@ async function javascript(options = {}) {
|
|
|
57
57
|
//#region src/configs/comments.ts
|
|
58
58
|
async function comments(options = {}) {
|
|
59
59
|
const { rules: overrideRules = {} } = options;
|
|
60
|
-
const comments$1 = await loadPlugin(
|
|
60
|
+
const comments$1 = await loadPlugin("@eslint-community/eslint-plugin-eslint-comments");
|
|
61
61
|
return [{
|
|
62
|
-
name:
|
|
63
|
-
plugins: {
|
|
64
|
-
rules: {...
|
|
62
|
+
name: "@eslint-community/eslint-comments/recommended",
|
|
63
|
+
plugins: { "@eslint-community/eslint-comments": comments$1 },
|
|
64
|
+
rules: { ...comments$1.configs.recommended.rules }
|
|
65
65
|
}, {
|
|
66
|
-
name:
|
|
67
|
-
rules: {...overrideRules}
|
|
66
|
+
name: "@kazupon/eslint-comments",
|
|
67
|
+
rules: { ...overrideRules }
|
|
68
68
|
}];
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
//#endregion
|
|
72
72
|
//#region src/globs.ts
|
|
73
|
-
const GLOB_JS =
|
|
74
|
-
const GLOB_JSX =
|
|
75
|
-
const GLOB_TS =
|
|
76
|
-
const GLOB_TSX =
|
|
77
|
-
const GLOB_JSON =
|
|
78
|
-
const GLOB_JSON5 =
|
|
79
|
-
const GLOB_JSONC =
|
|
80
|
-
const GLOB_YAML =
|
|
81
|
-
const GLOB_TOML =
|
|
82
|
-
const GLOB_VUE =
|
|
73
|
+
const GLOB_JS = "**/*.?([cm])js";
|
|
74
|
+
const GLOB_JSX = "**/*.?([cm])jsx";
|
|
75
|
+
const GLOB_TS = "**/*.?([cm])ts";
|
|
76
|
+
const GLOB_TSX = "**/*.?([cm])tsx";
|
|
77
|
+
const GLOB_JSON = "**/*.json";
|
|
78
|
+
const GLOB_JSON5 = "**/*.json5";
|
|
79
|
+
const GLOB_JSONC = "**/*.jsonc";
|
|
80
|
+
const GLOB_YAML = "**/*.y?(a)ml";
|
|
81
|
+
const GLOB_TOML = "**/*.toml";
|
|
82
|
+
const GLOB_VUE = "**/*.vue";
|
|
83
|
+
const GLOB_SVELTE = "**/*.svelte";
|
|
83
84
|
|
|
84
85
|
//#endregion
|
|
85
86
|
//#region src/configs/typescript.ts
|
|
86
87
|
async function typescript(options = {}) {
|
|
87
|
-
const { rules: overrideRules = {}, extraFileExtensions = [], parserOptions = {project: true} } = options;
|
|
88
|
-
const ts = await loadPlugin(
|
|
88
|
+
const { rules: overrideRules = {}, extraFileExtensions = [], parserOptions = { project: true } } = options;
|
|
89
|
+
const ts = await loadPlugin("typescript-eslint");
|
|
89
90
|
const files = options.files ?? [GLOB_TS, GLOB_TSX, ...extraFileExtensions.map((ext) => `**/*${ext}`)];
|
|
90
|
-
return [...
|
|
91
|
+
return [...ts.configs.recommendedTypeChecked, {
|
|
91
92
|
files: [GLOB_JS, GLOB_JSX, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_YAML, GLOB_TOML],
|
|
92
|
-
...
|
|
93
|
+
...ts.configs.disableTypeChecked
|
|
93
94
|
}, {
|
|
94
|
-
name:
|
|
95
|
+
name: "@kazupon/typescipt/typescript-eslint",
|
|
95
96
|
files,
|
|
96
97
|
languageOptions: {
|
|
97
98
|
parser: ts.parser,
|
|
98
99
|
parserOptions: {
|
|
99
100
|
extraFileExtensions: extraFileExtensions.map((ext) => `${ext}`),
|
|
100
|
-
sourceType:
|
|
101
|
+
sourceType: "module",
|
|
101
102
|
...parserOptions
|
|
102
103
|
}
|
|
103
104
|
},
|
|
104
105
|
rules: {
|
|
105
|
-
|
|
106
|
-
args:
|
|
107
|
-
argsIgnorePattern:
|
|
108
|
-
caughtErrors:
|
|
109
|
-
caughtErrorsIgnorePattern:
|
|
110
|
-
destructuredArrayIgnorePattern:
|
|
111
|
-
varsIgnorePattern:
|
|
106
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
|
107
|
+
args: "all",
|
|
108
|
+
argsIgnorePattern: "^_",
|
|
109
|
+
caughtErrors: "all",
|
|
110
|
+
caughtErrorsIgnorePattern: "^_",
|
|
111
|
+
destructuredArrayIgnorePattern: "^_",
|
|
112
|
+
varsIgnorePattern: "^_",
|
|
112
113
|
ignoreRestSiblings: true
|
|
113
114
|
}],
|
|
114
115
|
...overrideRules
|
|
@@ -120,12 +121,12 @@ async function typescript(options = {}) {
|
|
|
120
121
|
//#region src/configs/jsdoc.ts
|
|
121
122
|
async function jsdoc(options = {}) {
|
|
122
123
|
const { rules: overrideRules = {}, typescript: typescript$1, error = false } = options;
|
|
123
|
-
const jsdoc$1 = await loadPlugin(
|
|
124
|
+
const jsdoc$1 = await loadPlugin("eslint-plugin-jsdoc");
|
|
124
125
|
function resolvePreset() {
|
|
125
|
-
let preset =
|
|
126
|
-
if (typescript$1 ===
|
|
126
|
+
let preset = "recommended";
|
|
127
|
+
if (typescript$1 === "syntax") {
|
|
127
128
|
preset = `${preset}-typescript`;
|
|
128
|
-
} else if (typescript$1 ===
|
|
129
|
+
} else if (typescript$1 === "flavor") {
|
|
129
130
|
preset = `${preset}-typescript-flavor`;
|
|
130
131
|
}
|
|
131
132
|
if (error) {
|
|
@@ -134,8 +135,8 @@ async function jsdoc(options = {}) {
|
|
|
134
135
|
return preset;
|
|
135
136
|
}
|
|
136
137
|
return [jsdoc$1.configs[`flat/${resolvePreset()}`], {
|
|
137
|
-
name:
|
|
138
|
-
rules: {...overrideRules}
|
|
138
|
+
name: "@kazupon/jsdoc",
|
|
139
|
+
rules: { ...overrideRules }
|
|
139
140
|
}];
|
|
140
141
|
}
|
|
141
142
|
|
|
@@ -143,13 +144,13 @@ async function jsdoc(options = {}) {
|
|
|
143
144
|
//#region src/configs/promise.ts
|
|
144
145
|
async function promise(options = {}) {
|
|
145
146
|
const { rules: overrideRules = {} } = options;
|
|
146
|
-
const promise$1 = await loadPlugin(
|
|
147
|
+
const promise$1 = await loadPlugin("eslint-plugin-promise");
|
|
147
148
|
return [{
|
|
148
|
-
name:
|
|
149
|
-
...
|
|
149
|
+
name: "promise/flat/recommended",
|
|
150
|
+
...promise$1.configs["flat/recommended"]
|
|
150
151
|
}, {
|
|
151
|
-
name:
|
|
152
|
-
rules: {...overrideRules}
|
|
152
|
+
name: "@kazupon/promise",
|
|
153
|
+
rules: { ...overrideRules }
|
|
153
154
|
}];
|
|
154
155
|
}
|
|
155
156
|
|
|
@@ -157,13 +158,13 @@ async function promise(options = {}) {
|
|
|
157
158
|
//#region src/configs/regexp.ts
|
|
158
159
|
async function regexp(options = {}) {
|
|
159
160
|
const { rules: overrideRules = {} } = options;
|
|
160
|
-
const regexp$1 = await loadPlugin(
|
|
161
|
+
const regexp$1 = await loadPlugin("eslint-plugin-regexp");
|
|
161
162
|
return [{
|
|
162
|
-
name:
|
|
163
|
-
...
|
|
163
|
+
name: "regexp/flat/recommended",
|
|
164
|
+
...regexp$1.configs["flat/recommended"]
|
|
164
165
|
}, {
|
|
165
|
-
name:
|
|
166
|
-
rules: {...overrideRules}
|
|
166
|
+
name: "@kazupon/eslint-regexp",
|
|
167
|
+
rules: { ...overrideRules }
|
|
167
168
|
}];
|
|
168
169
|
}
|
|
169
170
|
|
|
@@ -171,18 +172,18 @@ async function regexp(options = {}) {
|
|
|
171
172
|
//#region src/configs/toml.ts
|
|
172
173
|
async function toml(options = {}) {
|
|
173
174
|
const { rules: overrideRules = {} } = options;
|
|
174
|
-
const toml$1 = await loadPlugin(
|
|
175
|
+
const toml$1 = await loadPlugin("eslint-plugin-toml");
|
|
175
176
|
const configs = [];
|
|
176
|
-
configs.push(...toml$1.configs[
|
|
177
|
+
configs.push(...toml$1.configs["flat/standard"].map((config, index) => {
|
|
177
178
|
return config.name ? config : {
|
|
178
179
|
name: `toml/flat/standard/${index}`,
|
|
179
180
|
...config
|
|
180
181
|
};
|
|
181
182
|
}));
|
|
182
183
|
const overriddenConfig = {
|
|
183
|
-
name:
|
|
184
|
+
name: "@kazupon/toml",
|
|
184
185
|
files: [GLOB_TOML],
|
|
185
|
-
rules: {...overrideRules}
|
|
186
|
+
rules: { ...overrideRules }
|
|
186
187
|
};
|
|
187
188
|
configs.push(overriddenConfig);
|
|
188
189
|
return configs;
|
|
@@ -192,10 +193,10 @@ async function toml(options = {}) {
|
|
|
192
193
|
//#region src/configs/unicorn.ts
|
|
193
194
|
async function unicorn(options = {}) {
|
|
194
195
|
const { rules: overrideRules = {} } = options;
|
|
195
|
-
const unicorn$1 = await loadPlugin(
|
|
196
|
-
return [unicorn$1.configs[
|
|
197
|
-
name:
|
|
198
|
-
rules: {...overrideRules}
|
|
196
|
+
const unicorn$1 = await loadPlugin("eslint-plugin-unicorn");
|
|
197
|
+
return [unicorn$1.configs["flat/recommended"], {
|
|
198
|
+
name: "@kazupon/unicorn",
|
|
199
|
+
rules: { ...overrideRules }
|
|
199
200
|
}];
|
|
200
201
|
}
|
|
201
202
|
|
|
@@ -203,10 +204,10 @@ async function unicorn(options = {}) {
|
|
|
203
204
|
//#region src/configs/prettier.ts
|
|
204
205
|
async function prettier(options = {}) {
|
|
205
206
|
const { rules: overrideRules = {} } = options;
|
|
206
|
-
const prettier$1 = await loadPlugin(
|
|
207
|
+
const prettier$1 = await loadPlugin("eslint-config-prettier");
|
|
207
208
|
return [prettier$1, {
|
|
208
|
-
name:
|
|
209
|
-
rules: {...overrideRules}
|
|
209
|
+
name: "@kazupon/prettier",
|
|
210
|
+
rules: { ...overrideRules }
|
|
210
211
|
}];
|
|
211
212
|
}
|
|
212
213
|
|
|
@@ -214,9 +215,9 @@ async function prettier(options = {}) {
|
|
|
214
215
|
//#region src/configs/jsonc.ts
|
|
215
216
|
async function jsonc(options = {}) {
|
|
216
217
|
const { rules: overrideRules = {} } = options;
|
|
217
|
-
const kinds = [options.json ?
|
|
218
|
+
const kinds = [options.json ? "json" : "", options.jsonc ? "jsonc" : "", options.json5 ? "json5" : ""];
|
|
218
219
|
const usePrettier = !!options.prettier;
|
|
219
|
-
const jsonc$1 = await loadPlugin(
|
|
220
|
+
const jsonc$1 = await loadPlugin("eslint-plugin-jsonc");
|
|
220
221
|
const configs = [];
|
|
221
222
|
for (const kind of kinds) {
|
|
222
223
|
if (kind) {
|
|
@@ -229,7 +230,7 @@ async function jsonc(options = {}) {
|
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
232
|
if (usePrettier) {
|
|
232
|
-
configs.push(...jsonc$1.configs[
|
|
233
|
+
configs.push(...jsonc$1.configs["flat/prettier"].map((config, index) => {
|
|
233
234
|
return config.name ? config : {
|
|
234
235
|
name: `jsonc/flat/prettier/${index}`,
|
|
235
236
|
...config
|
|
@@ -237,34 +238,34 @@ async function jsonc(options = {}) {
|
|
|
237
238
|
}));
|
|
238
239
|
}
|
|
239
240
|
const overriddenConfig = {
|
|
240
|
-
name:
|
|
241
|
+
name: "@kazupon/jsonc",
|
|
241
242
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
242
|
-
rules: {...overrideRules}
|
|
243
|
+
rules: { ...overrideRules }
|
|
243
244
|
};
|
|
244
245
|
configs.push(...jsoncSort(), overriddenConfig);
|
|
245
246
|
return configs;
|
|
246
247
|
}
|
|
247
248
|
function jsoncSort() {
|
|
248
249
|
return [{
|
|
249
|
-
name:
|
|
250
|
-
files: [
|
|
250
|
+
name: "@kazupon/jsonc/sort/package.json",
|
|
251
|
+
files: ["**/package.json"],
|
|
251
252
|
rules: {
|
|
252
|
-
|
|
253
|
-
order: {type:
|
|
254
|
-
pathPattern:
|
|
253
|
+
"jsonc/sort-array-values": ["error", {
|
|
254
|
+
order: { type: "asc" },
|
|
255
|
+
pathPattern: "^files$"
|
|
255
256
|
}],
|
|
256
|
-
|
|
257
|
-
order: [
|
|
258
|
-
pathPattern:
|
|
257
|
+
"jsonc/sort-keys": ["error", {
|
|
258
|
+
order: ["name", "description", "private", "version", "author", "contributors", "license", "funding", "bugs", "repository", "keywords", "homepage", "publishConfig", "packageManager", "engines", "os", "cpu", "type", "sideEffects", "bin", "files", "main", "module", "browser", "unpkg", "jsdelivr", "directories", "exports", "types", "typesVersions", "scripts", "dependencies", "peerDependencies", "peerDependenciesMeta", "optionalDependencies", "devDependencies", "pnpm", "overrides", "resolutions", "workspaces", "prettier", "buildOptions", "lint-staged"],
|
|
259
|
+
pathPattern: "^$"
|
|
259
260
|
}, {
|
|
260
|
-
order: {type:
|
|
261
|
-
pathPattern:
|
|
261
|
+
order: { type: "asc" },
|
|
262
|
+
pathPattern: "^scripts$"
|
|
262
263
|
}, {
|
|
263
|
-
order: {type:
|
|
264
|
-
pathPattern:
|
|
264
|
+
order: { type: "asc" },
|
|
265
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
|
|
265
266
|
}, {
|
|
266
|
-
order: {type:
|
|
267
|
-
pathPattern:
|
|
267
|
+
order: { type: "asc" },
|
|
268
|
+
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
268
269
|
}]
|
|
269
270
|
}
|
|
270
271
|
}];
|
|
@@ -275,16 +276,16 @@ function jsoncSort() {
|
|
|
275
276
|
async function yml(options = {}) {
|
|
276
277
|
const { rules: overrideRules = {} } = options;
|
|
277
278
|
const usePrettier = !!options.prettier;
|
|
278
|
-
const yml$1 = await loadPlugin(
|
|
279
|
+
const yml$1 = await loadPlugin("eslint-plugin-yml");
|
|
279
280
|
const configs = [];
|
|
280
|
-
configs.push(...yml$1.configs[
|
|
281
|
+
configs.push(...yml$1.configs["flat/standard"].map((config, index) => {
|
|
281
282
|
return config.name ? config : {
|
|
282
283
|
name: `yml/flat/standard/${index}`,
|
|
283
284
|
...config
|
|
284
285
|
};
|
|
285
286
|
}));
|
|
286
287
|
if (usePrettier) {
|
|
287
|
-
configs.push(...yml$1.configs[
|
|
288
|
+
configs.push(...yml$1.configs["flat/prettier"].map((config, index) => {
|
|
288
289
|
return config.name ? config : {
|
|
289
290
|
name: `yml/flat/prettier/${index}`,
|
|
290
291
|
...config
|
|
@@ -292,9 +293,9 @@ async function yml(options = {}) {
|
|
|
292
293
|
}));
|
|
293
294
|
}
|
|
294
295
|
const overriddenConfig = {
|
|
295
|
-
name:
|
|
296
|
+
name: "@kazupon/yml",
|
|
296
297
|
files: [GLOB_YAML],
|
|
297
|
-
rules: {...overrideRules}
|
|
298
|
+
rules: { ...overrideRules }
|
|
298
299
|
};
|
|
299
300
|
configs.push(overriddenConfig);
|
|
300
301
|
return configs;
|
|
@@ -304,33 +305,64 @@ const yaml = yml;
|
|
|
304
305
|
//#endregion
|
|
305
306
|
//#region src/configs/vue.ts
|
|
306
307
|
async function vue(options = {}) {
|
|
307
|
-
const { rules: overrideRules = {}, parserOptions = {project: true} } = options;
|
|
308
|
+
const { rules: overrideRules = {}, parserOptions = { project: true } } = options;
|
|
308
309
|
const useTypeScript = !!options.typescript;
|
|
309
|
-
const vue$1 = await loadPlugin(
|
|
310
|
-
const vueParser = vue$1.configs[
|
|
310
|
+
const vue$1 = await loadPlugin("eslint-plugin-vue");
|
|
311
|
+
const vueParser = vue$1.configs["flat/base"][1]["languageOptions"]["parser"];
|
|
311
312
|
async function getTypeScriptParser() {
|
|
312
|
-
const ts = await loadPlugin(
|
|
313
|
+
const ts = await loadPlugin("typescript-eslint");
|
|
313
314
|
return ts.parser;
|
|
314
315
|
}
|
|
315
316
|
const customConfig = {
|
|
316
|
-
name:
|
|
317
|
+
name: "@kazupon/vue",
|
|
317
318
|
files: [GLOB_VUE],
|
|
318
|
-
rules: {...overrideRules}
|
|
319
|
+
rules: { ...overrideRules }
|
|
319
320
|
};
|
|
320
321
|
if (useTypeScript) {
|
|
321
322
|
customConfig.languageOptions = {
|
|
322
323
|
parser: vueParser,
|
|
323
324
|
parserOptions: {
|
|
324
|
-
sourceType:
|
|
325
|
+
sourceType: "module",
|
|
325
326
|
parser: await getTypeScriptParser(),
|
|
326
|
-
ecmaFeatures: {jsx: true},
|
|
327
|
-
extraFileExtensions: [
|
|
327
|
+
ecmaFeatures: { jsx: true },
|
|
328
|
+
extraFileExtensions: [".vue"],
|
|
328
329
|
...parserOptions
|
|
329
330
|
}
|
|
330
331
|
};
|
|
331
332
|
}
|
|
332
|
-
return [...
|
|
333
|
+
return [...vue$1.configs["flat/recommended"], customConfig];
|
|
333
334
|
}
|
|
334
335
|
|
|
335
336
|
//#endregion
|
|
336
|
-
|
|
337
|
+
//#region src/configs/svelte.ts
|
|
338
|
+
async function svelte(options = {}) {
|
|
339
|
+
const { rules: overrideRules = {}, parserOptions = { project: true } } = options;
|
|
340
|
+
const useTypeScript = !!options.typescript;
|
|
341
|
+
const svelte$1 = await loadPlugin("eslint-plugin-svelte");
|
|
342
|
+
const svelteParser = svelte$1.configs["flat/base"][1]["languageOptions"]["parser"];
|
|
343
|
+
async function getTypeScriptParser() {
|
|
344
|
+
const ts = await loadPlugin("typescript-eslint");
|
|
345
|
+
return ts.parser;
|
|
346
|
+
}
|
|
347
|
+
const customConfig = {
|
|
348
|
+
name: "@kazupon/svelte",
|
|
349
|
+
files: [GLOB_SVELTE],
|
|
350
|
+
rules: { ...overrideRules }
|
|
351
|
+
};
|
|
352
|
+
if (useTypeScript) {
|
|
353
|
+
customConfig.languageOptions = {
|
|
354
|
+
parser: svelteParser,
|
|
355
|
+
parserOptions: {
|
|
356
|
+
sourceType: "module",
|
|
357
|
+
parser: await getTypeScriptParser(),
|
|
358
|
+
ecmaFeatures: { jsx: true },
|
|
359
|
+
extraFileExtensions: [".svelte"],
|
|
360
|
+
...parserOptions
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
return [...svelte$1.configs["flat/recommended"], customConfig];
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
//#endregion
|
|
368
|
+
export { comments, defineConfig, javascript, jsdoc, jsonc, prettier, promise, regexp, svelte, toml, typescript, unicorn, vue, yaml, yml };
|
|
@@ -5,6 +5,7 @@ import type { JsoncRules } from './jsonc';
|
|
|
5
5
|
import type { PrettierRules } from './prettier';
|
|
6
6
|
import type { PromiseRules } from './promise';
|
|
7
7
|
import type { RegexpRules } from './regexp';
|
|
8
|
+
import type { SvelteRules } from './svelte';
|
|
8
9
|
import type { TomlRules } from './toml';
|
|
9
10
|
import type { TypescriptRules } from './typescript';
|
|
10
11
|
import type { UnicornRules } from './unicorn';
|
|
@@ -12,7 +13,7 @@ import type { VueRules } from './vue';
|
|
|
12
13
|
import type { YmlRules } from './yml';
|
|
13
14
|
declare module 'eslint' {
|
|
14
15
|
namespace Linter {
|
|
15
|
-
interface RulesRecord extends CommentsRules, JavascriptRules, JsdocRules, JsoncRules, PrettierRules, PromiseRules, RegexpRules, TomlRules, TypescriptRules, UnicornRules, VueRules, YmlRules {
|
|
16
|
+
interface RulesRecord extends CommentsRules, JavascriptRules, JsdocRules, JsoncRules, PrettierRules, PromiseRules, RegexpRules, SvelteRules, TomlRules, TypescriptRules, UnicornRules, VueRules, YmlRules {
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
}
|
|
@@ -5,6 +5,7 @@ import type { JsoncRules } from './jsonc';
|
|
|
5
5
|
import type { PrettierRules } from './prettier';
|
|
6
6
|
import type { PromiseRules } from './promise';
|
|
7
7
|
import type { RegexpRules } from './regexp';
|
|
8
|
+
import type { SvelteRules } from './svelte';
|
|
8
9
|
import type { TomlRules } from './toml';
|
|
9
10
|
import type { TypescriptRules } from './typescript';
|
|
10
11
|
import type { UnicornRules } from './unicorn';
|
|
@@ -12,7 +13,7 @@ import type { VueRules } from './vue';
|
|
|
12
13
|
import type { YmlRules } from './yml';
|
|
13
14
|
declare module 'eslint' {
|
|
14
15
|
namespace Linter {
|
|
15
|
-
interface RulesRecord extends CommentsRules, JavascriptRules, JsdocRules, JsoncRules, PrettierRules, PromiseRules, RegexpRules, TomlRules, TypescriptRules, UnicornRules, VueRules, YmlRules {
|
|
16
|
+
interface RulesRecord extends CommentsRules, JavascriptRules, JsdocRules, JsoncRules, PrettierRules, PromiseRules, RegexpRules, SvelteRules, TomlRules, TypescriptRules, UnicornRules, VueRules, YmlRules {
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
}
|
|
@@ -2674,15 +2674,11 @@ type NoRestrictedImports = ((string | {
|
|
|
2674
2674
|
importNames?: string[];
|
|
2675
2675
|
allowImportNames?: string[];
|
|
2676
2676
|
})[];
|
|
2677
|
-
patterns?: (string[] | {
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
allowImportNamePattern?: string;
|
|
2683
|
-
message?: string;
|
|
2684
|
-
caseSensitive?: boolean;
|
|
2685
|
-
}[]);
|
|
2677
|
+
patterns?: (string[] | ({
|
|
2678
|
+
[k: string]: unknown | undefined;
|
|
2679
|
+
} | {
|
|
2680
|
+
[k: string]: unknown | undefined;
|
|
2681
|
+
})[]);
|
|
2686
2682
|
}
|
|
2687
2683
|
]);
|
|
2688
2684
|
type NoRestrictedModules = ((string | {
|
|
@@ -2674,15 +2674,11 @@ type NoRestrictedImports = ((string | {
|
|
|
2674
2674
|
importNames?: string[];
|
|
2675
2675
|
allowImportNames?: string[];
|
|
2676
2676
|
})[];
|
|
2677
|
-
patterns?: (string[] | {
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
allowImportNamePattern?: string;
|
|
2683
|
-
message?: string;
|
|
2684
|
-
caseSensitive?: boolean;
|
|
2685
|
-
}[]);
|
|
2677
|
+
patterns?: (string[] | ({
|
|
2678
|
+
[k: string]: unknown | undefined;
|
|
2679
|
+
} | {
|
|
2680
|
+
[k: string]: unknown | undefined;
|
|
2681
|
+
})[]);
|
|
2686
2682
|
}
|
|
2687
2683
|
]);
|
|
2688
2684
|
type NoRestrictedModules = ((string | {
|
|
@@ -6,7 +6,7 @@ export interface PromiseRules {
|
|
|
6
6
|
*/
|
|
7
7
|
'promise/always-return'?: Linter.RuleEntry<PromiseAlwaysReturn>;
|
|
8
8
|
/**
|
|
9
|
-
* Disallow creating `new` promises outside of utility libs (use [
|
|
9
|
+
* Disallow creating `new` promises outside of utility libs (use [util.promisify][] instead).
|
|
10
10
|
* @see https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/avoid-new.md
|
|
11
11
|
*/
|
|
12
12
|
'promise/avoid-new'?: Linter.RuleEntry<[]>;
|
|
@@ -16,7 +16,7 @@ export interface PromiseRules {
|
|
|
16
16
|
*/
|
|
17
17
|
'promise/catch-or-return'?: Linter.RuleEntry<PromiseCatchOrReturn>;
|
|
18
18
|
/**
|
|
19
|
-
* Disallow calling `cb()` inside of a `then()` (use [
|
|
19
|
+
* Disallow calling `cb()` inside of a `then()` (use [util.callbackify][] instead).
|
|
20
20
|
* @see https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-callback-in-promise.md
|
|
21
21
|
*/
|
|
22
22
|
'promise/no-callback-in-promise'?: Linter.RuleEntry<PromiseNoCallbackInPromise>;
|
|
@@ -61,7 +61,7 @@ export interface PromiseRules {
|
|
|
61
61
|
*/
|
|
62
62
|
'promise/param-names'?: Linter.RuleEntry<PromiseParamNames>;
|
|
63
63
|
/**
|
|
64
|
-
* Prefer async
|
|
64
|
+
* Prefer `async`/`await` to the callback pattern.
|
|
65
65
|
* @see https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/prefer-await-to-callbacks.md
|
|
66
66
|
*/
|
|
67
67
|
'promise/prefer-await-to-callbacks'?: Linter.RuleEntry<[]>;
|
|
@@ -69,7 +69,7 @@ export interface PromiseRules {
|
|
|
69
69
|
* Prefer `await` to `then()`/`catch()`/`finally()` for reading Promise values.
|
|
70
70
|
* @see https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/prefer-await-to-then.md
|
|
71
71
|
*/
|
|
72
|
-
'promise/prefer-await-to-then'?: Linter.RuleEntry<
|
|
72
|
+
'promise/prefer-await-to-then'?: Linter.RuleEntry<PromisePreferAwaitToThen>;
|
|
73
73
|
/**
|
|
74
74
|
* Enforces the proper number of arguments are passed to Promise functions.
|
|
75
75
|
* @see https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/valid-params.md
|
|
@@ -104,4 +104,10 @@ type PromiseParamNames = [] | [
|
|
|
104
104
|
rejectPattern?: string;
|
|
105
105
|
}
|
|
106
106
|
];
|
|
107
|
+
type PromisePreferAwaitToThen = [] | [
|
|
108
|
+
{
|
|
109
|
+
strict?: boolean;
|
|
110
|
+
[k: string]: unknown | undefined;
|
|
111
|
+
}
|
|
112
|
+
];
|
|
107
113
|
export {};
|
|
@@ -6,7 +6,7 @@ export interface PromiseRules {
|
|
|
6
6
|
*/
|
|
7
7
|
'promise/always-return'?: Linter.RuleEntry<PromiseAlwaysReturn>;
|
|
8
8
|
/**
|
|
9
|
-
* Disallow creating `new` promises outside of utility libs (use [
|
|
9
|
+
* Disallow creating `new` promises outside of utility libs (use [util.promisify][] instead).
|
|
10
10
|
* @see https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/avoid-new.md
|
|
11
11
|
*/
|
|
12
12
|
'promise/avoid-new'?: Linter.RuleEntry<[]>;
|
|
@@ -16,7 +16,7 @@ export interface PromiseRules {
|
|
|
16
16
|
*/
|
|
17
17
|
'promise/catch-or-return'?: Linter.RuleEntry<PromiseCatchOrReturn>;
|
|
18
18
|
/**
|
|
19
|
-
* Disallow calling `cb()` inside of a `then()` (use [
|
|
19
|
+
* Disallow calling `cb()` inside of a `then()` (use [util.callbackify][] instead).
|
|
20
20
|
* @see https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-callback-in-promise.md
|
|
21
21
|
*/
|
|
22
22
|
'promise/no-callback-in-promise'?: Linter.RuleEntry<PromiseNoCallbackInPromise>;
|
|
@@ -61,7 +61,7 @@ export interface PromiseRules {
|
|
|
61
61
|
*/
|
|
62
62
|
'promise/param-names'?: Linter.RuleEntry<PromiseParamNames>;
|
|
63
63
|
/**
|
|
64
|
-
* Prefer async
|
|
64
|
+
* Prefer `async`/`await` to the callback pattern.
|
|
65
65
|
* @see https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/prefer-await-to-callbacks.md
|
|
66
66
|
*/
|
|
67
67
|
'promise/prefer-await-to-callbacks'?: Linter.RuleEntry<[]>;
|
|
@@ -69,7 +69,7 @@ export interface PromiseRules {
|
|
|
69
69
|
* Prefer `await` to `then()`/`catch()`/`finally()` for reading Promise values.
|
|
70
70
|
* @see https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/prefer-await-to-then.md
|
|
71
71
|
*/
|
|
72
|
-
'promise/prefer-await-to-then'?: Linter.RuleEntry<
|
|
72
|
+
'promise/prefer-await-to-then'?: Linter.RuleEntry<PromisePreferAwaitToThen>;
|
|
73
73
|
/**
|
|
74
74
|
* Enforces the proper number of arguments are passed to Promise functions.
|
|
75
75
|
* @see https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/valid-params.md
|
|
@@ -104,4 +104,10 @@ type PromiseParamNames = [] | [
|
|
|
104
104
|
rejectPattern?: string;
|
|
105
105
|
}
|
|
106
106
|
];
|
|
107
|
+
type PromisePreferAwaitToThen = [] | [
|
|
108
|
+
{
|
|
109
|
+
strict?: boolean;
|
|
110
|
+
[k: string]: unknown | undefined;
|
|
111
|
+
}
|
|
112
|
+
];
|
|
107
113
|
export {};
|