@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 CHANGED
@@ -53,7 +53,7 @@ export interface ESLintConfigOptions {
53
53
  *
54
54
  * @default false
55
55
  */
56
- react?: boolean
56
+ react?: boolean | ReactOptions
57
57
 
58
58
  /**
59
59
  * Whether to enable Vue configuration.
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 { Linter } from 'eslint';
2
- export declare function react(): Linter.Config[];
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 { GLOB_TS, GLOB_TSX } from './shared.js';
4
- export function react() {
5
- const reactRecommended = reactPlugin.configs.flat?.recommended || {};
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: [GLOB_TS, GLOB_TSX],
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: [GLOB_TS, GLOB_TSX],
25
+ files: files,
25
26
  plugins: {
26
27
  'react-hooks': reactHooksPlugin,
27
28
  },
package/dist/vue.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  import type { Linter } from 'eslint';
2
- export declare function vue(): Linter.Config[];
2
+ import { type VueOptions } from './options.js';
3
+ export declare function vue(options?: VueOptions): Linter.Config[];
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 { GLOB_VUE } from './shared.js';
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: [GLOB_VUE],
12
+ files: files,
12
13
  languageOptions: {
13
14
  ecmaVersion: 'latest',
14
15
  sourceType: 'module',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ocavue/eslint-config",
3
3
  "type": "module",
4
- "version": "2.18.0",
4
+ "version": "2.19.0",
5
5
  "description": "",
6
6
  "author": "ocavue <ocavue@gmail.com>",
7
7
  "license": "MIT",