@vida0905/eslint-config 2.3.0 → 2.4.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/bin/index.js +0 -0
- package/dist/cli/index.js +1 -1
- package/dist/index.d.ts +2 -39
- package/dist/index.js +22 -3
- package/package.json +20 -15
package/bin/index.js
CHANGED
|
File without changes
|
package/dist/cli/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,47 +1,10 @@
|
|
|
1
1
|
import { ConfigNames, OptionsConfig, TypedFlatConfigItem } from "@antfu/eslint-config";
|
|
2
2
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
3
|
-
import { Linter } from "eslint";
|
|
4
3
|
export * from "@antfu/eslint-config";
|
|
5
4
|
|
|
6
|
-
//#region src/typegen.d.ts
|
|
7
|
-
interface RuleOptions {
|
|
8
|
-
/**
|
|
9
|
-
* Transforms the negation of a conjunction !(A && B) into the equivalent !A || !B according to De Morgan’s law
|
|
10
|
-
* @see https://github.com/azat-io/eslint-plugin-de-morgan/blob/main/docs/no-negated-conjunction.md
|
|
11
|
-
*/
|
|
12
|
-
'de-morgan/no-negated-conjunction'?: Linter.RuleEntry<[]>;
|
|
13
|
-
/**
|
|
14
|
-
* Transforms the negation of a disjunction !(A || B) into the equivalent !A && !B according to De Morgan’s law
|
|
15
|
-
* @see https://github.com/azat-io/eslint-plugin-de-morgan/blob/main/docs/no-negated-disjunction.md
|
|
16
|
-
*/
|
|
17
|
-
'de-morgan/no-negated-disjunction'?: Linter.RuleEntry<[]>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/* ======= Declarations ======= */
|
|
21
|
-
|
|
22
|
-
// Names of all the configs
|
|
23
|
-
//#endregion
|
|
24
5
|
//#region src/types.d.ts
|
|
25
|
-
|
|
26
|
-
type
|
|
27
|
-
/**
|
|
28
|
-
* 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.
|
|
29
|
-
*
|
|
30
|
-
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
31
|
-
*/
|
|
32
|
-
plugins?: Record<string, any>;
|
|
33
|
-
};
|
|
34
|
-
interface OptionsOverrides {
|
|
35
|
-
overrides?: TypedFlatConfigItem$1["rules"];
|
|
36
|
-
}
|
|
37
|
-
type OptionsConfig$1 = Omit<OptionsConfig, "overrides"> & {
|
|
38
|
-
/**
|
|
39
|
-
* Enable Pinia support.
|
|
40
|
-
*
|
|
41
|
-
* @default auto-detect based on the dependencies
|
|
42
|
-
*/
|
|
43
|
-
pinia?: boolean | OptionsOverrides;
|
|
44
|
-
};
|
|
6
|
+
|
|
7
|
+
type OptionsConfig$1 = Omit<OptionsConfig, "overrides"> & {};
|
|
45
8
|
//#endregion
|
|
46
9
|
//#region src/utils.d.ts
|
|
47
10
|
declare function deepMerge<T extends object>(target: T, source: T): T;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import antfu, { GLOB_SRC } from "@antfu/eslint-config";
|
|
2
|
-
import
|
|
1
|
+
import antfu, { GLOB_SRC, ensurePackages, interopDefault } from "@antfu/eslint-config";
|
|
2
|
+
import { isPackageExists } from "local-pkg";
|
|
3
|
+
import pluginDeMorgan from "eslint-plugin-de-morgan";
|
|
3
4
|
|
|
4
5
|
export * from "@antfu/eslint-config"
|
|
5
6
|
|
|
@@ -9,7 +10,24 @@ function deMorgan(options = {}) {
|
|
|
9
10
|
return [{
|
|
10
11
|
name: "vida/de-morgan/rules",
|
|
11
12
|
files,
|
|
12
|
-
...
|
|
13
|
+
...pluginDeMorgan.configs.recommended
|
|
14
|
+
}];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/configs/nuxt.ts
|
|
19
|
+
async function nuxt(options = {}) {
|
|
20
|
+
const { files = [GLOB_SRC] } = options;
|
|
21
|
+
await ensurePackages(["@nuxt/eslint-plugin"]);
|
|
22
|
+
const pluginNuxt = await interopDefault(import("@nuxt/eslint-plugin"));
|
|
23
|
+
return [{
|
|
24
|
+
name: "vida/nuxt/rules",
|
|
25
|
+
files,
|
|
26
|
+
plugins: { nuxt: pluginNuxt },
|
|
27
|
+
rules: {
|
|
28
|
+
"nuxt/prefer-import-meta": "error",
|
|
29
|
+
"nuxt/nuxt-config-keys-order": "error"
|
|
30
|
+
}
|
|
13
31
|
}];
|
|
14
32
|
}
|
|
15
33
|
|
|
@@ -59,6 +77,7 @@ function deepMerge(target, source) {
|
|
|
59
77
|
//#region src/index.ts
|
|
60
78
|
function defineConfig(options = {}, ...userConfigs) {
|
|
61
79
|
const configs = [deMorgan()];
|
|
80
|
+
if (isPackageExists("nuxt")) configs.push(nuxt());
|
|
62
81
|
const antfuConfig = {
|
|
63
82
|
stylistic: {
|
|
64
83
|
indent: 2,
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vida0905/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
5
|
-
"packageManager": "pnpm@10.11.1",
|
|
4
|
+
"version": "2.4.0",
|
|
6
5
|
"description": "Vida Xie's ESLint Config",
|
|
7
6
|
"author": "Vida Xie <vida_2020@163.com> (https://github.com/9romise/)",
|
|
8
7
|
"license": "MIT",
|
|
@@ -27,33 +26,31 @@
|
|
|
27
26
|
"bin",
|
|
28
27
|
"dist"
|
|
29
28
|
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"dev": "tsdown --watch",
|
|
32
|
-
"build": "tsdown",
|
|
33
|
-
"typegen": "tsx scripts/typegen",
|
|
34
|
-
"typecheck": "tsc --noEmit",
|
|
35
|
-
"lint": "eslint .",
|
|
36
|
-
"check": "npm run typecheck && npm run lint",
|
|
37
|
-
"prepare": "npm run typegen && npm run build"
|
|
38
|
-
},
|
|
39
29
|
"peerDependencies": {
|
|
30
|
+
"@nuxt/eslint-plugin": "*",
|
|
40
31
|
"eslint": ">=9.10.0"
|
|
41
32
|
},
|
|
33
|
+
"peerDependenciesMeta": {
|
|
34
|
+
"@nuxt/eslint-plugin": {
|
|
35
|
+
"optional": true
|
|
36
|
+
}
|
|
37
|
+
},
|
|
42
38
|
"dependencies": {
|
|
43
39
|
"@antfu/eslint-config": "^4.14.1",
|
|
44
40
|
"ansis": "^4.1.0",
|
|
45
41
|
"cac": "^6.7.14",
|
|
46
42
|
"eslint-flat-config-utils": "^2.1.0",
|
|
47
|
-
"eslint-plugin-de-morgan": "^1.
|
|
43
|
+
"eslint-plugin-de-morgan": "^1.3.0",
|
|
44
|
+
"local-pkg": "^1.1.1"
|
|
48
45
|
},
|
|
49
46
|
"devDependencies": {
|
|
50
|
-
"@types/node": "^
|
|
47
|
+
"@types/node": "^24.0.1",
|
|
51
48
|
"eslint": "^9.28.0",
|
|
52
49
|
"eslint-typegen": "^2.2.0",
|
|
53
50
|
"nano-staged": "^0.8.0",
|
|
54
51
|
"simple-git-hooks": "^2.13.0",
|
|
55
52
|
"tsdown": "^0.12.7",
|
|
56
|
-
"tsx": "^4.
|
|
53
|
+
"tsx": "^4.20.1",
|
|
57
54
|
"typescript": "^5.8.3"
|
|
58
55
|
},
|
|
59
56
|
"simple-git-hooks": {
|
|
@@ -61,5 +58,13 @@
|
|
|
61
58
|
},
|
|
62
59
|
"nano-staged": {
|
|
63
60
|
"*": "eslint --fix"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"dev": "tsdown --watch",
|
|
64
|
+
"build": "tsdown",
|
|
65
|
+
"typegen": "tsx scripts/typegen",
|
|
66
|
+
"typecheck": "tsc --noEmit",
|
|
67
|
+
"lint": "eslint .",
|
|
68
|
+
"check": "npm run typecheck && npm run lint"
|
|
64
69
|
}
|
|
65
|
-
}
|
|
70
|
+
}
|