@vida0905/eslint-config 2.5.3 → 2.6.1
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 +10 -6
- package/dist/cli/index.js +3 -2
- package/dist/index.d.ts +24 -14
- package/dist/index.js +10 -7
- package/package.json +12 -8
package/README.md
CHANGED
|
@@ -4,24 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
Self use eslint config, extends [antfu's config](https://github.com/antfu/eslint-config)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Difference
|
|
8
8
|
|
|
9
9
|
- More stricter rules.
|
|
10
|
-
- Support `pinia`.
|
|
11
10
|
- Disable `jsx` by default.
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
## Setup
|
|
14
13
|
|
|
15
14
|
```shell
|
|
16
|
-
npm i -D @
|
|
15
|
+
npm i -D @vida0905/eslint-config
|
|
17
16
|
```
|
|
18
17
|
|
|
19
18
|
in `eslint.config.js`
|
|
20
19
|
|
|
21
20
|
```js
|
|
22
|
-
import {
|
|
21
|
+
import { defineConfig } from '@vida0905/eslint-config'
|
|
23
22
|
|
|
24
|
-
export default
|
|
23
|
+
export default defineConfig()
|
|
25
24
|
```
|
|
26
25
|
|
|
27
26
|
in `.vscode/settings.json`, more info to [@antfu/eslint-config](https://github.com/antfu/eslint-config?tab=readme-ov-file#vs-code-support-auto-fix-on-save)
|
|
@@ -81,3 +80,8 @@ in `.vscode/settings.json`, more info to [@antfu/eslint-config](https://github.c
|
|
|
81
80
|
]
|
|
82
81
|
}
|
|
83
82
|
```
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
- [MIT](https://github.com/9romise/eslint-config?tab=MIT-1-ov-file) License © 2024-PRESENT [Vida Xie](https://github.com/9romise)
|
|
87
|
+
- @antfu/eslint-config - [MIT](https://github.com/antfu/eslint-config?tab=MIT-1-ov-file) License
|
package/dist/cli/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import path from "node:path";
|
|
|
6
6
|
import { green } from "ansis";
|
|
7
7
|
|
|
8
8
|
//#region package.json
|
|
9
|
-
var version = "2.
|
|
9
|
+
var version = "2.6.1";
|
|
10
10
|
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/cli/constants.ts
|
|
@@ -103,4 +103,5 @@ cli.help();
|
|
|
103
103
|
cli.version(version);
|
|
104
104
|
cli.parse();
|
|
105
105
|
|
|
106
|
-
//#endregion
|
|
106
|
+
//#endregion
|
|
107
|
+
export { };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Awaitable, ConfigNames, OptionsConfig, TypedFlatConfigItem } from "@antfu/eslint-config";
|
|
1
|
+
import { Awaitable, ConfigNames, OptionsConfig, OptionsFiles, TypedFlatConfigItem } from "@antfu/eslint-config";
|
|
2
2
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
3
3
|
import { Linter } from "eslint";
|
|
4
4
|
export * from "@antfu/eslint-config";
|
|
@@ -26,27 +26,37 @@ interface RuleOptions {
|
|
|
26
26
|
*/
|
|
27
27
|
'nuxt/prefer-import-meta'?: Linter.RuleEntry<[]>;
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
/* ======= Declarations ======= */
|
|
31
|
-
|
|
32
|
-
// Names of all the configs
|
|
33
29
|
//#endregion
|
|
34
30
|
//#region src/types.d.ts
|
|
35
31
|
interface Rules extends RuleOptions {}
|
|
36
|
-
type TypedFlatConfigItem$1 = Omit<Linter.Config<Linter.RulesRecord & Rules>,
|
|
32
|
+
type TypedFlatConfigItem$1 = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins"> & {
|
|
37
33
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
* 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.
|
|
35
|
+
*
|
|
36
|
+
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
37
|
+
*/
|
|
42
38
|
plugins?: Record<string, any>;
|
|
43
39
|
};
|
|
44
40
|
interface OptionsOverrides {
|
|
45
|
-
overrides?: TypedFlatConfigItem$1[
|
|
41
|
+
overrides?: TypedFlatConfigItem$1["rules"];
|
|
46
42
|
}
|
|
47
|
-
type OptionsConfig$1 = Omit<OptionsConfig,
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
type OptionsConfig$1 = Omit<OptionsConfig, "overrides"> & {
|
|
44
|
+
/**
|
|
45
|
+
* Enable de-morgan rules.
|
|
46
|
+
*
|
|
47
|
+
* @see https://github.com/azat-io/eslint-plugin-de-morgan
|
|
48
|
+
* @default true
|
|
49
|
+
*/
|
|
50
|
+
deMorgan?: boolean | OptionsFiles;
|
|
51
|
+
/**
|
|
52
|
+
* Enable Nuxt.js rules.
|
|
53
|
+
*
|
|
54
|
+
* Requires installing:
|
|
55
|
+
* - [`@nuxt/eslint-plugin`](https://eslint.nuxt.com/packages/plugin)
|
|
56
|
+
*
|
|
57
|
+
* @default auto-detect based on the dependencies
|
|
58
|
+
*/
|
|
59
|
+
nuxt?: boolean | OptionsOverrides & OptionsFiles;
|
|
50
60
|
};
|
|
51
61
|
//#endregion
|
|
52
62
|
//#region src/utils.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import antfu, { GLOB_SRC, ensurePackages, interopDefault } from "@antfu/eslint-config";
|
|
2
2
|
import { isPackageExists } from "local-pkg";
|
|
3
|
-
import pluginDeMorgan from "eslint-plugin-de-morgan";
|
|
4
3
|
|
|
5
4
|
export * from "@antfu/eslint-config"
|
|
6
5
|
|
|
7
6
|
//#region src/configs/de-morgan.ts
|
|
8
|
-
function deMorgan(options = {}) {
|
|
7
|
+
async function deMorgan(options = {}) {
|
|
9
8
|
const { files = [GLOB_SRC] } = options;
|
|
9
|
+
const pluginDeMorgan = await interopDefault(import("eslint-plugin-de-morgan"));
|
|
10
10
|
return [{
|
|
11
11
|
name: "vida/de-morgan/rules",
|
|
12
12
|
files,
|
|
@@ -17,16 +17,19 @@ function deMorgan(options = {}) {
|
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/configs/nuxt.ts
|
|
19
19
|
async function nuxt(options = {}) {
|
|
20
|
-
const { files = [GLOB_SRC] } = options;
|
|
20
|
+
const { files = [GLOB_SRC], overrides = {} } = options;
|
|
21
21
|
await ensurePackages(["@nuxt/eslint-plugin"]);
|
|
22
|
-
const pluginNuxt = await interopDefault(import("@nuxt/eslint-plugin"));
|
|
23
22
|
return [{
|
|
23
|
+
name: "vida/nuxt/setup",
|
|
24
|
+
languageOptions: { globals: { defineNuxtConfig: "readonly" } },
|
|
25
|
+
plugins: { nuxt: await interopDefault(import("@nuxt/eslint-plugin")) }
|
|
26
|
+
}, {
|
|
24
27
|
name: "vida/nuxt/rules",
|
|
25
28
|
files,
|
|
26
|
-
plugins: { nuxt: pluginNuxt },
|
|
27
29
|
rules: {
|
|
28
30
|
"nuxt/prefer-import-meta": "error",
|
|
29
|
-
"nuxt/nuxt-config-keys-order": "error"
|
|
31
|
+
"nuxt/nuxt-config-keys-order": "error",
|
|
32
|
+
...overrides
|
|
30
33
|
}
|
|
31
34
|
}];
|
|
32
35
|
}
|
|
@@ -113,7 +116,7 @@ function deepMerge(target, source) {
|
|
|
113
116
|
//#endregion
|
|
114
117
|
//#region src/index.ts
|
|
115
118
|
function defineConfig(options = {}, ...userConfigs) {
|
|
116
|
-
const { deMorgan: enableDeMorgan, nuxt: enableNuxt = isPackageExists("nuxt") } = options;
|
|
119
|
+
const { deMorgan: enableDeMorgan = true, nuxt: enableNuxt = isPackageExists("nuxt") } = options;
|
|
117
120
|
const configs = [];
|
|
118
121
|
if (enableDeMorgan) configs.push(deMorgan());
|
|
119
122
|
if (enableNuxt) configs.push(nuxt());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vida0905/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.6.1",
|
|
5
5
|
"description": "Vida Xie's ESLint Config",
|
|
6
6
|
"author": "Vida Xie <vida_2020@163.com> (https://github.com/9romise/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -28,29 +28,33 @@
|
|
|
28
28
|
],
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@nuxt/eslint-plugin": "*",
|
|
31
|
+
"@unocss/eslint-plugin": "*",
|
|
31
32
|
"eslint": ">=9.10.0"
|
|
32
33
|
},
|
|
33
34
|
"peerDependenciesMeta": {
|
|
34
35
|
"@nuxt/eslint-plugin": {
|
|
35
36
|
"optional": true
|
|
37
|
+
},
|
|
38
|
+
"@unocss/eslint-plugin": {
|
|
39
|
+
"optional": true
|
|
36
40
|
}
|
|
37
41
|
},
|
|
38
42
|
"dependencies": {
|
|
39
|
-
"@antfu/eslint-config": "^5.
|
|
43
|
+
"@antfu/eslint-config": "^5.3.0",
|
|
40
44
|
"ansis": "^4.1.0",
|
|
41
45
|
"cac": "^6.7.14",
|
|
42
46
|
"eslint-flat-config-utils": "^2.1.1",
|
|
43
47
|
"eslint-plugin-de-morgan": "^1.3.1",
|
|
44
|
-
"local-pkg": "^1.1.
|
|
48
|
+
"local-pkg": "^1.1.2"
|
|
45
49
|
},
|
|
46
50
|
"devDependencies": {
|
|
47
|
-
"@types/node": "^24.
|
|
48
|
-
"eslint": "^9.
|
|
51
|
+
"@types/node": "^24.3.3",
|
|
52
|
+
"eslint": "^9.35.0",
|
|
49
53
|
"eslint-typegen": "^2.3.0",
|
|
50
54
|
"husky": "^9.1.7",
|
|
51
55
|
"nano-staged": "^0.8.0",
|
|
52
|
-
"tsdown": "^0.
|
|
53
|
-
"tsx": "^4.20.
|
|
56
|
+
"tsdown": "^0.15.1",
|
|
57
|
+
"tsx": "^4.20.5",
|
|
54
58
|
"typescript": "^5.9.2",
|
|
55
59
|
"vitest": "^3.2.4"
|
|
56
60
|
},
|
|
@@ -65,6 +69,6 @@
|
|
|
65
69
|
"test": "vitest",
|
|
66
70
|
"lint": "eslint .",
|
|
67
71
|
"check": "npm run typecheck && npm run lint",
|
|
68
|
-
"inspect": "npx @eslint/config-inspector"
|
|
72
|
+
"inspect": "npx @eslint/config-inspector --config eslint-inspector.config.ts"
|
|
69
73
|
}
|
|
70
74
|
}
|