@ocavue/eslint-config 2.20.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -0
- package/dist/basic.js +2 -0
- package/dist/gitignore.d.ts +3 -0
- package/dist/gitignore.js +4 -0
- package/dist/ignores.d.ts +2 -1
- package/dist/ignores.js +4 -7
- package/dist/index.js +36 -2
- package/dist/options.d.ts +68 -1
- package/dist/options.js +14 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,6 +77,34 @@ The full type definition for the options is as follows:
|
|
|
77
77
|
|
|
78
78
|
```ts
|
|
79
79
|
export interface ESLintConfigOptions {
|
|
80
|
+
/**
|
|
81
|
+
* Whether to enable [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint) configuration.
|
|
82
|
+
*
|
|
83
|
+
* @default true
|
|
84
|
+
*/
|
|
85
|
+
typescript?: boolean
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Whether to enable [eslint-plugin-unicorn](https://www.npmjs.com/package/eslint-plugin-unicorn) configuration.
|
|
89
|
+
*
|
|
90
|
+
* @default true
|
|
91
|
+
*/
|
|
92
|
+
unicorn?: boolean
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Whether to enable [eslint-plugin-package-json](https://www.npmjs.com/package/eslint-plugin-package-json) configuration.
|
|
96
|
+
*
|
|
97
|
+
* @default true
|
|
98
|
+
*/
|
|
99
|
+
packageJson?: boolean
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Whether to enable [eslint-plugin-import-x](https://www.npmjs.com/package/eslint-plugin-import-x) configuration.
|
|
103
|
+
*
|
|
104
|
+
* @default true
|
|
105
|
+
*/
|
|
106
|
+
imports?: boolean
|
|
107
|
+
|
|
80
108
|
/**
|
|
81
109
|
* Whether to check code blocks in Markdown files.
|
|
82
110
|
*
|
|
@@ -111,6 +139,41 @@ export interface ESLintConfigOptions {
|
|
|
111
139
|
* @default false
|
|
112
140
|
*/
|
|
113
141
|
command?: boolean
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Ignore some common files that should not be linted.
|
|
145
|
+
*
|
|
146
|
+
* @default true
|
|
147
|
+
*/
|
|
148
|
+
ignores?: boolean | IgnoresOptions
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Whether to enable [eslint-config-flat-gitignore](https://www.npmjs.com/package/eslint-config-flat-gitignore) configuration.
|
|
152
|
+
*
|
|
153
|
+
* @default true
|
|
154
|
+
*/
|
|
155
|
+
gitignore?: boolean | GitignoreOptions
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Whether to enable [eslint-plugin-antfu](https://www.npmjs.com/package/eslint-plugin-antfu) configuration.
|
|
159
|
+
*
|
|
160
|
+
* @default true
|
|
161
|
+
*/
|
|
162
|
+
antfu?: boolean
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Whether to enable [eslint-plugin-no-only-tests](https://www.npmjs.com/package/eslint-plugin-no-only-tests) configuration.
|
|
166
|
+
*
|
|
167
|
+
* @default true
|
|
168
|
+
*/
|
|
169
|
+
noOnlyTests?: boolean
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Whether to enable [eslint-config-prettier](https://www.npmjs.com/package/eslint-config-prettier) configuration.
|
|
173
|
+
*
|
|
174
|
+
* @default true
|
|
175
|
+
*/
|
|
176
|
+
prettier?: boolean
|
|
114
177
|
}
|
|
115
178
|
```
|
|
116
179
|
|
package/dist/basic.js
CHANGED
|
@@ -6,9 +6,11 @@ import { packageJson } from './package-json.js';
|
|
|
6
6
|
import { prettier } from './prettier.js';
|
|
7
7
|
import { typescript } from './typescript.js';
|
|
8
8
|
import { unicorn } from './unicorn.js';
|
|
9
|
+
import { gitignore } from './gitignore.js';
|
|
9
10
|
export function basic() {
|
|
10
11
|
return [
|
|
11
12
|
...ignores(),
|
|
13
|
+
...gitignore(),
|
|
12
14
|
...typescript(),
|
|
13
15
|
...imports(),
|
|
14
16
|
...packageJson(),
|
package/dist/ignores.d.ts
CHANGED
package/dist/ignores.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return [
|
|
5
|
-
{ ignores: [...GLOB_EXCLUDE], name: 'basic-global-ignores' },
|
|
6
|
-
gitignore(),
|
|
7
|
-
];
|
|
1
|
+
import { resolveIgnoresOptions } from './options.js';
|
|
2
|
+
export function ignores(options) {
|
|
3
|
+
const { ignores } = resolveIgnoresOptions(options);
|
|
4
|
+
return [{ name: 'ocavue/ignores', ignores }];
|
|
8
5
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defineConfig } from 'eslint/config';
|
|
2
|
-
import { basic } from './basic.js';
|
|
3
2
|
import { resolveOptions } from './options.js';
|
|
4
3
|
export * from './basic.js';
|
|
5
4
|
export * from './markdown.js';
|
|
@@ -10,7 +9,42 @@ export * from './vue.js';
|
|
|
10
9
|
export async function defineESLintConfig(options, ...userConfigs) {
|
|
11
10
|
const resolvedOptions = resolveOptions(options);
|
|
12
11
|
const configs = [];
|
|
13
|
-
|
|
12
|
+
if (resolvedOptions.antfu) {
|
|
13
|
+
const { antfu } = await import('./antfu.js');
|
|
14
|
+
configs.push(...antfu());
|
|
15
|
+
}
|
|
16
|
+
if (resolvedOptions.noOnlyTests) {
|
|
17
|
+
const { noOnlyTests } = await import('./no-only-tests.js');
|
|
18
|
+
configs.push(...noOnlyTests());
|
|
19
|
+
}
|
|
20
|
+
if (resolvedOptions.prettier) {
|
|
21
|
+
const { prettier } = await import('./prettier.js');
|
|
22
|
+
configs.push(...prettier());
|
|
23
|
+
}
|
|
24
|
+
if (resolvedOptions.ignores) {
|
|
25
|
+
const { ignores } = await import('./ignores.js');
|
|
26
|
+
configs.push(...ignores(trueToUndefined(resolvedOptions.ignores)));
|
|
27
|
+
}
|
|
28
|
+
if (resolvedOptions.gitignore) {
|
|
29
|
+
const { gitignore } = await import('./gitignore.js');
|
|
30
|
+
configs.push(...gitignore(trueToUndefined(resolvedOptions.gitignore)));
|
|
31
|
+
}
|
|
32
|
+
if (resolvedOptions.typescript) {
|
|
33
|
+
const { typescript } = await import('./typescript.js');
|
|
34
|
+
configs.push(...typescript());
|
|
35
|
+
}
|
|
36
|
+
if (resolvedOptions.unicorn) {
|
|
37
|
+
const { unicorn } = await import('./unicorn.js');
|
|
38
|
+
configs.push(...unicorn());
|
|
39
|
+
}
|
|
40
|
+
if (resolvedOptions.packageJson) {
|
|
41
|
+
const { packageJson } = await import('./package-json.js');
|
|
42
|
+
configs.push(...packageJson());
|
|
43
|
+
}
|
|
44
|
+
if (resolvedOptions.imports) {
|
|
45
|
+
const { imports } = await import('./imports.js');
|
|
46
|
+
configs.push(...imports());
|
|
47
|
+
}
|
|
14
48
|
if (resolvedOptions.markdown) {
|
|
15
49
|
const { markdown } = await import('./markdown.js');
|
|
16
50
|
configs.push(...markdown());
|
package/dist/options.d.ts
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
|
+
import type { FlatGitignoreOptions as GitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
1
2
|
import type { Config } from './types.js';
|
|
2
3
|
export interface ESLintConfigOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Whether to enable [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint) configuration.
|
|
6
|
+
*
|
|
7
|
+
* @default true
|
|
8
|
+
*/
|
|
9
|
+
typescript?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether to enable [eslint-plugin-unicorn](https://www.npmjs.com/package/eslint-plugin-unicorn) configuration.
|
|
12
|
+
*
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
unicorn?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether to enable [eslint-plugin-package-json](https://www.npmjs.com/package/eslint-plugin-package-json) configuration.
|
|
18
|
+
*
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
packageJson?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to enable [eslint-plugin-import-x](https://www.npmjs.com/package/eslint-plugin-import-x) configuration.
|
|
24
|
+
*
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
imports?: boolean;
|
|
3
28
|
/**
|
|
4
29
|
* Whether to check code blocks in Markdown files.
|
|
5
30
|
*
|
|
@@ -30,8 +55,38 @@ export interface ESLintConfigOptions {
|
|
|
30
55
|
* @default false
|
|
31
56
|
*/
|
|
32
57
|
command?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Ignore some common files that should not be linted.
|
|
60
|
+
*
|
|
61
|
+
* @default true
|
|
62
|
+
*/
|
|
63
|
+
ignores?: boolean | IgnoresOptions;
|
|
64
|
+
/**
|
|
65
|
+
* Whether to enable [eslint-config-flat-gitignore](https://www.npmjs.com/package/eslint-config-flat-gitignore) configuration.
|
|
66
|
+
*
|
|
67
|
+
* @default true
|
|
68
|
+
*/
|
|
69
|
+
gitignore?: boolean | GitignoreOptions;
|
|
70
|
+
/**
|
|
71
|
+
* Whether to enable [eslint-plugin-antfu](https://www.npmjs.com/package/eslint-plugin-antfu) configuration.
|
|
72
|
+
*
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
antfu?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Whether to enable [eslint-plugin-no-only-tests](https://www.npmjs.com/package/eslint-plugin-no-only-tests) configuration.
|
|
78
|
+
*
|
|
79
|
+
* @default true
|
|
80
|
+
*/
|
|
81
|
+
noOnlyTests?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Whether to enable [eslint-config-prettier](https://www.npmjs.com/package/eslint-config-prettier) configuration.
|
|
84
|
+
*
|
|
85
|
+
* @default true
|
|
86
|
+
*/
|
|
87
|
+
prettier?: boolean;
|
|
33
88
|
}
|
|
34
|
-
export declare function resolveOptions({ markdown, react, vue, unocss, command, }?: ESLintConfigOptions): Required<ESLintConfigOptions>;
|
|
89
|
+
export declare function resolveOptions({ typescript, unicorn, packageJson, imports, markdown, react, vue, unocss, command, ignores, gitignore, antfu, noOnlyTests, prettier, }?: ESLintConfigOptions): Required<ESLintConfigOptions>;
|
|
35
90
|
export interface ReactOptions {
|
|
36
91
|
/**
|
|
37
92
|
* The default files to lint.
|
|
@@ -54,3 +109,15 @@ export interface VueOptions {
|
|
|
54
109
|
files?: Config['files'];
|
|
55
110
|
}
|
|
56
111
|
export declare function resolveVueOptions({ files, }?: VueOptions): Required<VueOptions>;
|
|
112
|
+
export interface IgnoresOptions {
|
|
113
|
+
/**
|
|
114
|
+
* An array of glob patterns indicating the files that the configuration
|
|
115
|
+
* object should not apply to.
|
|
116
|
+
*
|
|
117
|
+
* @default: some common files to ignore
|
|
118
|
+
*
|
|
119
|
+
* @see {@link Config.ignores}
|
|
120
|
+
*/
|
|
121
|
+
ignores?: Config['ignores'];
|
|
122
|
+
}
|
|
123
|
+
export declare function resolveIgnoresOptions({ ignores, }?: IgnoresOptions): Required<IgnoresOptions>;
|
package/dist/options.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import { GLOB_TS, GLOB_TSX, GLOB_VUE } from './shared.js';
|
|
2
|
-
export function resolveOptions({ markdown = true, react = false, vue = false, unocss = false, command = false, } = {}) {
|
|
1
|
+
import { GLOB_EXCLUDE, GLOB_TS, GLOB_TSX, GLOB_VUE } from './shared.js';
|
|
2
|
+
export function resolveOptions({ typescript = true, unicorn = true, packageJson = true, imports = true, markdown = true, react = false, vue = false, unocss = false, command = false, ignores = true, gitignore = true, antfu = true, noOnlyTests = true, prettier = true, } = {}) {
|
|
3
3
|
return {
|
|
4
|
+
typescript,
|
|
5
|
+
unicorn,
|
|
6
|
+
packageJson,
|
|
7
|
+
imports,
|
|
4
8
|
markdown,
|
|
5
9
|
react,
|
|
6
10
|
vue,
|
|
7
11
|
unocss,
|
|
8
12
|
command,
|
|
13
|
+
ignores,
|
|
14
|
+
gitignore,
|
|
15
|
+
antfu,
|
|
16
|
+
noOnlyTests,
|
|
17
|
+
prettier,
|
|
9
18
|
};
|
|
10
19
|
}
|
|
11
20
|
export function resolveReactOptions({ files = [GLOB_TS, GLOB_TSX], } = {}) {
|
|
@@ -14,3 +23,6 @@ export function resolveReactOptions({ files = [GLOB_TS, GLOB_TSX], } = {}) {
|
|
|
14
23
|
export function resolveVueOptions({ files = [GLOB_VUE], } = {}) {
|
|
15
24
|
return { files };
|
|
16
25
|
}
|
|
26
|
+
export function resolveIgnoresOptions({ ignores = [...GLOB_EXCLUDE], } = {}) {
|
|
27
|
+
return { ignores };
|
|
28
|
+
}
|