@antfu/eslint-config 1.0.0-beta.2 → 1.0.0-beta.22
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 +115 -44
- package/dist/index.cjs +1602 -0
- package/dist/index.d.cts +236 -0
- package/dist/index.d.ts +123 -36
- package/dist/index.js +972 -725
- package/package.json +42 -32
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
2
|
+
import { ParserOptions } from '@typescript-eslint/parser';
|
|
3
|
+
import * as parser from '@typescript-eslint/parser';
|
|
4
|
+
export { parser as parserTs };
|
|
5
|
+
import { MergeIntersection, EslintRules, Unprefix, TypeScriptRules, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ImportRules, JsoncRules, VueRules, UnicornRules, EslintCommentsRules, RuleConfig, FlatESLintConfigItem } from '@antfu/eslint-define-config';
|
|
6
|
+
export { default as pluginAntfu } from 'eslint-plugin-antfu';
|
|
7
|
+
export { default as pluginComments } from 'eslint-plugin-eslint-comments';
|
|
8
|
+
import * as eslintPluginI from 'eslint-plugin-i';
|
|
9
|
+
export { eslintPluginI as pluginImport };
|
|
10
|
+
export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
|
|
11
|
+
import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
|
|
12
|
+
export { eslintPluginJsonc as pluginJsonc };
|
|
13
|
+
export { default as pluginMarkdown } from 'eslint-plugin-markdown';
|
|
14
|
+
export { default as pluginNode } from 'eslint-plugin-n';
|
|
15
|
+
export { default as pluginStylistic } from '@stylistic/eslint-plugin';
|
|
16
|
+
export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
|
|
17
|
+
export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
|
|
18
|
+
export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
|
19
|
+
export { default as pluginVue } from 'eslint-plugin-vue';
|
|
20
|
+
import * as eslintPluginYml from 'eslint-plugin-yml';
|
|
21
|
+
export { eslintPluginYml as pluginYaml };
|
|
22
|
+
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
23
|
+
export { default as pluginVitest } from 'eslint-plugin-vitest';
|
|
24
|
+
export { default as parserVue } from 'vue-eslint-parser';
|
|
25
|
+
export { default as parserYaml } from 'yaml-eslint-parser';
|
|
26
|
+
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
27
|
+
|
|
28
|
+
type MergedRules = MergeIntersection<EslintRules & Unprefix<TypeScriptRules, '@typescript-eslint/'>>;
|
|
29
|
+
type StylisticRules = Pick<MergedRules, 'array-bracket-newline' | 'array-bracket-spacing' | 'array-element-newline' | 'arrow-spacing' | 'block-spacing' | 'brace-style' | 'comma-dangle' | 'comma-spacing' | 'comma-style' | 'computed-property-spacing' | 'dot-location' | 'eol-last' | 'func-call-spacing' | 'function-call-argument-newline' | 'function-paren-newline' | 'generator-star-spacing' | 'implicit-arrow-linebreak' | 'indent' | 'jsx-quotes' | 'key-spacing' | 'keyword-spacing' | 'linebreak-style' | 'lines-around-comment' | 'lines-around-directive' | 'lines-between-class-members' | 'max-len' | 'max-statements-per-line' | 'multiline-ternary' | 'new-parens' | 'newline-after-var' | 'newline-before-return' | 'newline-per-chained-call' | 'no-confusing-arrow' | 'no-extra-parens' | 'no-extra-semi' | 'no-floating-decimal' | 'no-mixed-operators' | 'no-mixed-spaces-and-tabs' | 'no-multi-spaces' | 'no-multiple-empty-lines' | 'no-spaced-func' | 'no-tabs' | 'no-trailing-spaces' | 'no-whitespace-before-property' | 'nonblock-statement-body-position' | 'object-curly-newline' | 'object-curly-spacing' | 'object-property-newline' | 'one-var-declaration-per-line' | 'operator-linebreak' | 'padded-blocks' | 'padding-line-between-statements' | 'quote-props' | 'quotes' | 'rest-spread-spacing' | 'semi' | 'semi-spacing' | 'semi-style' | 'space-before-blocks' | 'space-before-function-paren' | 'space-in-parens' | 'space-infix-ops' | 'space-unary-ops' | 'spaced-comment' | 'switch-colon-spacing' | 'template-curly-spacing' | 'template-tag-spacing' | 'wrap-iife' | 'wrap-regex' | 'yield-star-spacing' | 'member-delimiter-style' | 'type-annotation-spacing'>;
|
|
30
|
+
|
|
31
|
+
type Rules = MergeIntersection<RenamePrefix<TypeScriptRules, '@typescript-eslint/', 'ts/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<StylisticRules, 'style/'> & ImportRules & EslintRules & JsoncRules & VueRules & UnicornRules & EslintCommentsRules & {
|
|
32
|
+
'test/no-only-tests': RuleConfig<[]>;
|
|
33
|
+
}>;
|
|
34
|
+
type ConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
|
|
35
|
+
/**
|
|
36
|
+
* Custom name of each config item
|
|
37
|
+
*/
|
|
38
|
+
name?: string;
|
|
39
|
+
/**
|
|
40
|
+
* An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
|
|
41
|
+
*
|
|
42
|
+
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
43
|
+
*/
|
|
44
|
+
plugins?: Record<string, any>;
|
|
45
|
+
};
|
|
46
|
+
interface OptionsComponentExts {
|
|
47
|
+
/**
|
|
48
|
+
* Additional extensions for components.
|
|
49
|
+
*
|
|
50
|
+
* @example ['vue']
|
|
51
|
+
* @default []
|
|
52
|
+
*/
|
|
53
|
+
componentExts?: string[];
|
|
54
|
+
}
|
|
55
|
+
interface OptionsTypeScriptParserOptions {
|
|
56
|
+
/**
|
|
57
|
+
* Additional parser options for TypeScript.
|
|
58
|
+
*/
|
|
59
|
+
parserOptions?: Partial<ParserOptions>;
|
|
60
|
+
}
|
|
61
|
+
interface OptionsTypeScriptWithTypes {
|
|
62
|
+
/**
|
|
63
|
+
* When this options is provided, type aware rules will be enabled.
|
|
64
|
+
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
65
|
+
*/
|
|
66
|
+
tsconfigPath?: string;
|
|
67
|
+
}
|
|
68
|
+
interface OptionsHasTypeScript {
|
|
69
|
+
typescript?: boolean;
|
|
70
|
+
}
|
|
71
|
+
interface OptionsStylistic {
|
|
72
|
+
stylistic?: boolean | StylisticConfig;
|
|
73
|
+
}
|
|
74
|
+
interface StylisticConfig {
|
|
75
|
+
indent?: number | 'tab';
|
|
76
|
+
quotes?: 'single' | 'double';
|
|
77
|
+
}
|
|
78
|
+
interface OptionsOverrides {
|
|
79
|
+
overrides?: ConfigItem['rules'];
|
|
80
|
+
}
|
|
81
|
+
interface OptionsIsInEditor {
|
|
82
|
+
isInEditor?: boolean;
|
|
83
|
+
}
|
|
84
|
+
interface OptionsConfig extends OptionsComponentExts {
|
|
85
|
+
/**
|
|
86
|
+
* Enable gitignore support.
|
|
87
|
+
*
|
|
88
|
+
* Passing an object to configure the options.
|
|
89
|
+
*
|
|
90
|
+
* @see https://github.com/antfu/eslint-config-flat-gitignore
|
|
91
|
+
* @default true
|
|
92
|
+
*/
|
|
93
|
+
gitignore?: boolean | FlatGitignoreOptions;
|
|
94
|
+
/**
|
|
95
|
+
* Enable TypeScript support.
|
|
96
|
+
*
|
|
97
|
+
* Passing an object to enable TypeScript Language Server support.
|
|
98
|
+
*
|
|
99
|
+
* @default auto-detect based on the dependencies
|
|
100
|
+
*/
|
|
101
|
+
typescript?: boolean | OptionsTypeScriptWithTypes;
|
|
102
|
+
/**
|
|
103
|
+
* Enable test support.
|
|
104
|
+
*
|
|
105
|
+
* @default true
|
|
106
|
+
*/
|
|
107
|
+
test?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Enable Vue support.
|
|
110
|
+
*
|
|
111
|
+
* @default auto-detect based on the dependencies
|
|
112
|
+
*/
|
|
113
|
+
vue?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Enable JSONC support.
|
|
116
|
+
*
|
|
117
|
+
* @default true
|
|
118
|
+
*/
|
|
119
|
+
jsonc?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Enable YAML support.
|
|
122
|
+
*
|
|
123
|
+
* @default true
|
|
124
|
+
*/
|
|
125
|
+
yaml?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Enable Markdown support.
|
|
128
|
+
*
|
|
129
|
+
* @default true
|
|
130
|
+
*/
|
|
131
|
+
markdown?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Enable stylistic rules.
|
|
134
|
+
*
|
|
135
|
+
* @default true
|
|
136
|
+
*/
|
|
137
|
+
stylistic?: boolean | StylisticConfig;
|
|
138
|
+
/**
|
|
139
|
+
* Control to disable some rules in editors.
|
|
140
|
+
* @default auto-detect based on the process.env
|
|
141
|
+
*/
|
|
142
|
+
isInEditor?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Provide overrides for rules for each integration.
|
|
145
|
+
*/
|
|
146
|
+
overrides?: {
|
|
147
|
+
javascript?: ConfigItem['rules'];
|
|
148
|
+
typescript?: ConfigItem['rules'];
|
|
149
|
+
test?: ConfigItem['rules'];
|
|
150
|
+
vue?: ConfigItem['rules'];
|
|
151
|
+
jsonc?: ConfigItem['rules'];
|
|
152
|
+
markdown?: ConfigItem['rules'];
|
|
153
|
+
yaml?: ConfigItem['rules'];
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Construct an array of ESLint flat config items.
|
|
159
|
+
*/
|
|
160
|
+
declare function antfu(options?: OptionsConfig & ConfigItem, ...userConfigs: (ConfigItem | ConfigItem[])[]): ConfigItem[];
|
|
161
|
+
|
|
162
|
+
declare function comments(): ConfigItem[];
|
|
163
|
+
|
|
164
|
+
declare function ignores(): ConfigItem[];
|
|
165
|
+
|
|
166
|
+
declare function imports(options?: OptionsStylistic): ConfigItem[];
|
|
167
|
+
|
|
168
|
+
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
|
|
169
|
+
|
|
170
|
+
declare function jsdoc(options?: OptionsStylistic): ConfigItem[];
|
|
171
|
+
|
|
172
|
+
declare function jsonc(options?: OptionsStylistic & OptionsOverrides): ConfigItem[];
|
|
173
|
+
|
|
174
|
+
declare function markdown(options?: OptionsComponentExts & OptionsOverrides): ConfigItem[];
|
|
175
|
+
|
|
176
|
+
declare function node(): ConfigItem[];
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Sort package.json
|
|
180
|
+
*
|
|
181
|
+
* Requires `jsonc` config
|
|
182
|
+
*/
|
|
183
|
+
declare function sortPackageJson(): ConfigItem[];
|
|
184
|
+
/**
|
|
185
|
+
* Sort tsconfig.json
|
|
186
|
+
*
|
|
187
|
+
* Requires `jsonc` config
|
|
188
|
+
*/
|
|
189
|
+
declare function sortTsconfig(): ConfigItem[];
|
|
190
|
+
|
|
191
|
+
declare function stylistic(options?: StylisticConfig): ConfigItem[];
|
|
192
|
+
|
|
193
|
+
declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): ConfigItem[];
|
|
194
|
+
|
|
195
|
+
declare function unicorn(): ConfigItem[];
|
|
196
|
+
|
|
197
|
+
declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): ConfigItem[];
|
|
198
|
+
|
|
199
|
+
declare function yaml(options?: OptionsOverrides & OptionsStylistic): ConfigItem[];
|
|
200
|
+
|
|
201
|
+
declare function test(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Combine array and non-array configs into a single array.
|
|
205
|
+
*/
|
|
206
|
+
declare function combine(...configs: (ConfigItem | ConfigItem[])[]): ConfigItem[];
|
|
207
|
+
declare function renameRules(rules: Record<string, any>, from: string, to: string): {
|
|
208
|
+
[k: string]: any;
|
|
209
|
+
};
|
|
210
|
+
declare function recordRulesStateConfigs(configs: ConfigItem[]): ConfigItem[];
|
|
211
|
+
declare function recordRulesState(rules: ConfigItem['rules']): ConfigItem['rules'];
|
|
212
|
+
declare function warnUnnecessaryOffRules(): void;
|
|
213
|
+
|
|
214
|
+
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
215
|
+
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
216
|
+
declare const GLOB_JS = "**/*.?([cm])js";
|
|
217
|
+
declare const GLOB_JSX = "**/*.?([cm])jsx";
|
|
218
|
+
declare const GLOB_TS = "**/*.?([cm])ts";
|
|
219
|
+
declare const GLOB_TSX = "**/*.?([cm])tsx";
|
|
220
|
+
declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
221
|
+
declare const GLOB_CSS = "**/*.css";
|
|
222
|
+
declare const GLOB_LESS = "**/*.less";
|
|
223
|
+
declare const GLOB_SCSS = "**/*.scss";
|
|
224
|
+
declare const GLOB_JSON = "**/*.json";
|
|
225
|
+
declare const GLOB_JSON5 = "**/*.json5";
|
|
226
|
+
declare const GLOB_JSONC = "**/*.jsonc";
|
|
227
|
+
declare const GLOB_MARKDOWN = "**/*.md";
|
|
228
|
+
declare const GLOB_VUE = "**/*.vue";
|
|
229
|
+
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
230
|
+
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
231
|
+
declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
|
|
232
|
+
declare const GLOB_TESTS: string[];
|
|
233
|
+
declare const GLOB_ALL_SRC: string[];
|
|
234
|
+
declare const GLOB_EXCLUDE: string[];
|
|
235
|
+
|
|
236
|
+
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, StylisticConfig, antfu, combine, comments, antfu as default, ignores, imports, javascript, jsdoc, jsonc, markdown, node, recordRulesState, recordRulesStateConfigs, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
2
|
+
import { ParserOptions } from '@typescript-eslint/parser';
|
|
3
|
+
import * as parser from '@typescript-eslint/parser';
|
|
4
|
+
export { parser as parserTs };
|
|
5
|
+
import { MergeIntersection, EslintRules, Unprefix, TypeScriptRules, RenamePrefix, VitestRules, YmlRules, NRules, Prefix, ImportRules, JsoncRules, VueRules, UnicornRules, EslintCommentsRules, RuleConfig, FlatESLintConfigItem } from '@antfu/eslint-define-config';
|
|
2
6
|
export { default as pluginAntfu } from 'eslint-plugin-antfu';
|
|
3
7
|
export { default as pluginComments } from 'eslint-plugin-eslint-comments';
|
|
4
|
-
|
|
8
|
+
import * as eslintPluginI from 'eslint-plugin-i';
|
|
9
|
+
export { eslintPluginI as pluginImport };
|
|
5
10
|
export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
|
|
6
|
-
|
|
11
|
+
import * as eslintPluginJsonc from 'eslint-plugin-jsonc';
|
|
12
|
+
export { eslintPluginJsonc as pluginJsonc };
|
|
7
13
|
export { default as pluginMarkdown } from 'eslint-plugin-markdown';
|
|
8
14
|
export { default as pluginNode } from 'eslint-plugin-n';
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as pluginStylisticTs } from '@stylistic/eslint-plugin-ts';
|
|
15
|
+
export { default as pluginStylistic } from '@stylistic/eslint-plugin';
|
|
11
16
|
export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
|
|
12
17
|
export { default as pluginUnicorn } from 'eslint-plugin-unicorn';
|
|
13
18
|
export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
|
14
19
|
export { default as pluginVue } from 'eslint-plugin-vue';
|
|
15
|
-
|
|
20
|
+
import * as eslintPluginYml from 'eslint-plugin-yml';
|
|
21
|
+
export { eslintPluginYml as pluginYaml };
|
|
16
22
|
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
17
|
-
export { default as
|
|
23
|
+
export { default as pluginVitest } from 'eslint-plugin-vitest';
|
|
18
24
|
export { default as parserVue } from 'vue-eslint-parser';
|
|
19
|
-
export { default as
|
|
25
|
+
export { default as parserYaml } from 'yaml-eslint-parser';
|
|
20
26
|
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
21
27
|
|
|
28
|
+
type MergedRules = MergeIntersection<EslintRules & Unprefix<TypeScriptRules, '@typescript-eslint/'>>;
|
|
29
|
+
type StylisticRules = Pick<MergedRules, 'array-bracket-newline' | 'array-bracket-spacing' | 'array-element-newline' | 'arrow-spacing' | 'block-spacing' | 'brace-style' | 'comma-dangle' | 'comma-spacing' | 'comma-style' | 'computed-property-spacing' | 'dot-location' | 'eol-last' | 'func-call-spacing' | 'function-call-argument-newline' | 'function-paren-newline' | 'generator-star-spacing' | 'implicit-arrow-linebreak' | 'indent' | 'jsx-quotes' | 'key-spacing' | 'keyword-spacing' | 'linebreak-style' | 'lines-around-comment' | 'lines-around-directive' | 'lines-between-class-members' | 'max-len' | 'max-statements-per-line' | 'multiline-ternary' | 'new-parens' | 'newline-after-var' | 'newline-before-return' | 'newline-per-chained-call' | 'no-confusing-arrow' | 'no-extra-parens' | 'no-extra-semi' | 'no-floating-decimal' | 'no-mixed-operators' | 'no-mixed-spaces-and-tabs' | 'no-multi-spaces' | 'no-multiple-empty-lines' | 'no-spaced-func' | 'no-tabs' | 'no-trailing-spaces' | 'no-whitespace-before-property' | 'nonblock-statement-body-position' | 'object-curly-newline' | 'object-curly-spacing' | 'object-property-newline' | 'one-var-declaration-per-line' | 'operator-linebreak' | 'padded-blocks' | 'padding-line-between-statements' | 'quote-props' | 'quotes' | 'rest-spread-spacing' | 'semi' | 'semi-spacing' | 'semi-style' | 'space-before-blocks' | 'space-before-function-paren' | 'space-in-parens' | 'space-infix-ops' | 'space-unary-ops' | 'spaced-comment' | 'switch-colon-spacing' | 'template-curly-spacing' | 'template-tag-spacing' | 'wrap-iife' | 'wrap-regex' | 'yield-star-spacing' | 'member-delimiter-style' | 'type-annotation-spacing'>;
|
|
30
|
+
|
|
31
|
+
type Rules = MergeIntersection<RenamePrefix<TypeScriptRules, '@typescript-eslint/', 'ts/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<StylisticRules, 'style/'> & ImportRules & EslintRules & JsoncRules & VueRules & UnicornRules & EslintCommentsRules & {
|
|
32
|
+
'test/no-only-tests': RuleConfig<[]>;
|
|
33
|
+
}>;
|
|
34
|
+
type ConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
|
|
35
|
+
/**
|
|
36
|
+
* Custom name of each config item
|
|
37
|
+
*/
|
|
38
|
+
name?: string;
|
|
39
|
+
/**
|
|
40
|
+
* An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
|
|
41
|
+
*
|
|
42
|
+
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
43
|
+
*/
|
|
44
|
+
plugins?: Record<string, any>;
|
|
45
|
+
};
|
|
22
46
|
interface OptionsComponentExts {
|
|
23
47
|
/**
|
|
24
48
|
* Additional extensions for components.
|
|
@@ -28,17 +52,45 @@ interface OptionsComponentExts {
|
|
|
28
52
|
*/
|
|
29
53
|
componentExts?: string[];
|
|
30
54
|
}
|
|
31
|
-
interface
|
|
32
|
-
|
|
33
|
-
|
|
55
|
+
interface OptionsTypeScriptParserOptions {
|
|
56
|
+
/**
|
|
57
|
+
* Additional parser options for TypeScript.
|
|
58
|
+
*/
|
|
59
|
+
parserOptions?: Partial<ParserOptions>;
|
|
60
|
+
}
|
|
61
|
+
interface OptionsTypeScriptWithTypes {
|
|
62
|
+
/**
|
|
63
|
+
* When this options is provided, type aware rules will be enabled.
|
|
64
|
+
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
65
|
+
*/
|
|
66
|
+
tsconfigPath?: string;
|
|
34
67
|
}
|
|
35
68
|
interface OptionsHasTypeScript {
|
|
36
69
|
typescript?: boolean;
|
|
37
70
|
}
|
|
71
|
+
interface OptionsStylistic {
|
|
72
|
+
stylistic?: boolean | StylisticConfig;
|
|
73
|
+
}
|
|
74
|
+
interface StylisticConfig {
|
|
75
|
+
indent?: number | 'tab';
|
|
76
|
+
quotes?: 'single' | 'double';
|
|
77
|
+
}
|
|
78
|
+
interface OptionsOverrides {
|
|
79
|
+
overrides?: ConfigItem['rules'];
|
|
80
|
+
}
|
|
38
81
|
interface OptionsIsInEditor {
|
|
39
82
|
isInEditor?: boolean;
|
|
40
83
|
}
|
|
41
|
-
interface OptionsConfig {
|
|
84
|
+
interface OptionsConfig extends OptionsComponentExts {
|
|
85
|
+
/**
|
|
86
|
+
* Enable gitignore support.
|
|
87
|
+
*
|
|
88
|
+
* Passing an object to configure the options.
|
|
89
|
+
*
|
|
90
|
+
* @see https://github.com/antfu/eslint-config-flat-gitignore
|
|
91
|
+
* @default true
|
|
92
|
+
*/
|
|
93
|
+
gitignore?: boolean | FlatGitignoreOptions;
|
|
42
94
|
/**
|
|
43
95
|
* Enable TypeScript support.
|
|
44
96
|
*
|
|
@@ -46,7 +98,7 @@ interface OptionsConfig {
|
|
|
46
98
|
*
|
|
47
99
|
* @default auto-detect based on the dependencies
|
|
48
100
|
*/
|
|
49
|
-
typescript?: boolean |
|
|
101
|
+
typescript?: boolean | OptionsTypeScriptWithTypes;
|
|
50
102
|
/**
|
|
51
103
|
* Enable test support.
|
|
52
104
|
*
|
|
@@ -82,68 +134,103 @@ interface OptionsConfig {
|
|
|
82
134
|
*
|
|
83
135
|
* @default true
|
|
84
136
|
*/
|
|
85
|
-
stylistic?: boolean;
|
|
137
|
+
stylistic?: boolean | StylisticConfig;
|
|
86
138
|
/**
|
|
87
139
|
* Control to disable some rules in editors.
|
|
88
140
|
* @default auto-detect based on the process.env
|
|
89
141
|
*/
|
|
90
142
|
isInEditor?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Provide overrides for rules for each integration.
|
|
145
|
+
*/
|
|
146
|
+
overrides?: {
|
|
147
|
+
javascript?: ConfigItem['rules'];
|
|
148
|
+
typescript?: ConfigItem['rules'];
|
|
149
|
+
test?: ConfigItem['rules'];
|
|
150
|
+
vue?: ConfigItem['rules'];
|
|
151
|
+
jsonc?: ConfigItem['rules'];
|
|
152
|
+
markdown?: ConfigItem['rules'];
|
|
153
|
+
yaml?: ConfigItem['rules'];
|
|
154
|
+
};
|
|
91
155
|
}
|
|
92
156
|
|
|
93
157
|
/**
|
|
94
158
|
* Construct an array of ESLint flat config items.
|
|
95
159
|
*/
|
|
96
|
-
declare function antfu(options?: OptionsConfig, ...userConfigs: (
|
|
160
|
+
declare function antfu(options?: OptionsConfig & ConfigItem, ...userConfigs: (ConfigItem | ConfigItem[])[]): ConfigItem[];
|
|
97
161
|
|
|
98
|
-
declare
|
|
162
|
+
declare function comments(): ConfigItem[];
|
|
99
163
|
|
|
100
|
-
declare
|
|
164
|
+
declare function ignores(): ConfigItem[];
|
|
101
165
|
|
|
102
|
-
declare
|
|
166
|
+
declare function imports(options?: OptionsStylistic): ConfigItem[];
|
|
103
167
|
|
|
104
|
-
declare function javascript(options?: OptionsIsInEditor):
|
|
168
|
+
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
|
|
105
169
|
|
|
106
|
-
declare
|
|
170
|
+
declare function jsdoc(options?: OptionsStylistic): ConfigItem[];
|
|
107
171
|
|
|
108
|
-
declare
|
|
172
|
+
declare function jsonc(options?: OptionsStylistic & OptionsOverrides): ConfigItem[];
|
|
109
173
|
|
|
110
|
-
declare function markdown(options?: OptionsComponentExts):
|
|
174
|
+
declare function markdown(options?: OptionsComponentExts & OptionsOverrides): ConfigItem[];
|
|
111
175
|
|
|
112
|
-
declare
|
|
176
|
+
declare function node(): ConfigItem[];
|
|
113
177
|
|
|
114
178
|
/**
|
|
115
179
|
* Sort package.json
|
|
116
180
|
*
|
|
117
181
|
* Requires `jsonc` config
|
|
118
182
|
*/
|
|
119
|
-
declare
|
|
183
|
+
declare function sortPackageJson(): ConfigItem[];
|
|
120
184
|
/**
|
|
121
185
|
* Sort tsconfig.json
|
|
122
186
|
*
|
|
123
187
|
* Requires `jsonc` config
|
|
124
188
|
*/
|
|
125
|
-
declare
|
|
189
|
+
declare function sortTsconfig(): ConfigItem[];
|
|
126
190
|
|
|
127
|
-
declare
|
|
128
|
-
declare const typescriptStylistic: FlatESLintConfigItem[];
|
|
191
|
+
declare function stylistic(options?: StylisticConfig): ConfigItem[];
|
|
129
192
|
|
|
130
|
-
declare function typescript(options?: OptionsComponentExts):
|
|
131
|
-
declare function typescriptWithLanguageServer(options: OptionsTypeScriptWithLanguageServer & OptionsComponentExts): FlatESLintConfigItem[];
|
|
193
|
+
declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): ConfigItem[];
|
|
132
194
|
|
|
133
|
-
declare
|
|
195
|
+
declare function unicorn(): ConfigItem[];
|
|
134
196
|
|
|
135
|
-
declare function vue(options?: OptionsHasTypeScript):
|
|
197
|
+
declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): ConfigItem[];
|
|
136
198
|
|
|
137
|
-
declare
|
|
199
|
+
declare function yaml(options?: OptionsOverrides & OptionsStylistic): ConfigItem[];
|
|
138
200
|
|
|
139
|
-
declare function test(options?: OptionsIsInEditor):
|
|
201
|
+
declare function test(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
|
|
140
202
|
|
|
141
203
|
/**
|
|
142
204
|
* Combine array and non-array configs into a single array.
|
|
143
205
|
*/
|
|
144
|
-
declare function combine(...configs: (
|
|
206
|
+
declare function combine(...configs: (ConfigItem | ConfigItem[])[]): ConfigItem[];
|
|
145
207
|
declare function renameRules(rules: Record<string, any>, from: string, to: string): {
|
|
146
208
|
[k: string]: any;
|
|
147
209
|
};
|
|
148
|
-
|
|
149
|
-
|
|
210
|
+
declare function recordRulesStateConfigs(configs: ConfigItem[]): ConfigItem[];
|
|
211
|
+
declare function recordRulesState(rules: ConfigItem['rules']): ConfigItem['rules'];
|
|
212
|
+
declare function warnUnnecessaryOffRules(): void;
|
|
213
|
+
|
|
214
|
+
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
215
|
+
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
216
|
+
declare const GLOB_JS = "**/*.?([cm])js";
|
|
217
|
+
declare const GLOB_JSX = "**/*.?([cm])jsx";
|
|
218
|
+
declare const GLOB_TS = "**/*.?([cm])ts";
|
|
219
|
+
declare const GLOB_TSX = "**/*.?([cm])tsx";
|
|
220
|
+
declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
221
|
+
declare const GLOB_CSS = "**/*.css";
|
|
222
|
+
declare const GLOB_LESS = "**/*.less";
|
|
223
|
+
declare const GLOB_SCSS = "**/*.scss";
|
|
224
|
+
declare const GLOB_JSON = "**/*.json";
|
|
225
|
+
declare const GLOB_JSON5 = "**/*.json5";
|
|
226
|
+
declare const GLOB_JSONC = "**/*.jsonc";
|
|
227
|
+
declare const GLOB_MARKDOWN = "**/*.md";
|
|
228
|
+
declare const GLOB_VUE = "**/*.vue";
|
|
229
|
+
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
230
|
+
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
231
|
+
declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
|
|
232
|
+
declare const GLOB_TESTS: string[];
|
|
233
|
+
declare const GLOB_ALL_SRC: string[];
|
|
234
|
+
declare const GLOB_EXCLUDE: string[];
|
|
235
|
+
|
|
236
|
+
export { ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, StylisticConfig, antfu, combine, comments, antfu as default, ignores, imports, javascript, jsdoc, jsonc, markdown, node, recordRulesState, recordRulesStateConfigs, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
|