@antfu/eslint-config 1.0.0-beta.0 → 1.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 +289 -0
- package/dist/index.d.ts +149 -0
- package/dist/index.js +673 -659
- package/package.json +33 -9
package/dist/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// src/factory.ts
|
|
2
|
+
import process2 from "process";
|
|
3
|
+
import { isPackageExists } from "local-pkg";
|
|
4
|
+
|
|
1
5
|
// src/flags.ts
|
|
2
6
|
var OFF = 0;
|
|
3
7
|
|
|
@@ -38,51 +42,29 @@ var comments = [
|
|
|
38
42
|
// src/globs.ts
|
|
39
43
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
40
44
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
41
|
-
var GLOB_JS = "**/*.?([cm])js";
|
|
42
|
-
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
43
45
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
44
46
|
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
45
|
-
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
46
|
-
var GLOB_CSS = "**/*.css";
|
|
47
|
-
var GLOB_LESS = "**/*.less";
|
|
48
|
-
var GLOB_SCSS = "**/*.scss";
|
|
49
47
|
var GLOB_JSON = "**/*.json";
|
|
50
48
|
var GLOB_JSON5 = "**/*.json5";
|
|
51
49
|
var GLOB_JSONC = "**/*.jsonc";
|
|
52
50
|
var GLOB_MARKDOWN = "**/*.md";
|
|
53
51
|
var GLOB_VUE = "**/*.vue";
|
|
54
52
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
55
|
-
var
|
|
53
|
+
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
56
54
|
var GLOB_TESTS = [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
];
|
|
61
|
-
var GLOB_ALL_SRC = [
|
|
62
|
-
GLOB_SRC,
|
|
63
|
-
GLOB_STYLE,
|
|
64
|
-
GLOB_JSON,
|
|
65
|
-
GLOB_JSON5,
|
|
66
|
-
GLOB_MARKDOWN,
|
|
67
|
-
GLOB_VUE,
|
|
68
|
-
GLOB_YAML,
|
|
69
|
-
GLOB_HTML
|
|
55
|
+
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
56
|
+
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
57
|
+
`**/*.test.${GLOB_SRC_EXT}`
|
|
70
58
|
];
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
var GLOB_EXCLUDE = [
|
|
60
|
+
"**/node_modules",
|
|
61
|
+
"**/dist",
|
|
74
62
|
"**/package-lock.json",
|
|
75
63
|
"**/yarn.lock",
|
|
76
|
-
"**/pnpm-lock.yaml"
|
|
77
|
-
];
|
|
78
|
-
var GLOB_EXCLUDE = [
|
|
79
|
-
GLOB_NODE_MODULES,
|
|
80
|
-
GLOB_DIST,
|
|
81
|
-
...GLOB_LOCKFILE,
|
|
64
|
+
"**/pnpm-lock.yaml",
|
|
82
65
|
"**/output",
|
|
83
66
|
"**/coverage",
|
|
84
67
|
"**/temp",
|
|
85
|
-
"**/fixtures",
|
|
86
68
|
"**/.vitepress/cache",
|
|
87
69
|
"**/.nuxt",
|
|
88
70
|
"**/.vercel",
|
|
@@ -125,253 +107,238 @@ var imports = [
|
|
|
125
107
|
|
|
126
108
|
// src/configs/javascript.ts
|
|
127
109
|
import globals from "globals";
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var isInEditor = (process.env.VSCODE_PID || process.env.JETBRAINS_IDE) && !process.env.CI;
|
|
133
|
-
var hasTypeScript = isPackageExists("typescript");
|
|
134
|
-
var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli");
|
|
135
|
-
|
|
136
|
-
// src/configs/javascript.ts
|
|
137
|
-
var javascript = [
|
|
138
|
-
{
|
|
139
|
-
languageOptions: {
|
|
140
|
-
ecmaVersion: 2022,
|
|
141
|
-
globals: {
|
|
142
|
-
...globals.browser,
|
|
143
|
-
...globals.es2021,
|
|
144
|
-
...globals.node,
|
|
145
|
-
document: "readonly",
|
|
146
|
-
navigator: "readonly",
|
|
147
|
-
window: "readonly"
|
|
148
|
-
},
|
|
149
|
-
parserOptions: {
|
|
150
|
-
ecmaFeatures: {
|
|
151
|
-
jsx: true
|
|
152
|
-
},
|
|
110
|
+
function javascript(options = {}) {
|
|
111
|
+
return [
|
|
112
|
+
{
|
|
113
|
+
languageOptions: {
|
|
153
114
|
ecmaVersion: 2022,
|
|
115
|
+
globals: {
|
|
116
|
+
...globals.browser,
|
|
117
|
+
...globals.es2021,
|
|
118
|
+
...globals.node,
|
|
119
|
+
document: "readonly",
|
|
120
|
+
navigator: "readonly",
|
|
121
|
+
window: "readonly"
|
|
122
|
+
},
|
|
123
|
+
parserOptions: {
|
|
124
|
+
ecmaFeatures: {
|
|
125
|
+
jsx: true
|
|
126
|
+
},
|
|
127
|
+
ecmaVersion: 2022,
|
|
128
|
+
sourceType: "module"
|
|
129
|
+
},
|
|
154
130
|
sourceType: "module"
|
|
155
131
|
},
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
132
|
+
plugins: {
|
|
133
|
+
"antfu": default2,
|
|
134
|
+
"unused-imports": default13
|
|
135
|
+
},
|
|
136
|
+
rules: {
|
|
137
|
+
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
138
|
+
"antfu/import-dedupe": "error",
|
|
139
|
+
"antfu/no-import-node-modules-by-path": "error",
|
|
140
|
+
"antfu/top-level-function": "error",
|
|
141
|
+
"array-callback-return": "error",
|
|
142
|
+
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
143
|
+
"block-scoped-var": "error",
|
|
144
|
+
"camelcase": OFF,
|
|
145
|
+
"complexity": OFF,
|
|
146
|
+
"consistent-return": OFF,
|
|
147
|
+
"constructor-super": "error",
|
|
148
|
+
"default-case-last": "error",
|
|
149
|
+
"dot-notation": ["error", { allowKeywords: true }],
|
|
150
|
+
"eol-last": "error",
|
|
151
|
+
"eqeqeq": ["error", "smart"],
|
|
152
|
+
"max-statements-per-line": ["error", { max: 1 }],
|
|
153
|
+
"new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
|
|
154
|
+
"new-parens": "error",
|
|
155
|
+
"no-alert": "warn",
|
|
156
|
+
"no-array-constructor": "error",
|
|
157
|
+
"no-async-promise-executor": "error",
|
|
158
|
+
"no-caller": "error",
|
|
159
|
+
"no-case-declarations": "error",
|
|
160
|
+
"no-class-assign": "error",
|
|
161
|
+
"no-compare-neg-zero": "error",
|
|
162
|
+
"no-cond-assign": ["error", "always"],
|
|
163
|
+
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
164
|
+
"no-const-assign": "error",
|
|
165
|
+
"no-constant-condition": "warn",
|
|
166
|
+
"no-control-regex": "error",
|
|
167
|
+
"no-debugger": "error",
|
|
168
|
+
"no-delete-var": "error",
|
|
169
|
+
"no-dupe-args": "error",
|
|
170
|
+
"no-dupe-class-members": "error",
|
|
171
|
+
"no-dupe-keys": "error",
|
|
172
|
+
"no-duplicate-case": "error",
|
|
173
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
174
|
+
"no-empty-character-class": "error",
|
|
175
|
+
"no-empty-pattern": "error",
|
|
176
|
+
"no-eval": "error",
|
|
177
|
+
"no-ex-assign": "error",
|
|
178
|
+
"no-extend-native": "error",
|
|
179
|
+
"no-extra-bind": "error",
|
|
180
|
+
"no-extra-boolean-cast": "error",
|
|
181
|
+
"no-extra-parens": ["error", "functions"],
|
|
182
|
+
"no-fallthrough": "error",
|
|
183
|
+
"no-floating-decimal": "error",
|
|
184
|
+
"no-func-assign": "error",
|
|
185
|
+
"no-global-assign": "error",
|
|
186
|
+
"no-implied-eval": "error",
|
|
187
|
+
"no-import-assign": "error",
|
|
188
|
+
"no-invalid-regexp": "error",
|
|
189
|
+
"no-invalid-this": "error",
|
|
190
|
+
"no-irregular-whitespace": "error",
|
|
191
|
+
"no-iterator": "error",
|
|
192
|
+
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
193
|
+
"no-lone-blocks": "error",
|
|
194
|
+
"no-loss-of-precision": "error",
|
|
195
|
+
"no-misleading-character-class": "error",
|
|
196
|
+
"no-mixed-operators": ["error", {
|
|
197
|
+
allowSamePrecedence: true,
|
|
198
|
+
groups: [
|
|
199
|
+
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
|
200
|
+
["&&", "||"],
|
|
201
|
+
["in", "instanceof"]
|
|
202
|
+
]
|
|
203
|
+
}],
|
|
204
|
+
"no-multi-str": "error",
|
|
205
|
+
"no-new": "error",
|
|
206
|
+
"no-new-func": "error",
|
|
207
|
+
"no-new-object": "error",
|
|
208
|
+
"no-new-symbol": "error",
|
|
209
|
+
"no-new-wrappers": "error",
|
|
210
|
+
"no-obj-calls": "error",
|
|
211
|
+
"no-octal": "error",
|
|
212
|
+
"no-octal-escape": "error",
|
|
213
|
+
"no-param-reassign": OFF,
|
|
214
|
+
"no-proto": "error",
|
|
215
|
+
"no-prototype-builtins": "error",
|
|
216
|
+
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
217
|
+
"no-regex-spaces": "error",
|
|
218
|
+
"no-restricted-globals": [
|
|
219
|
+
"error",
|
|
220
|
+
{ message: "Use `globalThis` instead.", name: "global" },
|
|
221
|
+
{ message: "Use `globalThis` instead.", name: "self" }
|
|
222
|
+
],
|
|
223
|
+
"no-restricted-properties": [
|
|
224
|
+
"error",
|
|
225
|
+
{ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
|
|
226
|
+
{ message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
|
|
227
|
+
{ message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
|
|
228
|
+
{ message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
|
|
229
|
+
{ message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
|
|
230
|
+
],
|
|
231
|
+
"no-restricted-syntax": [
|
|
232
|
+
"error",
|
|
233
|
+
"DebuggerStatement",
|
|
234
|
+
"LabeledStatement",
|
|
235
|
+
"WithStatement"
|
|
236
|
+
],
|
|
237
|
+
"no-return-assign": OFF,
|
|
238
|
+
"no-return-await": OFF,
|
|
239
|
+
"no-self-assign": ["error", { props: true }],
|
|
240
|
+
"no-self-compare": "error",
|
|
241
|
+
"no-sequences": "error",
|
|
242
|
+
"no-shadow-restricted-names": "error",
|
|
243
|
+
"no-sparse-arrays": "error",
|
|
244
|
+
"no-template-curly-in-string": "error",
|
|
245
|
+
"no-this-before-super": "error",
|
|
246
|
+
"no-throw-literal": "error",
|
|
247
|
+
"no-undef": "error",
|
|
248
|
+
"no-undef-init": "error",
|
|
249
|
+
"no-unexpected-multiline": "error",
|
|
250
|
+
"no-unmodified-loop-condition": "error",
|
|
251
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
252
|
+
"no-unreachable": "error",
|
|
253
|
+
"no-unreachable-loop": "error",
|
|
254
|
+
"no-unsafe-finally": "error",
|
|
255
|
+
"no-unsafe-negation": "error",
|
|
256
|
+
"no-unused-expressions": ["error", {
|
|
257
|
+
allowShortCircuit: true,
|
|
258
|
+
allowTaggedTemplates: true,
|
|
259
|
+
allowTernary: true
|
|
260
|
+
}],
|
|
261
|
+
"no-unused-vars": ["error", {
|
|
262
|
+
args: "none",
|
|
263
|
+
caughtErrors: "none",
|
|
264
|
+
ignoreRestSiblings: true,
|
|
265
|
+
vars: "all"
|
|
266
|
+
}],
|
|
267
|
+
"no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
268
|
+
"no-useless-backreference": "error",
|
|
269
|
+
"no-useless-call": "error",
|
|
270
|
+
"no-useless-catch": "error",
|
|
271
|
+
"no-useless-computed-key": "error",
|
|
272
|
+
"no-useless-constructor": "error",
|
|
273
|
+
"no-useless-escape": OFF,
|
|
274
|
+
"no-useless-rename": "error",
|
|
275
|
+
"no-useless-return": "error",
|
|
276
|
+
"no-var": "error",
|
|
277
|
+
"no-void": "error",
|
|
278
|
+
"no-with": "error",
|
|
279
|
+
"object-shorthand": [
|
|
280
|
+
"error",
|
|
281
|
+
"always",
|
|
282
|
+
{
|
|
283
|
+
avoidQuotes: true,
|
|
284
|
+
ignoreConstructors: false
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
"one-var": ["error", { initialized: "never" }],
|
|
288
|
+
"prefer-arrow-callback": [
|
|
289
|
+
"error",
|
|
290
|
+
{
|
|
291
|
+
allowNamedFunctions: false,
|
|
292
|
+
allowUnboundThis: true
|
|
293
|
+
}
|
|
294
|
+
],
|
|
295
|
+
"prefer-const": [
|
|
296
|
+
"error",
|
|
297
|
+
{
|
|
298
|
+
destructuring: "all",
|
|
299
|
+
ignoreReadBeforeAssign: true
|
|
300
|
+
}
|
|
301
|
+
],
|
|
302
|
+
"prefer-exponentiation-operator": "error",
|
|
303
|
+
"prefer-promise-reject-errors": "error",
|
|
304
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
305
|
+
"prefer-rest-params": "error",
|
|
306
|
+
"prefer-spread": "error",
|
|
307
|
+
"prefer-template": "error",
|
|
308
|
+
"quote-props": ["error", "consistent-as-needed"],
|
|
309
|
+
"require-await": OFF,
|
|
310
|
+
"sort-imports": [
|
|
311
|
+
"error",
|
|
312
|
+
{
|
|
313
|
+
allowSeparatedGroups: false,
|
|
314
|
+
ignoreCase: false,
|
|
315
|
+
ignoreDeclarationSort: true,
|
|
316
|
+
ignoreMemberSort: false,
|
|
317
|
+
memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
|
|
318
|
+
}
|
|
319
|
+
],
|
|
320
|
+
"symbol-description": "error",
|
|
321
|
+
"unicode-bom": ["error", "never"],
|
|
322
|
+
"unused-imports/no-unused-imports": options.isInEditor ? OFF : "error",
|
|
323
|
+
"unused-imports/no-unused-vars": [
|
|
324
|
+
"warn",
|
|
325
|
+
{ args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
|
|
326
|
+
],
|
|
327
|
+
"use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
|
|
328
|
+
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
329
|
+
"vars-on-top": "error",
|
|
330
|
+
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
331
|
+
"yoda": ["error", "never"]
|
|
332
|
+
}
|
|
161
333
|
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
"antfu/top-level-function": "error",
|
|
168
|
-
// best-practice
|
|
169
|
-
"array-callback-return": "error",
|
|
170
|
-
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
171
|
-
"block-scoped-var": "error",
|
|
172
|
-
"camelcase": OFF,
|
|
173
|
-
"comma-dangle": ["error", "always-multiline"],
|
|
174
|
-
"complexity": OFF,
|
|
175
|
-
"consistent-return": OFF,
|
|
176
|
-
"constructor-super": "error",
|
|
177
|
-
"curly": ["error", "multi-or-nest", "consistent"],
|
|
178
|
-
"default-case-last": "error",
|
|
179
|
-
"dot-notation": ["error", { allowKeywords: true }],
|
|
180
|
-
"eol-last": "error",
|
|
181
|
-
"eqeqeq": ["error", "smart"],
|
|
182
|
-
"max-statements-per-line": ["error", { max: 1 }],
|
|
183
|
-
"new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
|
|
184
|
-
"new-parens": "error",
|
|
185
|
-
"no-alert": "warn",
|
|
186
|
-
"no-array-constructor": "error",
|
|
187
|
-
"no-async-promise-executor": "error",
|
|
188
|
-
"no-caller": "error",
|
|
189
|
-
"no-case-declarations": "error",
|
|
190
|
-
"no-class-assign": "error",
|
|
191
|
-
"no-compare-neg-zero": "error",
|
|
192
|
-
"no-cond-assign": ["error", "always"],
|
|
193
|
-
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
194
|
-
"no-const-assign": "error",
|
|
195
|
-
"no-constant-condition": "warn",
|
|
196
|
-
"no-control-regex": "error",
|
|
197
|
-
"no-debugger": "error",
|
|
198
|
-
"no-delete-var": "error",
|
|
199
|
-
"no-dupe-args": "error",
|
|
200
|
-
"no-dupe-class-members": "error",
|
|
201
|
-
"no-dupe-keys": "error",
|
|
202
|
-
"no-duplicate-case": "error",
|
|
203
|
-
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
204
|
-
"no-empty-character-class": "error",
|
|
205
|
-
"no-empty-pattern": "error",
|
|
206
|
-
"no-eval": "error",
|
|
207
|
-
"no-ex-assign": "error",
|
|
208
|
-
"no-extend-native": "error",
|
|
209
|
-
"no-extra-bind": "error",
|
|
210
|
-
"no-extra-boolean-cast": "error",
|
|
211
|
-
"no-extra-parens": ["error", "functions"],
|
|
212
|
-
"no-fallthrough": "error",
|
|
213
|
-
"no-floating-decimal": "error",
|
|
214
|
-
"no-func-assign": "error",
|
|
215
|
-
"no-global-assign": "error",
|
|
216
|
-
"no-implied-eval": "error",
|
|
217
|
-
"no-import-assign": "error",
|
|
218
|
-
"no-invalid-regexp": "error",
|
|
219
|
-
"no-invalid-this": "error",
|
|
220
|
-
"no-irregular-whitespace": "error",
|
|
221
|
-
"no-iterator": "error",
|
|
222
|
-
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
223
|
-
"no-lone-blocks": "error",
|
|
224
|
-
"no-loss-of-precision": "error",
|
|
225
|
-
"no-misleading-character-class": "error",
|
|
226
|
-
"no-mixed-operators": ["error", {
|
|
227
|
-
allowSamePrecedence: true,
|
|
228
|
-
groups: [
|
|
229
|
-
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
|
230
|
-
["&&", "||"],
|
|
231
|
-
["in", "instanceof"]
|
|
232
|
-
]
|
|
233
|
-
}],
|
|
234
|
-
"no-multi-str": "error",
|
|
235
|
-
"no-new": "error",
|
|
236
|
-
"no-new-func": "error",
|
|
237
|
-
"no-new-object": "error",
|
|
238
|
-
"no-new-symbol": "error",
|
|
239
|
-
"no-new-wrappers": "error",
|
|
240
|
-
"no-obj-calls": "error",
|
|
241
|
-
"no-octal": "error",
|
|
242
|
-
"no-octal-escape": "error",
|
|
243
|
-
"no-param-reassign": OFF,
|
|
244
|
-
"no-proto": "error",
|
|
245
|
-
"no-prototype-builtins": "error",
|
|
246
|
-
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
247
|
-
"no-regex-spaces": "error",
|
|
248
|
-
"no-restricted-globals": [
|
|
249
|
-
"error",
|
|
250
|
-
{ message: "Use `globalThis` instead.", name: "global" },
|
|
251
|
-
{ message: "Use `globalThis` instead.", name: "self" }
|
|
252
|
-
],
|
|
253
|
-
"no-restricted-properties": [
|
|
254
|
-
"error",
|
|
255
|
-
{ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
|
|
256
|
-
{ message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
|
|
257
|
-
{ message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
|
|
258
|
-
{ message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
|
|
259
|
-
{ message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
|
|
260
|
-
],
|
|
261
|
-
"no-restricted-syntax": [
|
|
262
|
-
"error",
|
|
263
|
-
"DebuggerStatement",
|
|
264
|
-
"LabeledStatement",
|
|
265
|
-
"WithStatement"
|
|
266
|
-
],
|
|
267
|
-
"no-return-assign": OFF,
|
|
268
|
-
"no-return-await": OFF,
|
|
269
|
-
"no-self-assign": ["error", { props: true }],
|
|
270
|
-
"no-self-compare": "error",
|
|
271
|
-
"no-sequences": "error",
|
|
272
|
-
"no-shadow-restricted-names": "error",
|
|
273
|
-
"no-sparse-arrays": "error",
|
|
274
|
-
"no-template-curly-in-string": "error",
|
|
275
|
-
"no-this-before-super": "error",
|
|
276
|
-
"no-throw-literal": "error",
|
|
277
|
-
"no-undef": "error",
|
|
278
|
-
"no-undef-init": "error",
|
|
279
|
-
"no-unexpected-multiline": "error",
|
|
280
|
-
"no-unmodified-loop-condition": "error",
|
|
281
|
-
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
282
|
-
"no-unreachable": "error",
|
|
283
|
-
"no-unreachable-loop": "error",
|
|
284
|
-
"no-unsafe-finally": "error",
|
|
285
|
-
"no-unsafe-negation": "error",
|
|
286
|
-
"no-unused-expressions": ["error", {
|
|
287
|
-
allowShortCircuit: true,
|
|
288
|
-
allowTaggedTemplates: true,
|
|
289
|
-
allowTernary: true
|
|
290
|
-
}],
|
|
291
|
-
"no-unused-vars": ["error", {
|
|
292
|
-
args: "none",
|
|
293
|
-
caughtErrors: "none",
|
|
294
|
-
ignoreRestSiblings: true,
|
|
295
|
-
vars: "all"
|
|
296
|
-
}],
|
|
297
|
-
"no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
298
|
-
"no-useless-backreference": "error",
|
|
299
|
-
"no-useless-call": "error",
|
|
300
|
-
"no-useless-catch": "error",
|
|
301
|
-
"no-useless-computed-key": "error",
|
|
302
|
-
"no-useless-constructor": "error",
|
|
303
|
-
"no-useless-escape": OFF,
|
|
304
|
-
"no-useless-rename": "error",
|
|
305
|
-
"no-useless-return": "error",
|
|
306
|
-
// ES6
|
|
307
|
-
"no-var": "error",
|
|
308
|
-
"no-void": "error",
|
|
309
|
-
"no-with": "error",
|
|
310
|
-
"object-shorthand": [
|
|
311
|
-
"error",
|
|
312
|
-
"always",
|
|
313
|
-
{
|
|
314
|
-
avoidQuotes: true,
|
|
315
|
-
ignoreConstructors: false
|
|
316
|
-
}
|
|
317
|
-
],
|
|
318
|
-
"one-var": ["error", { initialized: "never" }],
|
|
319
|
-
"prefer-arrow-callback": [
|
|
320
|
-
"error",
|
|
321
|
-
{
|
|
322
|
-
allowNamedFunctions: false,
|
|
323
|
-
allowUnboundThis: true
|
|
324
|
-
}
|
|
325
|
-
],
|
|
326
|
-
"prefer-const": [
|
|
327
|
-
"error",
|
|
328
|
-
{
|
|
329
|
-
destructuring: "all",
|
|
330
|
-
ignoreReadBeforeAssign: true
|
|
331
|
-
}
|
|
332
|
-
],
|
|
333
|
-
"prefer-exponentiation-operator": "error",
|
|
334
|
-
"prefer-promise-reject-errors": "error",
|
|
335
|
-
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
336
|
-
"prefer-rest-params": "error",
|
|
337
|
-
"prefer-spread": "error",
|
|
338
|
-
"prefer-template": "error",
|
|
339
|
-
"quote-props": ["error", "consistent-as-needed"],
|
|
340
|
-
"quotes": ["error", "single"],
|
|
341
|
-
"require-await": OFF,
|
|
342
|
-
// Common
|
|
343
|
-
"semi": ["error", "never"],
|
|
344
|
-
"sort-imports": [
|
|
345
|
-
"error",
|
|
346
|
-
{
|
|
347
|
-
allowSeparatedGroups: false,
|
|
348
|
-
ignoreCase: false,
|
|
349
|
-
ignoreDeclarationSort: true,
|
|
350
|
-
ignoreMemberSort: false,
|
|
351
|
-
memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
|
|
352
|
-
}
|
|
353
|
-
],
|
|
354
|
-
"symbol-description": "error",
|
|
355
|
-
"unicode-bom": ["error", "never"],
|
|
356
|
-
"unused-imports/no-unused-imports": isInEditor ? OFF : "error",
|
|
357
|
-
"unused-imports/no-unused-vars": [
|
|
358
|
-
"warn",
|
|
359
|
-
{ args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
|
|
360
|
-
],
|
|
361
|
-
"use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
|
|
362
|
-
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
363
|
-
"vars-on-top": "error",
|
|
364
|
-
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
365
|
-
"yoda": ["error", "never"]
|
|
366
|
-
}
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
files: ["scripts/**/*.*", "cli.*"],
|
|
370
|
-
rules: {
|
|
371
|
-
"no-console": OFF
|
|
334
|
+
{
|
|
335
|
+
files: ["scripts/**/*.*", "cli.*"],
|
|
336
|
+
rules: {
|
|
337
|
+
"no-console": OFF
|
|
338
|
+
}
|
|
372
339
|
}
|
|
373
|
-
|
|
374
|
-
|
|
340
|
+
];
|
|
341
|
+
}
|
|
375
342
|
|
|
376
343
|
// src/configs/jsdoc.ts
|
|
377
344
|
var jsdoc = [
|
|
@@ -380,7 +347,7 @@ var jsdoc = [
|
|
|
380
347
|
jsdoc: default5
|
|
381
348
|
},
|
|
382
349
|
rules: {
|
|
383
|
-
...default5.configs
|
|
350
|
+
...default5.configs["flat/recommended-typescript"].rules,
|
|
384
351
|
"jsdoc/check-tag-names": OFF,
|
|
385
352
|
"jsdoc/check-values": OFF,
|
|
386
353
|
"jsdoc/no-undefined-types": OFF,
|
|
@@ -423,65 +390,75 @@ var jsonc = [
|
|
|
423
390
|
];
|
|
424
391
|
|
|
425
392
|
// src/configs/markdown.ts
|
|
426
|
-
|
|
427
|
-
{
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
393
|
+
function markdown(options = {}) {
|
|
394
|
+
const {
|
|
395
|
+
componentExts = []
|
|
396
|
+
} = options;
|
|
397
|
+
return [
|
|
398
|
+
{
|
|
399
|
+
files: [GLOB_MARKDOWN],
|
|
400
|
+
plugins: {
|
|
401
|
+
markdown: default7
|
|
402
|
+
},
|
|
403
|
+
processor: "markdown/markdown"
|
|
431
404
|
},
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
405
|
+
{
|
|
406
|
+
files: [
|
|
407
|
+
GLOB_MARKDOWN_CODE,
|
|
408
|
+
...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
|
|
409
|
+
],
|
|
410
|
+
languageOptions: {
|
|
411
|
+
parserOptions: {
|
|
412
|
+
ecmaFeatures: {
|
|
413
|
+
impliedStrict: true
|
|
414
|
+
}
|
|
440
415
|
}
|
|
416
|
+
},
|
|
417
|
+
plugins: {
|
|
418
|
+
ts: default11
|
|
419
|
+
},
|
|
420
|
+
rules: {
|
|
421
|
+
...default7.configs.recommended.overrides[1].rules,
|
|
422
|
+
"antfu/no-cjs-exports": OFF,
|
|
423
|
+
"antfu/no-ts-export-equal": OFF,
|
|
424
|
+
"import/no-unresolved": OFF,
|
|
425
|
+
"no-alert": OFF,
|
|
426
|
+
"no-console": OFF,
|
|
427
|
+
"no-restricted-imports": OFF,
|
|
428
|
+
"no-undef": OFF,
|
|
429
|
+
"no-unused-expressions": OFF,
|
|
430
|
+
"no-unused-vars": OFF,
|
|
431
|
+
"node/prefer-global/process": OFF,
|
|
432
|
+
"ts/comma-dangle": OFF,
|
|
433
|
+
"ts/consistent-type-imports": OFF,
|
|
434
|
+
"ts/no-namespace": OFF,
|
|
435
|
+
"ts/no-redeclare": OFF,
|
|
436
|
+
"ts/no-require-imports": OFF,
|
|
437
|
+
"ts/no-unused-vars": OFF,
|
|
438
|
+
"ts/no-use-before-define": OFF,
|
|
439
|
+
"ts/no-var-requires": OFF,
|
|
440
|
+
"unused-imports/no-unused-imports": OFF,
|
|
441
|
+
"unused-imports/no-unused-vars": OFF
|
|
441
442
|
}
|
|
442
|
-
},
|
|
443
|
-
rules: {
|
|
444
|
-
...default7.configs.recommended.overrides[1].rules,
|
|
445
|
-
"@typescript-eslint/comma-dangle": OFF,
|
|
446
|
-
"@typescript-eslint/consistent-type-imports": OFF,
|
|
447
|
-
"@typescript-eslint/no-namespace": OFF,
|
|
448
|
-
"@typescript-eslint/no-redeclare": OFF,
|
|
449
|
-
"@typescript-eslint/no-require-imports": OFF,
|
|
450
|
-
"@typescript-eslint/no-unused-vars": OFF,
|
|
451
|
-
"@typescript-eslint/no-use-before-define": OFF,
|
|
452
|
-
"@typescript-eslint/no-var-requires": OFF,
|
|
453
|
-
"antfu/no-cjs-exports": OFF,
|
|
454
|
-
"antfu/no-ts-export-equal": OFF,
|
|
455
|
-
"import/no-unresolved": OFF,
|
|
456
|
-
"n/prefer-global/process": OFF,
|
|
457
|
-
"no-alert": OFF,
|
|
458
|
-
"no-console": OFF,
|
|
459
|
-
"no-restricted-imports": OFF,
|
|
460
|
-
"no-undef": OFF,
|
|
461
|
-
"no-unused-expressions": OFF,
|
|
462
|
-
"no-unused-vars": OFF,
|
|
463
|
-
"unused-imports/no-unused-imports": OFF,
|
|
464
|
-
"unused-imports/no-unused-vars": OFF
|
|
465
443
|
}
|
|
466
|
-
|
|
467
|
-
|
|
444
|
+
];
|
|
445
|
+
}
|
|
468
446
|
|
|
469
447
|
// src/configs/node.ts
|
|
470
448
|
var node = [
|
|
471
449
|
{
|
|
472
450
|
plugins: {
|
|
473
|
-
|
|
451
|
+
node: default8
|
|
474
452
|
},
|
|
475
453
|
rules: {
|
|
476
|
-
|
|
477
|
-
"
|
|
478
|
-
"
|
|
479
|
-
"
|
|
480
|
-
"
|
|
481
|
-
"
|
|
482
|
-
"
|
|
483
|
-
"
|
|
484
|
-
"n/process-exit-as-throw": "error"
|
|
454
|
+
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
455
|
+
"node/no-deprecated-api": "error",
|
|
456
|
+
"node/no-exports-assign": "error",
|
|
457
|
+
"node/no-new-require": "error",
|
|
458
|
+
"node/no-path-concat": "error",
|
|
459
|
+
"node/prefer-global/buffer": ["error", "never"],
|
|
460
|
+
"node/prefer-global/process": ["error", "never"],
|
|
461
|
+
"node/process-exit-as-throw": "error"
|
|
485
462
|
}
|
|
486
463
|
}
|
|
487
464
|
];
|
|
@@ -697,25 +674,30 @@ var sortTsconfig = [
|
|
|
697
674
|
];
|
|
698
675
|
|
|
699
676
|
// src/configs/stylistic.ts
|
|
700
|
-
import {
|
|
677
|
+
import { packages } from "@eslint-stylistic/metadata";
|
|
678
|
+
var tsPackage = packages.find((i) => i.shortId === "ts");
|
|
701
679
|
var javascriptStylistic = [
|
|
702
680
|
{
|
|
703
681
|
plugins: {
|
|
704
|
-
|
|
682
|
+
style: default9
|
|
705
683
|
},
|
|
706
684
|
rules: {
|
|
707
|
-
|
|
708
|
-
"
|
|
709
|
-
"
|
|
710
|
-
"
|
|
711
|
-
"
|
|
712
|
-
"
|
|
713
|
-
"
|
|
714
|
-
"
|
|
715
|
-
"
|
|
716
|
-
"
|
|
717
|
-
"
|
|
718
|
-
"
|
|
685
|
+
"antfu/if-newline": "error",
|
|
686
|
+
"comma-dangle": ["error", "always-multiline"],
|
|
687
|
+
"curly": ["error", "multi-or-nest", "consistent"],
|
|
688
|
+
"quotes": ["error", "single"],
|
|
689
|
+
"semi": ["error", "never"],
|
|
690
|
+
"style/array-bracket-spacing": ["error", "never"],
|
|
691
|
+
"style/arrow-spacing": ["error", { after: true, before: true }],
|
|
692
|
+
"style/block-spacing": ["error", "always"],
|
|
693
|
+
"style/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
694
|
+
"style/comma-spacing": ["error", { after: true, before: false }],
|
|
695
|
+
"style/comma-style": ["error", "last"],
|
|
696
|
+
"style/computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
|
|
697
|
+
"style/dot-location": ["error", "property"],
|
|
698
|
+
"style/func-call-spacing": OFF,
|
|
699
|
+
"style/generator-star-spacing": OFF,
|
|
700
|
+
"style/indent": ["error", 2, {
|
|
719
701
|
ArrayExpression: 1,
|
|
720
702
|
CallExpression: { arguments: 1 },
|
|
721
703
|
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
@@ -753,29 +735,29 @@ var javascriptStylistic = [
|
|
|
753
735
|
offsetTernaryExpressions: true,
|
|
754
736
|
outerIIFEBody: 1
|
|
755
737
|
}],
|
|
756
|
-
"
|
|
757
|
-
"
|
|
758
|
-
"
|
|
759
|
-
"
|
|
760
|
-
"
|
|
761
|
-
"
|
|
762
|
-
"
|
|
763
|
-
"
|
|
764
|
-
"
|
|
765
|
-
"
|
|
766
|
-
"
|
|
767
|
-
"
|
|
768
|
-
"
|
|
769
|
-
"
|
|
770
|
-
"
|
|
771
|
-
"
|
|
772
|
-
"
|
|
773
|
-
"
|
|
774
|
-
"
|
|
775
|
-
"
|
|
776
|
-
"
|
|
777
|
-
"
|
|
778
|
-
"
|
|
738
|
+
"style/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
739
|
+
"style/keyword-spacing": ["error", { after: true, before: true }],
|
|
740
|
+
"style/lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
|
741
|
+
"style/multiline-ternary": ["error", "always-multiline"],
|
|
742
|
+
"style/no-mixed-spaces-and-tabs": "error",
|
|
743
|
+
"style/no-multi-spaces": "error",
|
|
744
|
+
"style/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
745
|
+
"style/no-tabs": "error",
|
|
746
|
+
"style/no-trailing-spaces": "error",
|
|
747
|
+
"style/no-whitespace-before-property": "error",
|
|
748
|
+
"style/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
749
|
+
"style/object-curly-spacing": ["error", "always"],
|
|
750
|
+
"style/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
751
|
+
"style/operator-linebreak": ["error", "before"],
|
|
752
|
+
"style/padded-blocks": ["error", { blocks: "never", classes: "never", switches: "never" }],
|
|
753
|
+
"style/rest-spread-spacing": ["error", "never"],
|
|
754
|
+
"style/semi-spacing": ["error", { after: true, before: false }],
|
|
755
|
+
"style/space-before-blocks": ["error", "always"],
|
|
756
|
+
"style/space-before-function-paren": ["error", { anonymous: "always", asyncArrow: "always", named: "never" }],
|
|
757
|
+
"style/space-in-parens": ["error", "never"],
|
|
758
|
+
"style/space-infix-ops": "error",
|
|
759
|
+
"style/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
760
|
+
"style/spaced-comment": ["error", "always", {
|
|
779
761
|
block: {
|
|
780
762
|
balanced: true,
|
|
781
763
|
exceptions: ["*"],
|
|
@@ -786,171 +768,215 @@ var javascriptStylistic = [
|
|
|
786
768
|
markers: ["/"]
|
|
787
769
|
}
|
|
788
770
|
}],
|
|
789
|
-
"
|
|
790
|
-
"
|
|
791
|
-
"
|
|
771
|
+
"style/template-curly-spacing": "error",
|
|
772
|
+
"style/template-tag-spacing": ["error", "never"],
|
|
773
|
+
"style/yield-star-spacing": ["error", "both"]
|
|
792
774
|
}
|
|
793
775
|
}
|
|
794
776
|
];
|
|
795
777
|
var typescriptStylistic = [
|
|
796
778
|
{
|
|
797
779
|
plugins: {
|
|
798
|
-
"
|
|
799
|
-
"
|
|
780
|
+
"style-ts": default10,
|
|
781
|
+
"ts": default11
|
|
800
782
|
},
|
|
801
783
|
rules: {
|
|
802
|
-
...stylisticJsToTS(rules),
|
|
803
|
-
"
|
|
804
|
-
"
|
|
784
|
+
...stylisticJsToTS(javascriptStylistic[0].rules),
|
|
785
|
+
"comma-dangle": OFF,
|
|
786
|
+
"quotes": OFF,
|
|
787
|
+
"semi": OFF,
|
|
788
|
+
"style-ts/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
789
|
+
"style-ts/type-annotation-spacing": ["error", {}],
|
|
790
|
+
"ts/comma-dangle": ["error", "always-multiline"],
|
|
791
|
+
"ts/quotes": ["error", "single"],
|
|
792
|
+
"ts/semi": ["error", "never"]
|
|
805
793
|
}
|
|
806
794
|
}
|
|
807
795
|
];
|
|
808
796
|
function stylisticJsToTS(input) {
|
|
809
797
|
return {
|
|
810
|
-
// turn off all stylistic rules from
|
|
798
|
+
// turn off all stylistic rules from style
|
|
811
799
|
...Object.fromEntries(
|
|
812
|
-
Object.entries(input).map(([key]) =>
|
|
800
|
+
Object.entries(input).map(([key]) => {
|
|
801
|
+
if (!key.startsWith("style/"))
|
|
802
|
+
return null;
|
|
803
|
+
const basename = key.replace("style/", "");
|
|
804
|
+
if (tsPackage.rules.find((i) => i.name === basename))
|
|
805
|
+
return [key, OFF];
|
|
806
|
+
return null;
|
|
807
|
+
}).filter(Boolean)
|
|
813
808
|
),
|
|
814
|
-
// rename all stylistic rules from
|
|
809
|
+
// rename all stylistic rules from style to style/ts
|
|
815
810
|
...Object.fromEntries(
|
|
816
811
|
Object.entries(input).map(([key, value]) => {
|
|
817
|
-
|
|
818
|
-
if (newKey === key)
|
|
812
|
+
if (!key.startsWith("style/"))
|
|
819
813
|
return null;
|
|
820
|
-
|
|
814
|
+
const basename = key.replace("style/", "");
|
|
815
|
+
return tsPackage.rules.find((i) => i.name === basename) ? [`style-ts/${basename}`, value] : null;
|
|
821
816
|
}).filter(Boolean)
|
|
822
817
|
)
|
|
823
818
|
};
|
|
824
819
|
}
|
|
825
820
|
|
|
826
821
|
// src/configs/typescript.ts
|
|
827
|
-
import
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
822
|
+
import process from "process";
|
|
823
|
+
|
|
824
|
+
// src/utils.ts
|
|
825
|
+
function combine(...configs) {
|
|
826
|
+
return configs.flatMap((config) => Array.isArray(config) ? config : [config]);
|
|
827
|
+
}
|
|
828
|
+
function renameRules(rules, from, to) {
|
|
829
|
+
return Object.fromEntries(
|
|
830
|
+
Object.entries(rules).map(([key, value]) => {
|
|
831
|
+
if (key.startsWith(from))
|
|
832
|
+
return [to + key.slice(from.length), value];
|
|
833
|
+
return [key, value];
|
|
834
|
+
})
|
|
835
|
+
);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
// src/configs/typescript.ts
|
|
839
|
+
function typescript(options) {
|
|
840
|
+
const {
|
|
841
|
+
componentExts = []
|
|
842
|
+
} = options ?? {};
|
|
843
|
+
return [
|
|
844
|
+
{
|
|
845
|
+
files: [
|
|
846
|
+
GLOB_TS,
|
|
847
|
+
GLOB_TSX,
|
|
848
|
+
...componentExts.map((ext) => `**/*.${ext}`)
|
|
849
|
+
],
|
|
850
|
+
languageOptions: {
|
|
851
|
+
parser: default17,
|
|
852
|
+
parserOptions: {
|
|
853
|
+
sourceType: "module"
|
|
854
|
+
}
|
|
855
|
+
},
|
|
856
|
+
plugins: {
|
|
857
|
+
antfu: default2,
|
|
858
|
+
import: default4,
|
|
859
|
+
ts: default11
|
|
860
|
+
},
|
|
861
|
+
rules: {
|
|
862
|
+
...renameRules(
|
|
863
|
+
default11.configs["eslint-recommended"].overrides[0].rules,
|
|
864
|
+
"@typescript-eslint/",
|
|
865
|
+
"ts/"
|
|
866
|
+
),
|
|
867
|
+
...renameRules(
|
|
868
|
+
default11.configs.strict.rules,
|
|
869
|
+
"@typescript-eslint/",
|
|
870
|
+
"ts/"
|
|
871
|
+
),
|
|
872
|
+
"antfu/generic-spacing": "error",
|
|
873
|
+
"antfu/named-tuple-spacing": "error",
|
|
874
|
+
"antfu/no-cjs-exports": "error",
|
|
875
|
+
"antfu/no-const-enum": "error",
|
|
876
|
+
"antfu/no-ts-export-equal": "error",
|
|
877
|
+
"no-dupe-class-members": OFF,
|
|
878
|
+
"no-extra-parens": OFF,
|
|
879
|
+
"no-invalid-this": OFF,
|
|
880
|
+
"no-loss-of-precision": OFF,
|
|
881
|
+
"no-redeclare": OFF,
|
|
882
|
+
"no-use-before-define": OFF,
|
|
883
|
+
"no-useless-constructor": OFF,
|
|
884
|
+
// TS
|
|
885
|
+
"ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
|
|
886
|
+
"ts/ban-ts-ignore": OFF,
|
|
887
|
+
"ts/consistent-indexed-object-style": OFF,
|
|
888
|
+
"ts/consistent-type-definitions": ["error", "interface"],
|
|
889
|
+
"ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
|
|
890
|
+
"ts/explicit-function-return-type": OFF,
|
|
891
|
+
"ts/explicit-member-accessibility": OFF,
|
|
892
|
+
"ts/explicit-module-boundary-types": OFF,
|
|
893
|
+
"ts/naming-convention": OFF,
|
|
894
|
+
"ts/no-dupe-class-members": "error",
|
|
895
|
+
"ts/no-empty-function": OFF,
|
|
896
|
+
"ts/no-empty-interface": OFF,
|
|
897
|
+
"ts/no-explicit-any": OFF,
|
|
898
|
+
"ts/no-extra-parens": ["error", "functions"],
|
|
899
|
+
"ts/no-invalid-this": "error",
|
|
900
|
+
"ts/no-loss-of-precision": "error",
|
|
901
|
+
"ts/no-non-null-assertion": OFF,
|
|
902
|
+
"ts/no-redeclare": "error",
|
|
903
|
+
"ts/no-require-imports": "error",
|
|
904
|
+
"ts/no-unused-vars": OFF,
|
|
905
|
+
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
906
|
+
"ts/parameter-properties": OFF,
|
|
907
|
+
"ts/prefer-ts-expect-error": "error",
|
|
908
|
+
"ts/triple-slash-reference": OFF
|
|
838
909
|
}
|
|
839
910
|
},
|
|
840
|
-
|
|
841
|
-
"
|
|
842
|
-
|
|
843
|
-
|
|
911
|
+
{
|
|
912
|
+
files: ["**/*.d.ts"],
|
|
913
|
+
rules: {
|
|
914
|
+
"eslint-comments/no-unlimited-disable": OFF,
|
|
915
|
+
"import/no-duplicates": OFF,
|
|
916
|
+
"unused-imports/no-unused-vars": OFF
|
|
917
|
+
}
|
|
844
918
|
},
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
"
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
"@typescript-eslint/explicit-module-boundary-types": OFF,
|
|
858
|
-
"@typescript-eslint/naming-convention": OFF,
|
|
859
|
-
"@typescript-eslint/no-dupe-class-members": "error",
|
|
860
|
-
"@typescript-eslint/no-empty-function": OFF,
|
|
861
|
-
"@typescript-eslint/no-empty-interface": OFF,
|
|
862
|
-
"@typescript-eslint/no-explicit-any": OFF,
|
|
863
|
-
"@typescript-eslint/no-extra-parens": ["error", "functions"],
|
|
864
|
-
"@typescript-eslint/no-invalid-this": "error",
|
|
865
|
-
"@typescript-eslint/no-loss-of-precision": "error",
|
|
866
|
-
"@typescript-eslint/no-non-null-assertion": OFF,
|
|
867
|
-
"@typescript-eslint/no-redeclare": "error",
|
|
868
|
-
"@typescript-eslint/no-require-imports": "error",
|
|
869
|
-
"@typescript-eslint/no-unused-vars": OFF,
|
|
870
|
-
"@typescript-eslint/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
871
|
-
"@typescript-eslint/parameter-properties": OFF,
|
|
872
|
-
"@typescript-eslint/prefer-ts-expect-error": "error",
|
|
873
|
-
"@typescript-eslint/quotes": ["error", "single"],
|
|
874
|
-
"@typescript-eslint/semi": ["error", "never"],
|
|
875
|
-
"@typescript-eslint/triple-slash-reference": OFF,
|
|
876
|
-
"antfu/generic-spacing": "error",
|
|
877
|
-
"antfu/named-tuple-spacing": "error",
|
|
878
|
-
"antfu/no-cjs-exports": "error",
|
|
879
|
-
"antfu/no-const-enum": "error",
|
|
880
|
-
"antfu/no-ts-export-equal": "error",
|
|
881
|
-
"comma-dangle": OFF,
|
|
882
|
-
"no-dupe-class-members": OFF,
|
|
883
|
-
"no-extra-parens": OFF,
|
|
884
|
-
"no-invalid-this": OFF,
|
|
885
|
-
"no-loss-of-precision": OFF,
|
|
886
|
-
"no-redeclare": OFF,
|
|
887
|
-
"no-use-before-define": OFF,
|
|
888
|
-
"no-useless-constructor": OFF,
|
|
889
|
-
"quotes": OFF,
|
|
890
|
-
"semi": OFF
|
|
891
|
-
}
|
|
892
|
-
},
|
|
893
|
-
{
|
|
894
|
-
files: ["**/*.d.ts"],
|
|
895
|
-
rules: {
|
|
896
|
-
"eslint-comments/no-unlimited-disable": OFF,
|
|
897
|
-
"import/no-duplicates": OFF,
|
|
898
|
-
"unused-imports/no-unused-vars": OFF
|
|
899
|
-
}
|
|
900
|
-
},
|
|
901
|
-
{
|
|
902
|
-
files: ["**/*.{test,spec}.ts?(x)"],
|
|
903
|
-
rules: {
|
|
904
|
-
"no-unused-expressions": OFF
|
|
905
|
-
}
|
|
906
|
-
},
|
|
907
|
-
{
|
|
908
|
-
files: ["**/*.js", "**/*.cjs"],
|
|
909
|
-
rules: {
|
|
910
|
-
"@typescript-eslint/no-require-imports": OFF,
|
|
911
|
-
"@typescript-eslint/no-var-requires": OFF
|
|
919
|
+
{
|
|
920
|
+
files: ["**/*.{test,spec}.ts?(x)"],
|
|
921
|
+
rules: {
|
|
922
|
+
"no-unused-expressions": OFF
|
|
923
|
+
}
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
927
|
+
rules: {
|
|
928
|
+
"ts/no-require-imports": OFF,
|
|
929
|
+
"ts/no-var-requires": OFF
|
|
930
|
+
}
|
|
912
931
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
function typescriptWithLanguageServer({
|
|
916
|
-
|
|
917
|
-
|
|
932
|
+
];
|
|
933
|
+
}
|
|
934
|
+
function typescriptWithLanguageServer(options) {
|
|
935
|
+
const {
|
|
936
|
+
componentExts = [],
|
|
937
|
+
tsconfigPath,
|
|
938
|
+
tsconfigRootDir = process.cwd()
|
|
939
|
+
} = options;
|
|
918
940
|
return [
|
|
919
941
|
{
|
|
920
|
-
files:
|
|
942
|
+
files: [
|
|
943
|
+
GLOB_TS,
|
|
944
|
+
GLOB_TSX,
|
|
945
|
+
...componentExts.map((ext) => `**/*.${ext}`)
|
|
946
|
+
],
|
|
921
947
|
ignores: ["**/*.md/*.*"],
|
|
922
948
|
languageOptions: {
|
|
923
949
|
parser: default17,
|
|
924
950
|
parserOptions: {
|
|
925
|
-
project: [
|
|
926
|
-
tsconfigRootDir
|
|
951
|
+
project: [tsconfigPath],
|
|
952
|
+
tsconfigRootDir
|
|
927
953
|
}
|
|
928
954
|
},
|
|
929
955
|
plugins: {
|
|
930
|
-
|
|
956
|
+
ts: default11
|
|
931
957
|
},
|
|
932
958
|
rules: {
|
|
933
|
-
"@typescript-eslint/await-thenable": "error",
|
|
934
|
-
"@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
|
|
935
|
-
"@typescript-eslint/no-floating-promises": "error",
|
|
936
|
-
"@typescript-eslint/no-for-in-array": "error",
|
|
937
|
-
"@typescript-eslint/no-implied-eval": "error",
|
|
938
|
-
"@typescript-eslint/no-misused-promises": "error",
|
|
939
|
-
"@typescript-eslint/no-throw-literal": "error",
|
|
940
|
-
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
941
|
-
"@typescript-eslint/no-unsafe-argument": "error",
|
|
942
|
-
"@typescript-eslint/no-unsafe-assignment": "error",
|
|
943
|
-
"@typescript-eslint/no-unsafe-call": "error",
|
|
944
|
-
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
945
|
-
"@typescript-eslint/no-unsafe-return": "error",
|
|
946
|
-
"@typescript-eslint/require-await": "error",
|
|
947
|
-
"@typescript-eslint/restrict-plus-operands": "error",
|
|
948
|
-
"@typescript-eslint/restrict-template-expressions": "error",
|
|
949
|
-
"@typescript-eslint/unbound-method": "error",
|
|
950
959
|
"dot-notation": OFF,
|
|
951
960
|
"no-implied-eval": OFF,
|
|
952
961
|
"no-throw-literal": OFF,
|
|
953
|
-
"require-await": OFF
|
|
962
|
+
"require-await": OFF,
|
|
963
|
+
"ts/await-thenable": "error",
|
|
964
|
+
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
965
|
+
"ts/no-floating-promises": "error",
|
|
966
|
+
"ts/no-for-in-array": "error",
|
|
967
|
+
"ts/no-implied-eval": "error",
|
|
968
|
+
"ts/no-misused-promises": "error",
|
|
969
|
+
"ts/no-throw-literal": "error",
|
|
970
|
+
"ts/no-unnecessary-type-assertion": "error",
|
|
971
|
+
"ts/no-unsafe-argument": "error",
|
|
972
|
+
"ts/no-unsafe-assignment": "error",
|
|
973
|
+
"ts/no-unsafe-call": "error",
|
|
974
|
+
"ts/no-unsafe-member-access": "error",
|
|
975
|
+
"ts/no-unsafe-return": "error",
|
|
976
|
+
"ts/require-await": "error",
|
|
977
|
+
"ts/restrict-plus-operands": "error",
|
|
978
|
+
"ts/restrict-template-expressions": "error",
|
|
979
|
+
"ts/unbound-method": "error"
|
|
954
980
|
}
|
|
955
981
|
}
|
|
956
982
|
];
|
|
@@ -996,104 +1022,106 @@ var unicorn = [
|
|
|
996
1022
|
];
|
|
997
1023
|
|
|
998
1024
|
// src/configs/vue.ts
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
},
|
|
1013
|
-
plugins: {
|
|
1014
|
-
vue: default14
|
|
1015
|
-
},
|
|
1016
|
-
processor: default14.processors[".vue"],
|
|
1017
|
-
rules: {
|
|
1018
|
-
...default14.configs.base.rules,
|
|
1019
|
-
...default14.configs["vue3-essential"].rules,
|
|
1020
|
-
...default14.configs["vue3-strongly-recommended"].rules,
|
|
1021
|
-
...default14.configs["vue3-recommended"].rules,
|
|
1022
|
-
"vue/array-bracket-spacing": ["error", "never"],
|
|
1023
|
-
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1024
|
-
"vue/block-order": ["error", {
|
|
1025
|
-
order: ["script", "template", "style"]
|
|
1026
|
-
}],
|
|
1027
|
-
"vue/block-spacing": ["error", "always"],
|
|
1028
|
-
"vue/block-tag-newline": ["error", {
|
|
1029
|
-
multiline: "always",
|
|
1030
|
-
singleline: "always"
|
|
1031
|
-
}],
|
|
1032
|
-
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1033
|
-
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1034
|
-
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1035
|
-
"vue/comma-style": ["error", "last"],
|
|
1036
|
-
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1037
|
-
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1038
|
-
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1039
|
-
"vue/define-macros-order": ["error", {
|
|
1040
|
-
order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
|
|
1041
|
-
}],
|
|
1042
|
-
"vue/dot-location": ["error", "property"],
|
|
1043
|
-
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1044
|
-
"vue/eqeqeq": ["error", "smart"],
|
|
1045
|
-
"vue/html-comment-content-spacing": ["error", "always", {
|
|
1046
|
-
exceptions: ["-"]
|
|
1047
|
-
}],
|
|
1048
|
-
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1049
|
-
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1050
|
-
"vue/max-attributes-per-line": OFF,
|
|
1051
|
-
"vue/multi-word-component-names": OFF,
|
|
1052
|
-
"vue/no-constant-condition": "warn",
|
|
1053
|
-
"vue/no-dupe-keys": OFF,
|
|
1054
|
-
"vue/no-empty-pattern": "error",
|
|
1055
|
-
"vue/no-extra-parens": ["error", "functions"],
|
|
1056
|
-
"vue/no-irregular-whitespace": "error",
|
|
1057
|
-
"vue/no-loss-of-precision": "error",
|
|
1058
|
-
"vue/no-restricted-syntax": [
|
|
1059
|
-
"error",
|
|
1060
|
-
"DebuggerStatement",
|
|
1061
|
-
"LabeledStatement",
|
|
1062
|
-
"WithStatement"
|
|
1063
|
-
],
|
|
1064
|
-
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1065
|
-
// reactivity transform
|
|
1066
|
-
"vue/no-setup-props-reactivity-loss": OFF,
|
|
1067
|
-
"vue/no-sparse-arrays": "error",
|
|
1068
|
-
"vue/no-unused-refs": "error",
|
|
1069
|
-
"vue/no-useless-v-bind": "error",
|
|
1070
|
-
"vue/no-v-html": OFF,
|
|
1071
|
-
"vue/no-v-text-v-html-on-component": OFF,
|
|
1072
|
-
"vue/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
1073
|
-
"vue/object-curly-spacing": ["error", "always"],
|
|
1074
|
-
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1075
|
-
"vue/object-shorthand": [
|
|
1076
|
-
"error",
|
|
1077
|
-
"always",
|
|
1078
|
-
{
|
|
1079
|
-
avoidQuotes: true,
|
|
1080
|
-
ignoreConstructors: false
|
|
1025
|
+
function vue(options = {}) {
|
|
1026
|
+
return [
|
|
1027
|
+
{
|
|
1028
|
+
files: [GLOB_VUE],
|
|
1029
|
+
languageOptions: {
|
|
1030
|
+
parser: default18,
|
|
1031
|
+
parserOptions: {
|
|
1032
|
+
ecmaFeatures: {
|
|
1033
|
+
jsx: true
|
|
1034
|
+
},
|
|
1035
|
+
extraFileExtensions: [".vue"],
|
|
1036
|
+
parser: options.typescript ? default17 : null,
|
|
1037
|
+
sourceType: "module"
|
|
1081
1038
|
}
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1039
|
+
},
|
|
1040
|
+
plugins: {
|
|
1041
|
+
vue: default14
|
|
1042
|
+
},
|
|
1043
|
+
processor: default14.processors[".vue"],
|
|
1044
|
+
rules: {
|
|
1045
|
+
...default14.configs.base.rules,
|
|
1046
|
+
...default14.configs["vue3-essential"].rules,
|
|
1047
|
+
...default14.configs["vue3-strongly-recommended"].rules,
|
|
1048
|
+
...default14.configs["vue3-recommended"].rules,
|
|
1049
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
1050
|
+
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1051
|
+
"vue/block-order": ["error", {
|
|
1052
|
+
order: ["script", "template", "style"]
|
|
1053
|
+
}],
|
|
1054
|
+
"vue/block-spacing": ["error", "always"],
|
|
1055
|
+
"vue/block-tag-newline": ["error", {
|
|
1056
|
+
multiline: "always",
|
|
1057
|
+
singleline: "always"
|
|
1058
|
+
}],
|
|
1059
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1060
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1061
|
+
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1062
|
+
"vue/comma-style": ["error", "last"],
|
|
1063
|
+
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1064
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1065
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1066
|
+
"vue/define-macros-order": ["error", {
|
|
1067
|
+
order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
|
|
1068
|
+
}],
|
|
1069
|
+
"vue/dot-location": ["error", "property"],
|
|
1070
|
+
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1071
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
1072
|
+
"vue/html-comment-content-spacing": ["error", "always", {
|
|
1073
|
+
exceptions: ["-"]
|
|
1074
|
+
}],
|
|
1075
|
+
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1076
|
+
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1077
|
+
"vue/max-attributes-per-line": OFF,
|
|
1078
|
+
"vue/multi-word-component-names": OFF,
|
|
1079
|
+
"vue/no-constant-condition": "warn",
|
|
1080
|
+
"vue/no-dupe-keys": OFF,
|
|
1081
|
+
"vue/no-empty-pattern": "error",
|
|
1082
|
+
"vue/no-extra-parens": ["error", "functions"],
|
|
1083
|
+
"vue/no-irregular-whitespace": "error",
|
|
1084
|
+
"vue/no-loss-of-precision": "error",
|
|
1085
|
+
"vue/no-restricted-syntax": [
|
|
1086
|
+
"error",
|
|
1087
|
+
"DebuggerStatement",
|
|
1088
|
+
"LabeledStatement",
|
|
1089
|
+
"WithStatement"
|
|
1090
|
+
],
|
|
1091
|
+
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1092
|
+
// reactivity transform
|
|
1093
|
+
"vue/no-setup-props-reactivity-loss": OFF,
|
|
1094
|
+
"vue/no-sparse-arrays": "error",
|
|
1095
|
+
"vue/no-unused-refs": "error",
|
|
1096
|
+
"vue/no-useless-v-bind": "error",
|
|
1097
|
+
"vue/no-v-html": OFF,
|
|
1098
|
+
"vue/no-v-text-v-html-on-component": OFF,
|
|
1099
|
+
"vue/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
1100
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
1101
|
+
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1102
|
+
"vue/object-shorthand": [
|
|
1103
|
+
"error",
|
|
1104
|
+
"always",
|
|
1105
|
+
{
|
|
1106
|
+
avoidQuotes: true,
|
|
1107
|
+
ignoreConstructors: false
|
|
1108
|
+
}
|
|
1109
|
+
],
|
|
1110
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
1111
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1112
|
+
"vue/prefer-separate-static-class": "error",
|
|
1113
|
+
"vue/prefer-template": "error",
|
|
1114
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1115
|
+
"vue/require-default-prop": OFF,
|
|
1116
|
+
"vue/require-prop-types": OFF,
|
|
1117
|
+
"vue/space-in-parens": ["error", "never"],
|
|
1118
|
+
"vue/space-infix-ops": "error",
|
|
1119
|
+
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1120
|
+
"vue/template-curly-spacing": "error"
|
|
1121
|
+
}
|
|
1094
1122
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1123
|
+
];
|
|
1124
|
+
}
|
|
1097
1125
|
|
|
1098
1126
|
// src/configs/yml.ts
|
|
1099
1127
|
var yml = [
|
|
@@ -1107,7 +1135,7 @@ var yml = [
|
|
|
1107
1135
|
},
|
|
1108
1136
|
rules: {
|
|
1109
1137
|
...default15.configs.standard.rules,
|
|
1110
|
-
"
|
|
1138
|
+
"style/spaced-comment": OFF,
|
|
1111
1139
|
"yml/no-empty-document": OFF,
|
|
1112
1140
|
"yml/no-empty-mapping-value": OFF,
|
|
1113
1141
|
"yml/quotes": ["error", { avoidEscape: false, prefer: "single" }]
|
|
@@ -1116,91 +1144,81 @@ var yml = [
|
|
|
1116
1144
|
];
|
|
1117
1145
|
|
|
1118
1146
|
// src/configs/test.ts
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1147
|
+
function test(options = {}) {
|
|
1148
|
+
return [
|
|
1149
|
+
{
|
|
1150
|
+
files: GLOB_TESTS,
|
|
1151
|
+
plugins: {
|
|
1152
|
+
"no-only-tests": default16
|
|
1153
|
+
},
|
|
1154
|
+
rules: {
|
|
1155
|
+
"no-only-tests/no-only-tests": options.isInEditor ? OFF : "error"
|
|
1156
|
+
}
|
|
1127
1157
|
}
|
|
1128
|
-
|
|
1129
|
-
|
|
1158
|
+
];
|
|
1159
|
+
}
|
|
1130
1160
|
|
|
1131
|
-
// src/
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
];
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1161
|
+
// src/factory.ts
|
|
1162
|
+
function antfu(options = {}, ...userConfigs) {
|
|
1163
|
+
const isInEditor = options.isInEditor ?? !!((process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE) && !process2.env.CI);
|
|
1164
|
+
const enableVue = options.vue ?? (isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli"));
|
|
1165
|
+
const enableTypeScript = options.typescript ?? isPackageExists("typescript");
|
|
1166
|
+
const enableStylistic = options.stylistic ?? true;
|
|
1167
|
+
const configs = [
|
|
1168
|
+
ignores,
|
|
1169
|
+
javascript({ isInEditor }),
|
|
1170
|
+
comments,
|
|
1171
|
+
node,
|
|
1172
|
+
jsdoc,
|
|
1173
|
+
imports,
|
|
1174
|
+
unicorn
|
|
1175
|
+
];
|
|
1176
|
+
const componentExts = [];
|
|
1177
|
+
if (enableVue)
|
|
1178
|
+
componentExts.push("vue");
|
|
1179
|
+
if (enableStylistic)
|
|
1180
|
+
configs.push(javascriptStylistic);
|
|
1181
|
+
if (enableTypeScript) {
|
|
1182
|
+
configs.push(typescript({ componentExts }));
|
|
1183
|
+
if (typeof enableTypeScript !== "boolean") {
|
|
1184
|
+
configs.push(typescriptWithLanguageServer({
|
|
1185
|
+
...enableTypeScript,
|
|
1186
|
+
componentExts
|
|
1187
|
+
}));
|
|
1188
|
+
}
|
|
1189
|
+
if (enableStylistic)
|
|
1190
|
+
configs.push(typescriptStylistic);
|
|
1191
|
+
}
|
|
1192
|
+
if (options.test ?? true)
|
|
1193
|
+
configs.push(test({ isInEditor }));
|
|
1194
|
+
if (enableVue)
|
|
1195
|
+
configs.push(vue({ typescript: !!enableTypeScript }));
|
|
1196
|
+
if (options.jsonc ?? true) {
|
|
1197
|
+
configs.push(
|
|
1198
|
+
jsonc,
|
|
1199
|
+
sortPackageJson,
|
|
1200
|
+
sortTsconfig
|
|
1201
|
+
);
|
|
1202
|
+
}
|
|
1203
|
+
if (options.yaml ?? true)
|
|
1204
|
+
configs.push(yml);
|
|
1205
|
+
if (options.markdown ?? true)
|
|
1206
|
+
configs.push(markdown({ componentExts }));
|
|
1207
|
+
return combine(
|
|
1208
|
+
...configs,
|
|
1209
|
+
...userConfigs
|
|
1210
|
+
);
|
|
1211
|
+
}
|
|
1170
1212
|
|
|
1171
1213
|
// src/index.ts
|
|
1172
|
-
var src_default =
|
|
1214
|
+
var src_default = antfu;
|
|
1173
1215
|
export {
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
GLOB_DIST,
|
|
1177
|
-
GLOB_EXCLUDE,
|
|
1178
|
-
GLOB_HTML,
|
|
1179
|
-
GLOB_JS,
|
|
1180
|
-
GLOB_JSON,
|
|
1181
|
-
GLOB_JSON5,
|
|
1182
|
-
GLOB_JSONC,
|
|
1183
|
-
GLOB_JSX,
|
|
1184
|
-
GLOB_LESS,
|
|
1185
|
-
GLOB_LOCKFILE,
|
|
1186
|
-
GLOB_MARKDOWN,
|
|
1187
|
-
GLOB_NODE_MODULES,
|
|
1188
|
-
GLOB_SCSS,
|
|
1189
|
-
GLOB_SRC,
|
|
1190
|
-
GLOB_SRC_EXT,
|
|
1191
|
-
GLOB_STYLE,
|
|
1192
|
-
GLOB_TESTS,
|
|
1193
|
-
GLOB_TS,
|
|
1194
|
-
GLOB_TSX,
|
|
1195
|
-
GLOB_VUE,
|
|
1196
|
-
GLOB_YAML,
|
|
1216
|
+
antfu,
|
|
1217
|
+
combine,
|
|
1197
1218
|
comments,
|
|
1198
1219
|
src_default as default,
|
|
1199
|
-
hasTypeScript,
|
|
1200
|
-
hasVue,
|
|
1201
1220
|
ignores,
|
|
1202
1221
|
imports,
|
|
1203
|
-
isInEditor,
|
|
1204
1222
|
javascript,
|
|
1205
1223
|
javascriptStylistic,
|
|
1206
1224
|
jsdoc,
|
|
@@ -1226,11 +1244,7 @@ export {
|
|
|
1226
1244
|
default13 as pluginUnusedImports,
|
|
1227
1245
|
default14 as pluginVue,
|
|
1228
1246
|
default15 as pluginYml,
|
|
1229
|
-
|
|
1230
|
-
presetAuto,
|
|
1231
|
-
presetJavaScript,
|
|
1232
|
-
presetLangsExtensions,
|
|
1233
|
-
presetTypeScript,
|
|
1247
|
+
renameRules,
|
|
1234
1248
|
sortPackageJson,
|
|
1235
1249
|
sortTsconfig,
|
|
1236
1250
|
test,
|