@antfu/eslint-config 3.2.2 → 3.3.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/cli.cjs +79 -77
- package/dist/cli.js +79 -77
- package/dist/index.cjs +118 -110
- package/dist/index.d.cts +128 -128
- package/dist/index.d.ts +128 -128
- package/dist/index.js +130 -122
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,128 +1,9 @@
|
|
|
1
1
|
import { FlatConfigComposer } from 'eslint-flat-config-utils';
|
|
2
2
|
import { Linter } from 'eslint';
|
|
3
|
-
import {
|
|
3
|
+
import { StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
|
|
4
4
|
import { ParserOptions } from '@typescript-eslint/parser';
|
|
5
|
+
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
5
6
|
import { Options } from 'eslint-processor-vue-blocks';
|
|
6
|
-
import { StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Vendor types from Prettier so we don't rely on the dependency.
|
|
10
|
-
*/
|
|
11
|
-
type VendoredPrettierOptions = Partial<VendoredPrettierOptionsRequired>;
|
|
12
|
-
interface VendoredPrettierOptionsRequired {
|
|
13
|
-
/**
|
|
14
|
-
* Specify the line length that the printer will wrap on.
|
|
15
|
-
* @default 120
|
|
16
|
-
*/
|
|
17
|
-
printWidth: number;
|
|
18
|
-
/**
|
|
19
|
-
* Specify the number of spaces per indentation-level.
|
|
20
|
-
*/
|
|
21
|
-
tabWidth: number;
|
|
22
|
-
/**
|
|
23
|
-
* Indent lines with tabs instead of spaces
|
|
24
|
-
*/
|
|
25
|
-
useTabs?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Print semicolons at the ends of statements.
|
|
28
|
-
*/
|
|
29
|
-
semi: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Use single quotes instead of double quotes.
|
|
32
|
-
*/
|
|
33
|
-
singleQuote: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Use single quotes in JSX.
|
|
36
|
-
*/
|
|
37
|
-
jsxSingleQuote: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Print trailing commas wherever possible.
|
|
40
|
-
*/
|
|
41
|
-
trailingComma: 'none' | 'es5' | 'all';
|
|
42
|
-
/**
|
|
43
|
-
* Print spaces between brackets in object literals.
|
|
44
|
-
*/
|
|
45
|
-
bracketSpacing: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Put the `>` of a multi-line HTML (HTML, XML, JSX, Vue, Angular) element at the end of the last line instead of being
|
|
48
|
-
* alone on the next line (does not apply to self closing elements).
|
|
49
|
-
*/
|
|
50
|
-
bracketSameLine: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
|
|
53
|
-
* @deprecated use bracketSameLine instead
|
|
54
|
-
*/
|
|
55
|
-
jsxBracketSameLine: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Format only a segment of a file.
|
|
58
|
-
*/
|
|
59
|
-
rangeStart: number;
|
|
60
|
-
/**
|
|
61
|
-
* Format only a segment of a file.
|
|
62
|
-
* @default Number.POSITIVE_INFINITY
|
|
63
|
-
*/
|
|
64
|
-
rangeEnd: number;
|
|
65
|
-
/**
|
|
66
|
-
* By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
|
|
67
|
-
* In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
|
|
68
|
-
* @default "preserve"
|
|
69
|
-
*/
|
|
70
|
-
proseWrap: 'always' | 'never' | 'preserve';
|
|
71
|
-
/**
|
|
72
|
-
* Include parentheses around a sole arrow function parameter.
|
|
73
|
-
* @default "always"
|
|
74
|
-
*/
|
|
75
|
-
arrowParens: 'avoid' | 'always';
|
|
76
|
-
/**
|
|
77
|
-
* Provide ability to support new languages to prettier.
|
|
78
|
-
*/
|
|
79
|
-
plugins: Array<string | any>;
|
|
80
|
-
/**
|
|
81
|
-
* How to handle whitespaces in HTML.
|
|
82
|
-
* @default "css"
|
|
83
|
-
*/
|
|
84
|
-
htmlWhitespaceSensitivity: 'css' | 'strict' | 'ignore';
|
|
85
|
-
/**
|
|
86
|
-
* Which end of line characters to apply.
|
|
87
|
-
* @default "lf"
|
|
88
|
-
*/
|
|
89
|
-
endOfLine: 'auto' | 'lf' | 'crlf' | 'cr';
|
|
90
|
-
/**
|
|
91
|
-
* Change when properties in objects are quoted.
|
|
92
|
-
* @default "as-needed"
|
|
93
|
-
*/
|
|
94
|
-
quoteProps: 'as-needed' | 'consistent' | 'preserve';
|
|
95
|
-
/**
|
|
96
|
-
* Whether or not to indent the code inside <script> and <style> tags in Vue files.
|
|
97
|
-
* @default false
|
|
98
|
-
*/
|
|
99
|
-
vueIndentScriptAndStyle: boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Enforce single attribute per line in HTML, XML, Vue and JSX.
|
|
102
|
-
* @default false
|
|
103
|
-
*/
|
|
104
|
-
singleAttributePerLine: boolean;
|
|
105
|
-
/**
|
|
106
|
-
* How to handle whitespaces in XML.
|
|
107
|
-
* @default "preserve"
|
|
108
|
-
*/
|
|
109
|
-
xmlQuoteAttributes: 'single' | 'double' | 'preserve';
|
|
110
|
-
/**
|
|
111
|
-
* Whether to put a space inside the brackets of self-closing XML elements.
|
|
112
|
-
* @default true
|
|
113
|
-
*/
|
|
114
|
-
xmlSelfClosingSpace: boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Whether to sort attributes by key in XML elements.
|
|
117
|
-
* @default false
|
|
118
|
-
*/
|
|
119
|
-
xmlSortAttributesByKey: boolean;
|
|
120
|
-
/**
|
|
121
|
-
* How to handle whitespaces in XML.
|
|
122
|
-
* @default "ignore"
|
|
123
|
-
*/
|
|
124
|
-
xmlWhitespaceSensitivity: 'ignore' | 'strict' | 'preserve';
|
|
125
|
-
}
|
|
126
7
|
|
|
127
8
|
/* eslint-disable */
|
|
128
9
|
/* prettier-ignore */
|
|
@@ -15208,6 +15089,125 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
|
|
|
15208
15089
|
// Names of all the configs
|
|
15209
15090
|
type ConfigNames = 'antfu/astro/setup' | 'antfu/astro/rules' | 'antfu/eslint-comments/rules' | 'antfu/formatter/setup' | 'antfu/imports/rules' | 'antfu/javascript/setup' | 'antfu/javascript/rules' | 'antfu/jsx/setup' | 'antfu/jsdoc/rules' | 'antfu/jsonc/setup' | 'antfu/jsonc/rules' | 'antfu/markdown/setup' | 'antfu/markdown/processor' | 'antfu/markdown/parser' | 'antfu/markdown/disables' | 'antfu/node/rules' | 'antfu/perfectionist/setup' | 'antfu/react/setup' | 'antfu/react/rules' | 'antfu/solid/setup' | 'antfu/solid/rules' | 'antfu/sort/package-json' | 'antfu/stylistic/rules' | 'antfu/svelte/setup' | 'antfu/svelte/rules' | 'antfu/test/setup' | 'antfu/test/rules' | 'antfu/toml/setup' | 'antfu/toml/rules' | 'antfu/regexp/rules' | 'antfu/typescript/setup' | 'antfu/typescript/parser' | 'antfu/typescript/rules' | 'antfu/unicorn/rules' | 'antfu/unocss' | 'antfu/vue/setup' | 'antfu/vue/rules' | 'antfu/yaml/setup' | 'antfu/yaml/rules'
|
|
15210
15091
|
|
|
15092
|
+
/**
|
|
15093
|
+
* Vendor types from Prettier so we don't rely on the dependency.
|
|
15094
|
+
*/
|
|
15095
|
+
type VendoredPrettierOptions = Partial<VendoredPrettierOptionsRequired>;
|
|
15096
|
+
interface VendoredPrettierOptionsRequired {
|
|
15097
|
+
/**
|
|
15098
|
+
* Specify the line length that the printer will wrap on.
|
|
15099
|
+
* @default 120
|
|
15100
|
+
*/
|
|
15101
|
+
printWidth: number;
|
|
15102
|
+
/**
|
|
15103
|
+
* Specify the number of spaces per indentation-level.
|
|
15104
|
+
*/
|
|
15105
|
+
tabWidth: number;
|
|
15106
|
+
/**
|
|
15107
|
+
* Indent lines with tabs instead of spaces
|
|
15108
|
+
*/
|
|
15109
|
+
useTabs?: boolean;
|
|
15110
|
+
/**
|
|
15111
|
+
* Print semicolons at the ends of statements.
|
|
15112
|
+
*/
|
|
15113
|
+
semi: boolean;
|
|
15114
|
+
/**
|
|
15115
|
+
* Use single quotes instead of double quotes.
|
|
15116
|
+
*/
|
|
15117
|
+
singleQuote: boolean;
|
|
15118
|
+
/**
|
|
15119
|
+
* Use single quotes in JSX.
|
|
15120
|
+
*/
|
|
15121
|
+
jsxSingleQuote: boolean;
|
|
15122
|
+
/**
|
|
15123
|
+
* Print trailing commas wherever possible.
|
|
15124
|
+
*/
|
|
15125
|
+
trailingComma: 'none' | 'es5' | 'all';
|
|
15126
|
+
/**
|
|
15127
|
+
* Print spaces between brackets in object literals.
|
|
15128
|
+
*/
|
|
15129
|
+
bracketSpacing: boolean;
|
|
15130
|
+
/**
|
|
15131
|
+
* Put the `>` of a multi-line HTML (HTML, XML, JSX, Vue, Angular) element at the end of the last line instead of being
|
|
15132
|
+
* alone on the next line (does not apply to self closing elements).
|
|
15133
|
+
*/
|
|
15134
|
+
bracketSameLine: boolean;
|
|
15135
|
+
/**
|
|
15136
|
+
* Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
|
|
15137
|
+
* @deprecated use bracketSameLine instead
|
|
15138
|
+
*/
|
|
15139
|
+
jsxBracketSameLine: boolean;
|
|
15140
|
+
/**
|
|
15141
|
+
* Format only a segment of a file.
|
|
15142
|
+
*/
|
|
15143
|
+
rangeStart: number;
|
|
15144
|
+
/**
|
|
15145
|
+
* Format only a segment of a file.
|
|
15146
|
+
* @default Number.POSITIVE_INFINITY
|
|
15147
|
+
*/
|
|
15148
|
+
rangeEnd: number;
|
|
15149
|
+
/**
|
|
15150
|
+
* By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
|
|
15151
|
+
* In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
|
|
15152
|
+
* @default "preserve"
|
|
15153
|
+
*/
|
|
15154
|
+
proseWrap: 'always' | 'never' | 'preserve';
|
|
15155
|
+
/**
|
|
15156
|
+
* Include parentheses around a sole arrow function parameter.
|
|
15157
|
+
* @default "always"
|
|
15158
|
+
*/
|
|
15159
|
+
arrowParens: 'avoid' | 'always';
|
|
15160
|
+
/**
|
|
15161
|
+
* Provide ability to support new languages to prettier.
|
|
15162
|
+
*/
|
|
15163
|
+
plugins: Array<string | any>;
|
|
15164
|
+
/**
|
|
15165
|
+
* How to handle whitespaces in HTML.
|
|
15166
|
+
* @default "css"
|
|
15167
|
+
*/
|
|
15168
|
+
htmlWhitespaceSensitivity: 'css' | 'strict' | 'ignore';
|
|
15169
|
+
/**
|
|
15170
|
+
* Which end of line characters to apply.
|
|
15171
|
+
* @default "lf"
|
|
15172
|
+
*/
|
|
15173
|
+
endOfLine: 'auto' | 'lf' | 'crlf' | 'cr';
|
|
15174
|
+
/**
|
|
15175
|
+
* Change when properties in objects are quoted.
|
|
15176
|
+
* @default "as-needed"
|
|
15177
|
+
*/
|
|
15178
|
+
quoteProps: 'as-needed' | 'consistent' | 'preserve';
|
|
15179
|
+
/**
|
|
15180
|
+
* Whether or not to indent the code inside <script> and <style> tags in Vue files.
|
|
15181
|
+
* @default false
|
|
15182
|
+
*/
|
|
15183
|
+
vueIndentScriptAndStyle: boolean;
|
|
15184
|
+
/**
|
|
15185
|
+
* Enforce single attribute per line in HTML, XML, Vue and JSX.
|
|
15186
|
+
* @default false
|
|
15187
|
+
*/
|
|
15188
|
+
singleAttributePerLine: boolean;
|
|
15189
|
+
/**
|
|
15190
|
+
* How to handle whitespaces in XML.
|
|
15191
|
+
* @default "preserve"
|
|
15192
|
+
*/
|
|
15193
|
+
xmlQuoteAttributes: 'single' | 'double' | 'preserve';
|
|
15194
|
+
/**
|
|
15195
|
+
* Whether to put a space inside the brackets of self-closing XML elements.
|
|
15196
|
+
* @default true
|
|
15197
|
+
*/
|
|
15198
|
+
xmlSelfClosingSpace: boolean;
|
|
15199
|
+
/**
|
|
15200
|
+
* Whether to sort attributes by key in XML elements.
|
|
15201
|
+
* @default false
|
|
15202
|
+
*/
|
|
15203
|
+
xmlSortAttributesByKey: boolean;
|
|
15204
|
+
/**
|
|
15205
|
+
* How to handle whitespaces in XML.
|
|
15206
|
+
* @default "ignore"
|
|
15207
|
+
*/
|
|
15208
|
+
xmlWhitespaceSensitivity: 'ignore' | 'strict' | 'preserve';
|
|
15209
|
+
}
|
|
15210
|
+
|
|
15211
15211
|
type Awaitable<T> = T | Promise<T>;
|
|
15212
15212
|
type Rules = RuleOptions;
|
|
15213
15213
|
|
|
@@ -15612,6 +15612,8 @@ declare function command(): Promise<TypedFlatConfigItem[]>;
|
|
|
15612
15612
|
|
|
15613
15613
|
declare function comments(): Promise<TypedFlatConfigItem[]>;
|
|
15614
15614
|
|
|
15615
|
+
declare function disables(): Promise<TypedFlatConfigItem[]>;
|
|
15616
|
+
|
|
15615
15617
|
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<TypedFlatConfigItem[]>;
|
|
15616
15618
|
|
|
15617
15619
|
declare function ignores(userIgnores?: string[]): Promise<TypedFlatConfigItem[]>;
|
|
@@ -15622,16 +15624,16 @@ declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Pro
|
|
|
15622
15624
|
|
|
15623
15625
|
declare function jsdoc(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
15624
15626
|
|
|
15625
|
-
declare function jsx(): Promise<TypedFlatConfigItem[]>;
|
|
15626
|
-
|
|
15627
15627
|
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
15628
15628
|
|
|
15629
|
+
declare function jsx(): Promise<TypedFlatConfigItem[]>;
|
|
15630
|
+
|
|
15629
15631
|
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
15630
15632
|
|
|
15631
15633
|
declare function node(): Promise<TypedFlatConfigItem[]>;
|
|
15632
15634
|
|
|
15633
15635
|
/**
|
|
15634
|
-
*
|
|
15636
|
+
* Perfectionist plugin for props and items sorting.
|
|
15635
15637
|
*
|
|
15636
15638
|
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
15637
15639
|
*/
|
|
@@ -15639,6 +15641,8 @@ declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
|
|
|
15639
15641
|
|
|
15640
15642
|
declare function react(options?: OptionsTypeScriptWithTypes & OptionsOverrides & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
15641
15643
|
|
|
15644
|
+
declare function regexp(options?: OptionsRegExp & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
15645
|
+
|
|
15642
15646
|
declare function solid(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles & OptionsTypeScriptWithTypes): Promise<TypedFlatConfigItem[]>;
|
|
15643
15647
|
|
|
15644
15648
|
/**
|
|
@@ -15676,10 +15680,6 @@ declare function vue(options?: OptionsVue & OptionsHasTypeScript & OptionsOverri
|
|
|
15676
15680
|
|
|
15677
15681
|
declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
15678
15682
|
|
|
15679
|
-
declare function regexp(options?: OptionsRegExp & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
15680
|
-
|
|
15681
|
-
declare function disables(): Promise<TypedFlatConfigItem[]>;
|
|
15682
|
-
|
|
15683
15683
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
15684
15684
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
15685
15685
|
declare const GLOB_JS = "**/*.?([cm])js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/factory.ts
|
|
2
|
-
import { isPackageExists as isPackageExists4 } from "local-pkg";
|
|
3
2
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
3
|
+
import { isPackageExists as isPackageExists4 } from "local-pkg";
|
|
4
4
|
|
|
5
5
|
// src/globs.ts
|
|
6
6
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -247,13 +247,13 @@ async function command() {
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
// src/plugins.ts
|
|
250
|
-
import { default as default2 } from "eslint-plugin-
|
|
251
|
-
import { default as default3 } from "
|
|
250
|
+
import { default as default2 } from "@eslint-community/eslint-plugin-eslint-comments";
|
|
251
|
+
import { default as default3 } from "eslint-plugin-antfu";
|
|
252
252
|
import * as pluginImport from "eslint-plugin-import-x";
|
|
253
253
|
import { default as default4 } from "eslint-plugin-n";
|
|
254
|
-
import { default as default5 } from "eslint-plugin-
|
|
255
|
-
import { default as default6 } from "eslint-plugin-
|
|
256
|
-
import { default as default7 } from "eslint-plugin-
|
|
254
|
+
import { default as default5 } from "eslint-plugin-perfectionist";
|
|
255
|
+
import { default as default6 } from "eslint-plugin-unicorn";
|
|
256
|
+
import { default as default7 } from "eslint-plugin-unused-imports";
|
|
257
257
|
|
|
258
258
|
// src/configs/comments.ts
|
|
259
259
|
async function comments() {
|
|
@@ -261,7 +261,7 @@ async function comments() {
|
|
|
261
261
|
{
|
|
262
262
|
name: "antfu/eslint-comments/rules",
|
|
263
263
|
plugins: {
|
|
264
|
-
"eslint-comments":
|
|
264
|
+
"eslint-comments": default2
|
|
265
265
|
},
|
|
266
266
|
rules: {
|
|
267
267
|
"eslint-comments/no-aggregating-enable": "error",
|
|
@@ -273,6 +273,60 @@ async function comments() {
|
|
|
273
273
|
];
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
+
// src/configs/disables.ts
|
|
277
|
+
async function disables() {
|
|
278
|
+
return [
|
|
279
|
+
{
|
|
280
|
+
files: [`scripts/${GLOB_SRC}`],
|
|
281
|
+
name: "antfu/disables/scripts",
|
|
282
|
+
rules: {
|
|
283
|
+
"no-console": "off",
|
|
284
|
+
"ts/explicit-function-return-type": "off",
|
|
285
|
+
"unicorn/consistent-function-scoping": "off"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
files: [`cli/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
290
|
+
name: "antfu/disables/cli",
|
|
291
|
+
rules: {
|
|
292
|
+
"no-console": "off"
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
297
|
+
name: "antfu/disables/bin",
|
|
298
|
+
rules: {
|
|
299
|
+
"antfu/no-import-dist": "off",
|
|
300
|
+
"antfu/no-import-node-modules-by-path": "off"
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
files: ["**/*.d.?([cm])ts"],
|
|
305
|
+
name: "antfu/disables/dts",
|
|
306
|
+
rules: {
|
|
307
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
308
|
+
"import/no-duplicates": "off",
|
|
309
|
+
"no-restricted-syntax": "off",
|
|
310
|
+
"unused-imports/no-unused-vars": "off"
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
files: ["**/*.{test,spec}.([tj])s?(x)"],
|
|
315
|
+
name: "antfu/disables/test",
|
|
316
|
+
rules: {
|
|
317
|
+
"no-unused-expressions": "off"
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
322
|
+
name: "antfu/disables/cjs",
|
|
323
|
+
rules: {
|
|
324
|
+
"ts/no-require-imports": "off"
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
];
|
|
328
|
+
}
|
|
329
|
+
|
|
276
330
|
// src/configs/formatters.ts
|
|
277
331
|
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
278
332
|
|
|
@@ -308,7 +362,7 @@ async function stylistic(options = {}) {
|
|
|
308
362
|
{
|
|
309
363
|
name: "antfu/stylistic/rules",
|
|
310
364
|
plugins: {
|
|
311
|
-
antfu:
|
|
365
|
+
antfu: default3,
|
|
312
366
|
style: pluginStylistic
|
|
313
367
|
},
|
|
314
368
|
rules: {
|
|
@@ -632,7 +686,7 @@ async function imports(options = {}) {
|
|
|
632
686
|
{
|
|
633
687
|
name: "antfu/imports/rules",
|
|
634
688
|
plugins: {
|
|
635
|
-
antfu:
|
|
689
|
+
antfu: default3,
|
|
636
690
|
import: pluginImport
|
|
637
691
|
},
|
|
638
692
|
rules: {
|
|
@@ -645,7 +699,6 @@ async function imports(options = {}) {
|
|
|
645
699
|
"import/no-named-default": "error",
|
|
646
700
|
"import/no-self-import": "error",
|
|
647
701
|
"import/no-webpack-loader-syntax": "error",
|
|
648
|
-
"import/order": "error",
|
|
649
702
|
...stylistic2 ? {
|
|
650
703
|
"import/newline-after-import": ["error", { count: 1 }]
|
|
651
704
|
} : {}
|
|
@@ -690,8 +743,8 @@ async function javascript(options = {}) {
|
|
|
690
743
|
{
|
|
691
744
|
name: "antfu/javascript/rules",
|
|
692
745
|
plugins: {
|
|
693
|
-
"antfu":
|
|
694
|
-
"unused-imports":
|
|
746
|
+
"antfu": default3,
|
|
747
|
+
"unused-imports": default7
|
|
695
748
|
},
|
|
696
749
|
rules: {
|
|
697
750
|
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
@@ -836,16 +889,6 @@ async function javascript(options = {}) {
|
|
|
836
889
|
"prefer-rest-params": "error",
|
|
837
890
|
"prefer-spread": "error",
|
|
838
891
|
"prefer-template": "error",
|
|
839
|
-
"sort-imports": [
|
|
840
|
-
"error",
|
|
841
|
-
{
|
|
842
|
-
allowSeparatedGroups: false,
|
|
843
|
-
ignoreCase: false,
|
|
844
|
-
ignoreDeclarationSort: true,
|
|
845
|
-
ignoreMemberSort: false,
|
|
846
|
-
memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
|
|
847
|
-
}
|
|
848
|
-
],
|
|
849
892
|
"symbol-description": "error",
|
|
850
893
|
"unicode-bom": ["error", "never"],
|
|
851
894
|
"unused-imports/no-unused-imports": isInEditor ? "off" : "error",
|
|
@@ -905,23 +948,6 @@ async function jsdoc(options = {}) {
|
|
|
905
948
|
];
|
|
906
949
|
}
|
|
907
950
|
|
|
908
|
-
// src/configs/jsx.ts
|
|
909
|
-
async function jsx() {
|
|
910
|
-
return [
|
|
911
|
-
{
|
|
912
|
-
files: [GLOB_JSX, GLOB_TSX],
|
|
913
|
-
languageOptions: {
|
|
914
|
-
parserOptions: {
|
|
915
|
-
ecmaFeatures: {
|
|
916
|
-
jsx: true
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
},
|
|
920
|
-
name: "antfu/jsx/setup"
|
|
921
|
-
}
|
|
922
|
-
];
|
|
923
|
-
}
|
|
924
|
-
|
|
925
951
|
// src/configs/jsonc.ts
|
|
926
952
|
async function jsonc(options = {}) {
|
|
927
953
|
const {
|
|
@@ -997,6 +1023,23 @@ async function jsonc(options = {}) {
|
|
|
997
1023
|
];
|
|
998
1024
|
}
|
|
999
1025
|
|
|
1026
|
+
// src/configs/jsx.ts
|
|
1027
|
+
async function jsx() {
|
|
1028
|
+
return [
|
|
1029
|
+
{
|
|
1030
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
1031
|
+
languageOptions: {
|
|
1032
|
+
parserOptions: {
|
|
1033
|
+
ecmaFeatures: {
|
|
1034
|
+
jsx: true
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
},
|
|
1038
|
+
name: "antfu/jsx/setup"
|
|
1039
|
+
}
|
|
1040
|
+
];
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1000
1043
|
// src/configs/markdown.ts
|
|
1001
1044
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
1002
1045
|
async function markdown(options = {}) {
|
|
@@ -1103,7 +1146,26 @@ async function perfectionist() {
|
|
|
1103
1146
|
{
|
|
1104
1147
|
name: "antfu/perfectionist/setup",
|
|
1105
1148
|
plugins: {
|
|
1106
|
-
perfectionist:
|
|
1149
|
+
perfectionist: default5
|
|
1150
|
+
},
|
|
1151
|
+
rules: {
|
|
1152
|
+
"perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
|
|
1153
|
+
"perfectionist/sort-imports": ["error", {
|
|
1154
|
+
groups: [
|
|
1155
|
+
"builtin",
|
|
1156
|
+
"external",
|
|
1157
|
+
"type",
|
|
1158
|
+
["internal", "internal-type"],
|
|
1159
|
+
["parent", "sibling", "index"],
|
|
1160
|
+
["parent-type", "sibling-type", "index-type"],
|
|
1161
|
+
"object",
|
|
1162
|
+
"unknown"
|
|
1163
|
+
],
|
|
1164
|
+
order: "asc",
|
|
1165
|
+
type: "natural"
|
|
1166
|
+
}],
|
|
1167
|
+
"perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
|
|
1168
|
+
"perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
|
|
1107
1169
|
}
|
|
1108
1170
|
}
|
|
1109
1171
|
];
|
|
@@ -1262,6 +1324,31 @@ async function react(options = {}) {
|
|
|
1262
1324
|
];
|
|
1263
1325
|
}
|
|
1264
1326
|
|
|
1327
|
+
// src/configs/regexp.ts
|
|
1328
|
+
import { configs } from "eslint-plugin-regexp";
|
|
1329
|
+
async function regexp(options = {}) {
|
|
1330
|
+
const config = configs["flat/recommended"];
|
|
1331
|
+
const rules = {
|
|
1332
|
+
...config.rules
|
|
1333
|
+
};
|
|
1334
|
+
if (options.level === "warn") {
|
|
1335
|
+
for (const key in rules) {
|
|
1336
|
+
if (rules[key] === "error")
|
|
1337
|
+
rules[key] = "warn";
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
return [
|
|
1341
|
+
{
|
|
1342
|
+
...config,
|
|
1343
|
+
name: "antfu/regexp/rules",
|
|
1344
|
+
rules: {
|
|
1345
|
+
...rules,
|
|
1346
|
+
...options.overrides
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
];
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1265
1352
|
// src/configs/solid.ts
|
|
1266
1353
|
async function solid(options = {}) {
|
|
1267
1354
|
const {
|
|
@@ -1855,7 +1942,7 @@ async function typescript(options = {}) {
|
|
|
1855
1942
|
// Install the plugins without globs, so they can be configured separately.
|
|
1856
1943
|
name: "antfu/typescript/setup",
|
|
1857
1944
|
plugins: {
|
|
1858
|
-
antfu:
|
|
1945
|
+
antfu: default3,
|
|
1859
1946
|
ts: pluginTs
|
|
1860
1947
|
}
|
|
1861
1948
|
},
|
|
@@ -1934,10 +2021,10 @@ async function unicorn(options = {}) {
|
|
|
1934
2021
|
{
|
|
1935
2022
|
name: "antfu/unicorn/rules",
|
|
1936
2023
|
plugins: {
|
|
1937
|
-
unicorn:
|
|
2024
|
+
unicorn: default6
|
|
1938
2025
|
},
|
|
1939
2026
|
rules: {
|
|
1940
|
-
...options.allRecommended ?
|
|
2027
|
+
...options.allRecommended ? default6.configs["flat/recommended"].rules : {
|
|
1941
2028
|
"unicorn/consistent-empty-array-spread": "error",
|
|
1942
2029
|
"unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
|
|
1943
2030
|
"unicorn/error-message": "error",
|
|
@@ -2219,85 +2306,6 @@ async function yaml(options = {}) {
|
|
|
2219
2306
|
];
|
|
2220
2307
|
}
|
|
2221
2308
|
|
|
2222
|
-
// src/configs/regexp.ts
|
|
2223
|
-
import { configs } from "eslint-plugin-regexp";
|
|
2224
|
-
async function regexp(options = {}) {
|
|
2225
|
-
const config = configs["flat/recommended"];
|
|
2226
|
-
const rules = {
|
|
2227
|
-
...config.rules
|
|
2228
|
-
};
|
|
2229
|
-
if (options.level === "warn") {
|
|
2230
|
-
for (const key in rules) {
|
|
2231
|
-
if (rules[key] === "error")
|
|
2232
|
-
rules[key] = "warn";
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
|
-
return [
|
|
2236
|
-
{
|
|
2237
|
-
...config,
|
|
2238
|
-
name: "antfu/regexp/rules",
|
|
2239
|
-
rules: {
|
|
2240
|
-
...rules,
|
|
2241
|
-
...options.overrides
|
|
2242
|
-
}
|
|
2243
|
-
}
|
|
2244
|
-
];
|
|
2245
|
-
}
|
|
2246
|
-
|
|
2247
|
-
// src/configs/disables.ts
|
|
2248
|
-
async function disables() {
|
|
2249
|
-
return [
|
|
2250
|
-
{
|
|
2251
|
-
files: [`scripts/${GLOB_SRC}`],
|
|
2252
|
-
name: "antfu/disables/scripts",
|
|
2253
|
-
rules: {
|
|
2254
|
-
"no-console": "off",
|
|
2255
|
-
"ts/explicit-function-return-type": "off",
|
|
2256
|
-
"unicorn/consistent-function-scoping": "off"
|
|
2257
|
-
}
|
|
2258
|
-
},
|
|
2259
|
-
{
|
|
2260
|
-
files: [`cli/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
2261
|
-
name: "antfu/disables/cli",
|
|
2262
|
-
rules: {
|
|
2263
|
-
"no-console": "off"
|
|
2264
|
-
}
|
|
2265
|
-
},
|
|
2266
|
-
{
|
|
2267
|
-
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
2268
|
-
name: "antfu/disables/bin",
|
|
2269
|
-
rules: {
|
|
2270
|
-
"antfu/no-import-dist": "off",
|
|
2271
|
-
"antfu/no-import-node-modules-by-path": "off"
|
|
2272
|
-
}
|
|
2273
|
-
},
|
|
2274
|
-
{
|
|
2275
|
-
files: ["**/*.d.?([cm])ts"],
|
|
2276
|
-
name: "antfu/disables/dts",
|
|
2277
|
-
rules: {
|
|
2278
|
-
"eslint-comments/no-unlimited-disable": "off",
|
|
2279
|
-
"import/no-duplicates": "off",
|
|
2280
|
-
"no-restricted-syntax": "off",
|
|
2281
|
-
"unused-imports/no-unused-vars": "off"
|
|
2282
|
-
}
|
|
2283
|
-
},
|
|
2284
|
-
{
|
|
2285
|
-
files: ["**/*.{test,spec}.([tj])s?(x)"],
|
|
2286
|
-
name: "antfu/disables/test",
|
|
2287
|
-
rules: {
|
|
2288
|
-
"no-unused-expressions": "off"
|
|
2289
|
-
}
|
|
2290
|
-
},
|
|
2291
|
-
{
|
|
2292
|
-
files: ["**/*.js", "**/*.cjs"],
|
|
2293
|
-
name: "antfu/disables/cjs",
|
|
2294
|
-
rules: {
|
|
2295
|
-
"ts/no-require-imports": "off"
|
|
2296
|
-
}
|
|
2297
|
-
}
|
|
2298
|
-
];
|
|
2299
|
-
}
|
|
2300
|
-
|
|
2301
2309
|
// src/factory.ts
|
|
2302
2310
|
var flatConfigProps = [
|
|
2303
2311
|
"name",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antfu/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.3.0",
|
|
5
5
|
"description": "Anthony's ESLint config",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"typescript": "^5.5.4",
|
|
157
157
|
"vitest": "^2.0.5",
|
|
158
158
|
"vue": "^3.5.2",
|
|
159
|
-
"@antfu/eslint-config": "3.
|
|
159
|
+
"@antfu/eslint-config": "3.3.0"
|
|
160
160
|
},
|
|
161
161
|
"resolutions": {
|
|
162
162
|
"@eslint-community/eslint-utils": "^4.4.0",
|