@vida0905/eslint-config 2.2.1 → 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 -79
- package/dist/index.js +14 -28
- package/package.json +21 -29
package/bin/index.js
CHANGED
|
File without changes
|
package/dist/cli/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,87 +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
|
-
* Never export an initialized named or default store.
|
|
20
|
-
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/never-export-initialized-store.md
|
|
21
|
-
*/
|
|
22
|
-
'pinia/never-export-initialized-store'?: Linter.RuleEntry<[]>;
|
|
23
|
-
/**
|
|
24
|
-
* Disallow duplicate store ids.
|
|
25
|
-
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/no-duplicate-store-ids.md
|
|
26
|
-
*/
|
|
27
|
-
'pinia/no-duplicate-store-ids'?: Linter.RuleEntry<[]>;
|
|
28
|
-
/**
|
|
29
|
-
* Disallows returning globally provided properties from Pinia stores.
|
|
30
|
-
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/no-return-global-properties.md
|
|
31
|
-
*/
|
|
32
|
-
'pinia/no-return-global-properties'?: Linter.RuleEntry<[]>;
|
|
33
|
-
/**
|
|
34
|
-
* Disallow use of storeToRefs inside defineStore
|
|
35
|
-
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/no-store-to-refs-in-store.md
|
|
36
|
-
*/
|
|
37
|
-
'pinia/no-store-to-refs-in-store'?: Linter.RuleEntry<[]>;
|
|
38
|
-
/**
|
|
39
|
-
* Encourages defining each store in a separate file.
|
|
40
|
-
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/prefer-single-store-per-file.md
|
|
41
|
-
*/
|
|
42
|
-
'pinia/prefer-single-store-per-file'?: Linter.RuleEntry<[]>;
|
|
43
|
-
/**
|
|
44
|
-
* Enforces the convention of naming stores with the prefix `use` followed by the store name.
|
|
45
|
-
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/prefer-use-store-naming-convention.md
|
|
46
|
-
*/
|
|
47
|
-
'pinia/prefer-use-store-naming-convention'?: Linter.RuleEntry<PiniaPreferUseStoreNamingConvention>;
|
|
48
|
-
/**
|
|
49
|
-
* In setup stores all state properties must be exported.
|
|
50
|
-
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/require-setup-store-properties-export.md
|
|
51
|
-
*/
|
|
52
|
-
'pinia/require-setup-store-properties-export'?: Linter.RuleEntry<[]>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/* ======= Declarations ======= */
|
|
56
|
-
// ----- pinia/prefer-use-store-naming-convention -----
|
|
57
|
-
type PiniaPreferUseStoreNamingConvention = [] | [{
|
|
58
|
-
checkStoreNameMismatch?: boolean;
|
|
59
|
-
storeSuffix?: string;
|
|
60
|
-
[k: string]: unknown | undefined;
|
|
61
|
-
}];
|
|
62
|
-
// Names of all the configs
|
|
63
|
-
//#endregion
|
|
64
5
|
//#region src/types.d.ts
|
|
65
|
-
|
|
66
|
-
type
|
|
67
|
-
/**
|
|
68
|
-
* 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.
|
|
69
|
-
*
|
|
70
|
-
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
71
|
-
*/
|
|
72
|
-
plugins?: Record<string, any>;
|
|
73
|
-
};
|
|
74
|
-
interface OptionsOverrides {
|
|
75
|
-
overrides?: TypedFlatConfigItem$1["rules"];
|
|
76
|
-
}
|
|
77
|
-
type OptionsConfig$1 = Omit<OptionsConfig, "overrides"> & {
|
|
78
|
-
/**
|
|
79
|
-
* Enable Pinia support.
|
|
80
|
-
*
|
|
81
|
-
* @default auto-detect based on the dependencies
|
|
82
|
-
*/
|
|
83
|
-
pinia?: boolean | OptionsOverrides;
|
|
84
|
-
};
|
|
6
|
+
|
|
7
|
+
type OptionsConfig$1 = Omit<OptionsConfig, "overrides"> & {};
|
|
85
8
|
//#endregion
|
|
86
9
|
//#region src/utils.d.ts
|
|
87
10
|
declare function deepMerge<T extends object>(target: T, source: T): T;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import antfu, {
|
|
2
|
-
import { createOxcImportResolver } from "eslint-import-resolver-oxc";
|
|
1
|
+
import antfu, { GLOB_SRC, ensurePackages, interopDefault } from "@antfu/eslint-config";
|
|
3
2
|
import { isPackageExists } from "local-pkg";
|
|
4
|
-
import
|
|
3
|
+
import pluginDeMorgan from "eslint-plugin-de-morgan";
|
|
5
4
|
|
|
6
5
|
export * from "@antfu/eslint-config"
|
|
7
6
|
|
|
@@ -11,32 +10,23 @@ function deMorgan(options = {}) {
|
|
|
11
10
|
return [{
|
|
12
11
|
name: "vida/de-morgan/rules",
|
|
13
12
|
files,
|
|
14
|
-
...
|
|
13
|
+
...pluginDeMorgan.configs.recommended
|
|
15
14
|
}];
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
//#endregion
|
|
19
|
-
//#region src/configs/
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const
|
|
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"));
|
|
24
23
|
return [{
|
|
25
|
-
name: "vida/
|
|
24
|
+
name: "vida/nuxt/rules",
|
|
26
25
|
files,
|
|
27
|
-
plugins: {
|
|
26
|
+
plugins: { nuxt: pluginNuxt },
|
|
28
27
|
rules: {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"pinia/prefer-use-store-naming-convention": ["error", {
|
|
32
|
-
checkStoreNameMismatch: true,
|
|
33
|
-
storeSuffix: "Store"
|
|
34
|
-
}],
|
|
35
|
-
"pinia/require-setup-store-properties-export": "warn",
|
|
36
|
-
"pinia/no-duplicate-store-ids": "error",
|
|
37
|
-
"pinia/no-return-global-properties": "error",
|
|
38
|
-
"pinia/no-store-to-refs-in-store": "error",
|
|
39
|
-
...overrides$1
|
|
28
|
+
"nuxt/prefer-import-meta": "error",
|
|
29
|
+
"nuxt/nuxt-config-keys-order": "error"
|
|
40
30
|
}
|
|
41
31
|
}];
|
|
42
32
|
}
|
|
@@ -86,9 +76,8 @@ function deepMerge(target, source) {
|
|
|
86
76
|
//#endregion
|
|
87
77
|
//#region src/index.ts
|
|
88
78
|
function defineConfig(options = {}, ...userConfigs) {
|
|
89
|
-
const { pinia: enablePinia = isPackageExists("pinia") } = options;
|
|
90
79
|
const configs = [deMorgan()];
|
|
91
|
-
if (
|
|
80
|
+
if (isPackageExists("nuxt")) configs.push(nuxt());
|
|
92
81
|
const antfuConfig = {
|
|
93
82
|
stylistic: {
|
|
94
83
|
indent: 2,
|
|
@@ -99,10 +88,7 @@ function defineConfig(options = {}, ...userConfigs) {
|
|
|
99
88
|
javascript: { overrides: overrides.javascript },
|
|
100
89
|
vue: { overrides: overrides.vue }
|
|
101
90
|
};
|
|
102
|
-
return antfu(deepMerge(antfuConfig, options), ...configs, ...userConfigs)
|
|
103
|
-
name: "vida/imports/setup",
|
|
104
|
-
settings: { "import-x/resolver-next": [createOxcImportResolver()] }
|
|
105
|
-
});
|
|
91
|
+
return antfu(deepMerge(antfuConfig, options), ...configs, ...userConfigs);
|
|
106
92
|
}
|
|
107
93
|
var src_default = defineConfig;
|
|
108
94
|
|
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,52 +26,45 @@
|
|
|
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": {
|
|
40
|
-
"eslint": "
|
|
41
|
-
"
|
|
30
|
+
"@nuxt/eslint-plugin": "*",
|
|
31
|
+
"eslint": ">=9.10.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependenciesMeta": {
|
|
34
|
+
"@nuxt/eslint-plugin": {
|
|
35
|
+
"optional": true
|
|
36
|
+
}
|
|
42
37
|
},
|
|
43
38
|
"dependencies": {
|
|
44
|
-
"@antfu/eslint-config": "^4.
|
|
39
|
+
"@antfu/eslint-config": "^4.14.1",
|
|
45
40
|
"ansis": "^4.1.0",
|
|
46
41
|
"cac": "^6.7.14",
|
|
47
42
|
"eslint-flat-config-utils": "^2.1.0",
|
|
48
|
-
"eslint-
|
|
49
|
-
"eslint-plugin-de-morgan": "^1.2.1",
|
|
50
|
-
"eslint-plugin-pinia": "^0.4.1",
|
|
43
|
+
"eslint-plugin-de-morgan": "^1.3.0",
|
|
51
44
|
"local-pkg": "^1.1.1"
|
|
52
45
|
},
|
|
53
46
|
"devDependencies": {
|
|
54
|
-
"@types/node": "^
|
|
47
|
+
"@types/node": "^24.0.1",
|
|
55
48
|
"eslint": "^9.28.0",
|
|
56
49
|
"eslint-typegen": "^2.2.0",
|
|
57
50
|
"nano-staged": "^0.8.0",
|
|
58
51
|
"simple-git-hooks": "^2.13.0",
|
|
59
52
|
"tsdown": "^0.12.7",
|
|
60
|
-
"tsx": "^4.
|
|
53
|
+
"tsx": "^4.20.1",
|
|
61
54
|
"typescript": "^5.8.3"
|
|
62
55
|
},
|
|
63
|
-
"pnpm": {
|
|
64
|
-
"overrides": {
|
|
65
|
-
"eslint-import-resolver-node": "-",
|
|
66
|
-
"unrs-resolver": "-"
|
|
67
|
-
},
|
|
68
|
-
"patchedDependencies": {
|
|
69
|
-
"eslint-plugin-import-x": "patches/eslint-plugin-import-x.patch"
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
56
|
"simple-git-hooks": {
|
|
73
57
|
"pre-commit": "npx nano-staged"
|
|
74
58
|
},
|
|
75
59
|
"nano-staged": {
|
|
76
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"
|
|
77
69
|
}
|
|
78
|
-
}
|
|
70
|
+
}
|