@ocavue/eslint-config 2.18.0 → 2.19.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 +1 -1
- package/dist/index.js +5 -2
- package/dist/options.d.ts +25 -2
- package/dist/options.js +7 -0
- package/dist/react.d.ts +3 -2
- package/dist/react.js +6 -5
- package/dist/vue.d.ts +2 -1
- package/dist/vue.js +4 -3
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -18,10 +18,13 @@ export function defineESLintConfig(options) {
|
|
|
18
18
|
configs.push(...markdown());
|
|
19
19
|
}
|
|
20
20
|
if (resolvedOptions.react) {
|
|
21
|
-
configs.push(...react());
|
|
21
|
+
configs.push(...react(trueToUndefined(resolvedOptions.react)));
|
|
22
22
|
}
|
|
23
23
|
if (resolvedOptions.vue) {
|
|
24
|
-
configs.push(...vue());
|
|
24
|
+
configs.push(...vue(trueToUndefined(resolvedOptions.vue)));
|
|
25
25
|
}
|
|
26
26
|
return defineConfig(configs);
|
|
27
27
|
}
|
|
28
|
+
function trueToUndefined(value) {
|
|
29
|
+
return value === true ? undefined : value;
|
|
30
|
+
}
|
package/dist/options.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Config } from './types.js';
|
|
1
2
|
export interface ESLintConfigOptions {
|
|
2
3
|
/**
|
|
3
4
|
* Whether to check code blocks in Markdown files.
|
|
@@ -10,12 +11,34 @@ export interface ESLintConfigOptions {
|
|
|
10
11
|
*
|
|
11
12
|
* @default false
|
|
12
13
|
*/
|
|
13
|
-
react?: boolean;
|
|
14
|
+
react?: boolean | ReactOptions;
|
|
14
15
|
/**
|
|
15
16
|
* Whether to enable Vue configuration.
|
|
16
17
|
*
|
|
17
18
|
* @default false
|
|
18
19
|
*/
|
|
19
|
-
vue?: boolean;
|
|
20
|
+
vue?: boolean | VueOptions;
|
|
20
21
|
}
|
|
21
22
|
export declare function resolveOptions({ markdown, react, vue, }?: ESLintConfigOptions): Required<ESLintConfigOptions>;
|
|
23
|
+
export interface ReactOptions {
|
|
24
|
+
/**
|
|
25
|
+
* The default files to lint.
|
|
26
|
+
*
|
|
27
|
+
* @default: All typescript files
|
|
28
|
+
*
|
|
29
|
+
* @see {@link Config.files}
|
|
30
|
+
*/
|
|
31
|
+
files?: Config['files'];
|
|
32
|
+
}
|
|
33
|
+
export declare function resolveReactOptions({ files, }?: ReactOptions): Required<ReactOptions>;
|
|
34
|
+
export interface VueOptions {
|
|
35
|
+
/**
|
|
36
|
+
* The default files to lint.
|
|
37
|
+
*
|
|
38
|
+
* @default: All .vue files
|
|
39
|
+
*
|
|
40
|
+
* @see {@link Config.files}
|
|
41
|
+
*/
|
|
42
|
+
files?: Config['files'];
|
|
43
|
+
}
|
|
44
|
+
export declare function resolveVueOptions({ files, }?: VueOptions): Required<VueOptions>;
|
package/dist/options.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GLOB_TS, GLOB_TSX, GLOB_VUE } from './shared.js';
|
|
1
2
|
export function resolveOptions({ markdown = true, react = false, vue = false, } = {}) {
|
|
2
3
|
return {
|
|
3
4
|
markdown,
|
|
@@ -5,3 +6,9 @@ export function resolveOptions({ markdown = true, react = false, vue = false, }
|
|
|
5
6
|
vue,
|
|
6
7
|
};
|
|
7
8
|
}
|
|
9
|
+
export function resolveReactOptions({ files = [GLOB_TS, GLOB_TSX], } = {}) {
|
|
10
|
+
return { files };
|
|
11
|
+
}
|
|
12
|
+
export function resolveVueOptions({ files = [GLOB_VUE], } = {}) {
|
|
13
|
+
return { files };
|
|
14
|
+
}
|
package/dist/react.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
1
|
+
import { type ReactOptions } from './options.js';
|
|
2
|
+
import type { Config } from './types.js';
|
|
3
|
+
export declare function react(options?: ReactOptions): Config[];
|
package/dist/react.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import reactPlugin from 'eslint-plugin-react';
|
|
2
2
|
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
3
|
-
import {
|
|
4
|
-
export function react() {
|
|
5
|
-
const
|
|
3
|
+
import { resolveReactOptions } from './options.js';
|
|
4
|
+
export function react(options) {
|
|
5
|
+
const { files } = resolveReactOptions(options);
|
|
6
|
+
const reactRecommended = reactPlugin.configs.flat.recommended;
|
|
6
7
|
return [
|
|
7
8
|
{
|
|
8
9
|
...reactRecommended,
|
|
9
10
|
name: 'react',
|
|
10
|
-
files:
|
|
11
|
+
files: files,
|
|
11
12
|
settings: {
|
|
12
13
|
react: {
|
|
13
14
|
version: 'detect',
|
|
@@ -21,7 +22,7 @@ export function react() {
|
|
|
21
22
|
},
|
|
22
23
|
{
|
|
23
24
|
name: 'react-hooks',
|
|
24
|
-
files:
|
|
25
|
+
files: files,
|
|
25
26
|
plugins: {
|
|
26
27
|
'react-hooks': reactHooksPlugin,
|
|
27
28
|
},
|
package/dist/vue.d.ts
CHANGED
package/dist/vue.js
CHANGED
|
@@ -2,13 +2,14 @@ import prettierConfig from 'eslint-config-prettier';
|
|
|
2
2
|
import vuePlugin from 'eslint-plugin-vue';
|
|
3
3
|
import globals from 'globals';
|
|
4
4
|
import tseslint from 'typescript-eslint';
|
|
5
|
-
import {
|
|
6
|
-
export function vue() {
|
|
5
|
+
import { resolveVueOptions } from './options.js';
|
|
6
|
+
export function vue(options) {
|
|
7
|
+
const { files } = resolveVueOptions(options);
|
|
7
8
|
return [
|
|
8
9
|
...vuePlugin.configs['flat/recommended'],
|
|
9
10
|
{
|
|
10
11
|
name: 'vue:language-options',
|
|
11
|
-
files:
|
|
12
|
+
files: files,
|
|
12
13
|
languageOptions: {
|
|
13
14
|
ecmaVersion: 'latest',
|
|
14
15
|
sourceType: 'module',
|