@ocavue/eslint-config 2.17.0 → 2.18.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 +32 -22
- package/dist/ignores.js +4 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +23 -2
- package/dist/options.d.ts +21 -0
- package/dist/options.js +7 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +1 -0
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -23,36 +23,45 @@ In your `eslint.config.js` file, add the following to extend the basic config:
|
|
|
23
23
|
|
|
24
24
|
```js
|
|
25
25
|
// eslint.config.js
|
|
26
|
-
import {
|
|
26
|
+
import { defineESLintConfig } from '@ocavue/eslint-config'
|
|
27
27
|
|
|
28
|
-
export default
|
|
28
|
+
export default defineESLintConfig()
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
You can pass an optional object to the `defineESLintConfig` function to enable or disable the configs. For example, if you want to enable the React config, you can do the following:
|
|
32
32
|
|
|
33
33
|
```js
|
|
34
34
|
// eslint.config.js
|
|
35
|
-
import {
|
|
35
|
+
import { defineESLintConfig } from '@ocavue/eslint-config'
|
|
36
36
|
|
|
37
|
-
export default
|
|
37
|
+
export default defineESLintConfig({ react: true })
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
40
|
+
The full type definition for the options is as follows:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
export interface ESLintConfigOptions {
|
|
44
|
+
/**
|
|
45
|
+
* Whether to check code blocks in Markdown files.
|
|
46
|
+
*
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
markdown?: boolean
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Whether to enable React configuration.
|
|
53
|
+
*
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
react?: boolean
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Whether to enable Vue configuration.
|
|
60
|
+
*
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
vue?: boolean
|
|
64
|
+
}
|
|
56
65
|
```
|
|
57
66
|
|
|
58
67
|
### Add script for package.json
|
|
@@ -86,7 +95,8 @@ If you are using VS Code, you and install [ESLint extension](https://marketplace
|
|
|
86
95
|
}
|
|
87
96
|
```
|
|
88
97
|
|
|
89
|
-
##
|
|
98
|
+
## Alternative solutions
|
|
90
99
|
|
|
91
100
|
- https://github.com/antfu/eslint-config
|
|
92
101
|
- https://github.com/sxzz/eslint-config
|
|
102
|
+
- https://github.com/ntnyq/eslint-config
|
package/dist/ignores.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import gitignore from 'eslint-config-flat-gitignore';
|
|
2
2
|
import { GLOB_EXCLUDE } from './shared.js';
|
|
3
3
|
export function ignores() {
|
|
4
|
-
return [
|
|
4
|
+
return [
|
|
5
|
+
{ ignores: [...GLOB_EXCLUDE], name: 'basic-global-ignores' },
|
|
6
|
+
gitignore(),
|
|
7
|
+
];
|
|
5
8
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { type ESLintConfigOptions } from './options.js';
|
|
2
|
+
import type { Config } from './types.js';
|
|
3
3
|
export * from './basic.js';
|
|
4
4
|
export * from './markdown.js';
|
|
5
|
+
export * from './prettier.js';
|
|
5
6
|
export * from './react.js';
|
|
7
|
+
export * from './typescript.js';
|
|
6
8
|
export * from './vue.js';
|
|
9
|
+
export type { Config, ESLintConfigOptions };
|
|
10
|
+
export declare function defineESLintConfig(options?: ESLintConfigOptions): Config[];
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import { basic } from './basic.js';
|
|
3
|
+
import { markdown } from './markdown.js';
|
|
4
|
+
import { resolveOptions } from './options.js';
|
|
5
|
+
import { react } from './react.js';
|
|
6
|
+
import { vue } from './vue.js';
|
|
3
7
|
export * from './basic.js';
|
|
4
8
|
export * from './markdown.js';
|
|
9
|
+
export * from './prettier.js';
|
|
5
10
|
export * from './react.js';
|
|
11
|
+
export * from './typescript.js';
|
|
6
12
|
export * from './vue.js';
|
|
13
|
+
export function defineESLintConfig(options) {
|
|
14
|
+
const resolvedOptions = resolveOptions(options);
|
|
15
|
+
const configs = [];
|
|
16
|
+
configs.push(...basic());
|
|
17
|
+
if (resolvedOptions.markdown) {
|
|
18
|
+
configs.push(...markdown());
|
|
19
|
+
}
|
|
20
|
+
if (resolvedOptions.react) {
|
|
21
|
+
configs.push(...react());
|
|
22
|
+
}
|
|
23
|
+
if (resolvedOptions.vue) {
|
|
24
|
+
configs.push(...vue());
|
|
25
|
+
}
|
|
26
|
+
return defineConfig(configs);
|
|
27
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ESLintConfigOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Whether to check code blocks in Markdown files.
|
|
4
|
+
*
|
|
5
|
+
* @default true
|
|
6
|
+
*/
|
|
7
|
+
markdown?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to enable React configuration.
|
|
10
|
+
*
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
react?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether to enable Vue configuration.
|
|
16
|
+
*
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
vue?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function resolveOptions({ markdown, react, vue, }?: ESLintConfigOptions): Required<ESLintConfigOptions>;
|
package/dist/options.js
ADDED
package/dist/types.d.ts
ADDED
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocavue/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.18.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "ocavue <ocavue@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"@eslint/js": "^9.26.0",
|
|
32
32
|
"@eslint/markdown": "^6.4.0",
|
|
33
33
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
34
|
-
"eslint-config-prettier": "^10.1.
|
|
35
|
-
"eslint-import-resolver-typescript": "^4.3.
|
|
34
|
+
"eslint-config-prettier": "^10.1.5",
|
|
35
|
+
"eslint-import-resolver-typescript": "^4.3.5",
|
|
36
36
|
"eslint-plugin-antfu": "^3.1.1",
|
|
37
|
-
"eslint-plugin-import-x": "^4.
|
|
37
|
+
"eslint-plugin-import-x": "^4.12.2",
|
|
38
38
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
39
39
|
"eslint-plugin-package-json": "^0.31.0",
|
|
40
40
|
"eslint-plugin-react": "^7.37.5",
|
|
@@ -42,17 +42,16 @@
|
|
|
42
42
|
"eslint-plugin-unicorn": "^59.0.1",
|
|
43
43
|
"eslint-plugin-vue": "^10.1.0",
|
|
44
44
|
"globals": "^16.1.0",
|
|
45
|
-
"typescript-eslint": "^8.32.
|
|
45
|
+
"typescript-eslint": "^8.32.1",
|
|
46
46
|
"vue-eslint-parser": "^10.1.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@ocavue/tsconfig": "^0.3.7",
|
|
50
|
-
"@types/eslint-config-prettier": "^6.11.3",
|
|
51
50
|
"@types/node": "^20.17.9",
|
|
52
|
-
"@typescript-eslint/utils": "^8.32.
|
|
51
|
+
"@typescript-eslint/utils": "^8.32.1",
|
|
53
52
|
"eslint": "^9.26.0",
|
|
54
53
|
"jiti": "^2.4.2",
|
|
55
|
-
"pkg-pr-new": "^0.0.
|
|
54
|
+
"pkg-pr-new": "^0.0.50",
|
|
56
55
|
"prettier": "^3.5.3",
|
|
57
56
|
"typescript": "^5.8.3"
|
|
58
57
|
},
|