@vida0905/eslint-config 0.3.0 → 0.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/dist/index.d.ts +62 -4
- package/dist/index.js +30 -23
- package/package.json +12 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,76 @@
|
|
|
1
1
|
import * as eslint_flat_config_utils from 'eslint-flat-config-utils';
|
|
2
2
|
import * as _antfu_eslint_config from '@antfu/eslint-config';
|
|
3
|
-
import { antfu, TypedFlatConfigItem } from '@antfu/eslint-config';
|
|
3
|
+
import { antfu, TypedFlatConfigItem as TypedFlatConfigItem$1 } from '@antfu/eslint-config';
|
|
4
4
|
export * from '@antfu/eslint-config';
|
|
5
|
+
import { Linter } from 'eslint';
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
/* prettier-ignore */
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
interface RuleOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Never export an initialized named or default store.
|
|
14
|
+
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/never-export-initialized-store.md
|
|
15
|
+
*/
|
|
16
|
+
'pinia/never-export-initialized-store'?: Linter.RuleEntry<[]>
|
|
17
|
+
/**
|
|
18
|
+
* Disallow duplicate store ids.
|
|
19
|
+
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/no-duplicate-store-ids.md
|
|
20
|
+
*/
|
|
21
|
+
'pinia/no-duplicate-store-ids'?: Linter.RuleEntry<[]>
|
|
22
|
+
/**
|
|
23
|
+
* Disallows returning globally provided properties from Pinia stores.
|
|
24
|
+
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/no-return-global-properties.md
|
|
25
|
+
*/
|
|
26
|
+
'pinia/no-return-global-properties'?: Linter.RuleEntry<[]>
|
|
27
|
+
/**
|
|
28
|
+
* Encourages defining each store in a separate file.
|
|
29
|
+
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/prefer-single-store-per-file.md
|
|
30
|
+
*/
|
|
31
|
+
'pinia/prefer-single-store-per-file'?: Linter.RuleEntry<[]>
|
|
32
|
+
/**
|
|
33
|
+
* Enforces the convention of naming stores with the prefix `use` followed by the store name.
|
|
34
|
+
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/prefer-use-store-naming-convention.md
|
|
35
|
+
*/
|
|
36
|
+
'pinia/prefer-use-store-naming-convention'?: Linter.RuleEntry<PiniaPreferUseStoreNamingConvention>
|
|
37
|
+
/**
|
|
38
|
+
* In setup stores all state properties must be exported.
|
|
39
|
+
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/require-setup-store-properties-export.md
|
|
40
|
+
*/
|
|
41
|
+
'pinia/require-setup-store-properties-export'?: Linter.RuleEntry<[]>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* ======= Declarations ======= */
|
|
45
|
+
// ----- pinia/prefer-use-store-naming-convention -----
|
|
46
|
+
type PiniaPreferUseStoreNamingConvention = []|[{
|
|
47
|
+
checkStoreNameMismatch?: boolean
|
|
48
|
+
storeSuffix?: string
|
|
49
|
+
[k: string]: unknown | undefined
|
|
50
|
+
}]
|
|
5
51
|
|
|
6
52
|
type AntfuOptions = Parameters<typeof antfu>[0];
|
|
7
|
-
type
|
|
53
|
+
type Rules = RuleOptions;
|
|
54
|
+
type TypedFlatConfigItem = Omit<Linter.FlatConfig<Linter.RulesRecord & Rules>, 'plugins'> & {
|
|
55
|
+
/**
|
|
56
|
+
* 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.
|
|
57
|
+
*
|
|
58
|
+
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
59
|
+
*/
|
|
60
|
+
plugins?: Record<string, any>;
|
|
61
|
+
};
|
|
62
|
+
interface OptionsOverrides {
|
|
63
|
+
overrides?: TypedFlatConfigItem['rules'];
|
|
64
|
+
}
|
|
65
|
+
type OptionsConfig = Omit<AntfuOptions, 'overrides'> & {
|
|
8
66
|
/**
|
|
9
67
|
* Enable Pinia support.
|
|
10
68
|
*
|
|
11
69
|
* @default auto-detect based on the dependencies
|
|
12
70
|
*/
|
|
13
|
-
pinia?: boolean;
|
|
71
|
+
pinia?: boolean | OptionsOverrides;
|
|
14
72
|
};
|
|
15
73
|
|
|
16
|
-
declare function vida(options?: OptionsConfig & TypedFlatConfigItem, ...userConfigs: TypedFlatConfigItem[]): eslint_flat_config_utils.FlatConfigComposer<TypedFlatConfigItem, _antfu_eslint_config.ConfigNames>;
|
|
74
|
+
declare function vida(options?: OptionsConfig & TypedFlatConfigItem$1, ...userConfigs: TypedFlatConfigItem$1[]): eslint_flat_config_utils.FlatConfigComposer<TypedFlatConfigItem$1, _antfu_eslint_config.ConfigNames>;
|
|
17
75
|
|
|
18
76
|
export { vida as default, vida };
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,37 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import antfu from "@antfu/eslint-config";
|
|
2
|
+
import antfu, { resolveSubOptions } from "@antfu/eslint-config";
|
|
3
3
|
import { isPackageExists } from "local-pkg";
|
|
4
4
|
|
|
5
5
|
// src/configs/pinia.ts
|
|
6
|
-
import { GLOB_JS, GLOB_TS } from "@antfu/eslint-config";
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
import { GLOB_JS, GLOB_TS, interopDefault } from "@antfu/eslint-config";
|
|
7
|
+
var GLOB_PINIA_JS = `**/stores/${GLOB_JS}`;
|
|
8
|
+
var GLOB_PINIA_TS = `**/stores/${GLOB_TS}`;
|
|
9
|
+
async function pinia(options = {}) {
|
|
10
|
+
const {
|
|
11
|
+
files = [GLOB_PINIA_JS, GLOB_PINIA_TS],
|
|
12
|
+
overrides = {}
|
|
13
|
+
} = options;
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
name: "@vida/pinia",
|
|
17
|
+
files,
|
|
18
|
+
plugins: {
|
|
19
|
+
pinia: await interopDefault(import("eslint-plugin-pinia"))
|
|
20
|
+
},
|
|
21
|
+
rules: {
|
|
22
|
+
"pinia/never-export-initialized-store": "error",
|
|
23
|
+
"pinia/prefer-single-store-per-file": "warn",
|
|
24
|
+
"pinia/prefer-use-store-naming-convention": ["error", {
|
|
25
|
+
checkStoreNameMismatch: true,
|
|
26
|
+
storeSuffix: "Store"
|
|
27
|
+
}],
|
|
28
|
+
"pinia/require-setup-store-properties-export": "warn",
|
|
29
|
+
"pinia/no-duplicate-store-ids": "error",
|
|
30
|
+
...overrides
|
|
31
|
+
}
|
|
25
32
|
}
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
];
|
|
34
|
+
}
|
|
28
35
|
|
|
29
36
|
// src/overrides/javascript.ts
|
|
30
37
|
var javascript = {
|
|
@@ -49,7 +56,7 @@ function vida(options = {}, ...userConfigs) {
|
|
|
49
56
|
} = options;
|
|
50
57
|
const configs = [];
|
|
51
58
|
if (enablePinia)
|
|
52
|
-
configs.push(pinia);
|
|
59
|
+
configs.push(pinia(resolveSubOptions(options, "pinia")));
|
|
53
60
|
const antfuConfig = {
|
|
54
61
|
stylistic: {
|
|
55
62
|
indent: 2,
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vida0905/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"packageManager": "pnpm@9.
|
|
4
|
+
"version": "0.4.0",
|
|
5
|
+
"packageManager": "pnpm@9.5.0",
|
|
6
6
|
"description": "Vida Xie's ESLint Config",
|
|
7
7
|
"author": "Vida Xie <vida_2020@163.com> (https://github.com/9romise/)",
|
|
8
8
|
"license": "MIT",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"lint:fix": "eslint . --fix",
|
|
34
34
|
"dev": "tsup --watch",
|
|
35
35
|
"inspect": "npx @eslint/config-inspector",
|
|
36
|
-
"
|
|
36
|
+
"typegen": "tsx scripts/typegen",
|
|
37
|
+
"build": "npm run typegen && tsup",
|
|
37
38
|
"release": "npm run lint && npm run typecheck && bumpp",
|
|
38
39
|
"typecheck": "tsc --noEmit",
|
|
39
40
|
"prepack": "npm run build",
|
|
@@ -53,18 +54,21 @@
|
|
|
53
54
|
}
|
|
54
55
|
},
|
|
55
56
|
"dependencies": {
|
|
56
|
-
"@antfu/eslint-config": "^2.
|
|
57
|
-
"eslint-plugin-pinia": "^0.
|
|
57
|
+
"@antfu/eslint-config": "^2.22.4",
|
|
58
|
+
"eslint-plugin-pinia": "^0.2.0",
|
|
58
59
|
"local-pkg": "^0.5.0"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@eslint/config-inspector": "^0.5.
|
|
62
|
+
"@eslint/config-inspector": "^0.5.1",
|
|
63
|
+
"@types/node": "^20.14.11",
|
|
62
64
|
"bumpp": "^9.4.1",
|
|
63
|
-
"eslint": "^9.
|
|
65
|
+
"eslint": "^9.7.0",
|
|
66
|
+
"eslint-typegen": "^0.2.4",
|
|
64
67
|
"lint-staged": "^15.2.7",
|
|
65
68
|
"simple-git-hooks": "^2.11.1",
|
|
66
69
|
"tsup": "^8.1.0",
|
|
67
|
-
"
|
|
70
|
+
"tsx": "^4.16.2",
|
|
71
|
+
"typescript": "^5.5.3"
|
|
68
72
|
},
|
|
69
73
|
"simple-git-hooks": {
|
|
70
74
|
"pre-commit": "npx lint-staged"
|