@vida0905/eslint-config 1.2.1 → 2.0.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 +2 -2
- package/package.json +11 -13
- package/dist/index.cjs +0 -160
- package/dist/index.d.cts +0 -82
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as node_modules_eslint_flat_config_utils_dist from 'node_modules/eslint-flat-config-utils/dist';
|
|
2
2
|
import * as _antfu_eslint_config from '@antfu/eslint-config';
|
|
3
3
|
import { OptionsConfig as OptionsConfig$1, TypedFlatConfigItem as TypedFlatConfigItem$1 } from '@antfu/eslint-config';
|
|
4
4
|
export * from '@antfu/eslint-config';
|
|
@@ -77,6 +77,6 @@ type OptionsConfig = Omit<OptionsConfig$1, 'overrides'> & {
|
|
|
77
77
|
|
|
78
78
|
declare function deepMerge<T>(target: T, source: T): T;
|
|
79
79
|
|
|
80
|
-
declare function defineConfig(options?: OptionsConfig & TypedFlatConfigItem$1, ...userConfigs: TypedFlatConfigItem$1[]):
|
|
80
|
+
declare function defineConfig(options?: OptionsConfig & TypedFlatConfigItem$1, ...userConfigs: TypedFlatConfigItem$1[]): node_modules_eslint_flat_config_utils_dist.FlatConfigComposer<TypedFlatConfigItem$1, _antfu_eslint_config.ConfigNames>;
|
|
81
81
|
|
|
82
82
|
export { deepMerge, defineConfig as default, defineConfig };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vida0905/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
5
|
-
"packageManager": "pnpm@9.15.
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"packageManager": "pnpm@9.15.4",
|
|
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",
|
|
@@ -18,10 +18,7 @@
|
|
|
18
18
|
"eslint-config"
|
|
19
19
|
],
|
|
20
20
|
"exports": {
|
|
21
|
-
".":
|
|
22
|
-
"import": "./dist/index.js",
|
|
23
|
-
"require": "./dist/index.cjs"
|
|
24
|
-
}
|
|
21
|
+
".": "./dist/index.js"
|
|
25
22
|
},
|
|
26
23
|
"main": "./dits/index.js",
|
|
27
24
|
"types": "./dist/index.d.ts",
|
|
@@ -43,19 +40,20 @@
|
|
|
43
40
|
"eslint": ">=9.10.0"
|
|
44
41
|
},
|
|
45
42
|
"dependencies": {
|
|
46
|
-
"@antfu/eslint-config": "^
|
|
47
|
-
"eslint-import-resolver-oxc": "^0.
|
|
43
|
+
"@antfu/eslint-config": "^4.1.0",
|
|
44
|
+
"eslint-import-resolver-oxc": "^0.10.1",
|
|
48
45
|
"eslint-plugin-pinia": "^0.4.1",
|
|
49
46
|
"local-pkg": "^1.0.0"
|
|
50
47
|
},
|
|
51
48
|
"devDependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"
|
|
54
|
-
"
|
|
49
|
+
"@eslint/config-inspector": "^1.0.0",
|
|
50
|
+
"@types/node": "^22.10.10",
|
|
51
|
+
"bumpp": "^10.0.1",
|
|
52
|
+
"eslint": "^9.19.0",
|
|
55
53
|
"eslint-typegen": "^1.0.0",
|
|
56
|
-
"lint-staged": "^15.
|
|
54
|
+
"lint-staged": "^15.4.2",
|
|
57
55
|
"simple-git-hooks": "^2.11.1",
|
|
58
|
-
"tsup": "^8.3.
|
|
56
|
+
"tsup": "^8.3.6",
|
|
59
57
|
"tsx": "^4.19.2",
|
|
60
58
|
"typescript": "^5.7.3"
|
|
61
59
|
},
|
package/dist/index.cjs
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
-
|
|
31
|
-
// src/index.ts
|
|
32
|
-
var index_exports = {};
|
|
33
|
-
__export(index_exports, {
|
|
34
|
-
deepMerge: () => deepMerge,
|
|
35
|
-
default: () => index_default,
|
|
36
|
-
defineConfig: () => defineConfig
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(index_exports);
|
|
39
|
-
var import_eslint_config2 = __toESM(require("@antfu/eslint-config"), 1);
|
|
40
|
-
var import_eslint_import_resolver_oxc = require("eslint-import-resolver-oxc");
|
|
41
|
-
var import_local_pkg = require("local-pkg");
|
|
42
|
-
|
|
43
|
-
// src/configs/pinia.ts
|
|
44
|
-
var import_eslint_config = require("@antfu/eslint-config");
|
|
45
|
-
var GLOB_PINIA_JS = `**/stores/${import_eslint_config.GLOB_JS}`;
|
|
46
|
-
var GLOB_PINIA_TS = `**/stores/${import_eslint_config.GLOB_TS}`;
|
|
47
|
-
async function pinia(options = {}) {
|
|
48
|
-
const {
|
|
49
|
-
files = [GLOB_PINIA_JS, GLOB_PINIA_TS],
|
|
50
|
-
overrides: overrides2 = {}
|
|
51
|
-
} = options;
|
|
52
|
-
return [
|
|
53
|
-
{
|
|
54
|
-
name: "vida/pinia/rules",
|
|
55
|
-
files,
|
|
56
|
-
plugins: {
|
|
57
|
-
pinia: await (0, import_eslint_config.interopDefault)(import("eslint-plugin-pinia"))
|
|
58
|
-
},
|
|
59
|
-
rules: {
|
|
60
|
-
"pinia/never-export-initialized-store": "error",
|
|
61
|
-
"pinia/prefer-single-store-per-file": "warn",
|
|
62
|
-
"pinia/prefer-use-store-naming-convention": ["error", {
|
|
63
|
-
checkStoreNameMismatch: true,
|
|
64
|
-
storeSuffix: "Store"
|
|
65
|
-
}],
|
|
66
|
-
"pinia/require-setup-store-properties-export": "warn",
|
|
67
|
-
"pinia/no-duplicate-store-ids": "error",
|
|
68
|
-
"pinia/no-return-global-properties": "error",
|
|
69
|
-
"pinia/no-store-to-refs-in-store": "error",
|
|
70
|
-
...overrides2
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// src/overrides/javascript.ts
|
|
77
|
-
var javascript = {
|
|
78
|
-
"arrow-body-style": ["error", "as-needed"],
|
|
79
|
-
"no-unused-private-class-members": "error",
|
|
80
|
-
"require-atomic-updates": ["error", { allowProperties: true }]
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// src/overrides/stylistic.ts
|
|
84
|
-
var stylistic = {
|
|
85
|
-
"style/arrow-parens": ["error", "always"],
|
|
86
|
-
"style/brace-style": ["error", "1tbs", { allowSingleLine: true }]
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// src/overrides/vue.ts
|
|
90
|
-
var vue = {
|
|
91
|
-
"vue/max-attributes-per-line": ["error", {
|
|
92
|
-
singleline: 5,
|
|
93
|
-
multiline: 1
|
|
94
|
-
}]
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
// src/overrides/index.ts
|
|
98
|
-
var overrides = {
|
|
99
|
-
javascript,
|
|
100
|
-
stylistic,
|
|
101
|
-
vue
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
// src/utils.ts
|
|
105
|
-
function deepMerge(target, source) {
|
|
106
|
-
for (const key in source) {
|
|
107
|
-
if (Object.hasOwnProperty.call(source, key)) {
|
|
108
|
-
if (source[key] instanceof Object && target[key] instanceof Object) {
|
|
109
|
-
target[key] = deepMerge(target[key], source[key]);
|
|
110
|
-
} else {
|
|
111
|
-
target[key] = source[key];
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return target;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// src/index.ts
|
|
119
|
-
__reExport(index_exports, require("@antfu/eslint-config"), module.exports);
|
|
120
|
-
function defineConfig(options = {}, ...userConfigs) {
|
|
121
|
-
const {
|
|
122
|
-
pinia: enablePinia = (0, import_local_pkg.isPackageExists)("pinia")
|
|
123
|
-
} = options;
|
|
124
|
-
const configs = [];
|
|
125
|
-
if (enablePinia)
|
|
126
|
-
configs.push(pinia((0, import_eslint_config2.resolveSubOptions)(options, "pinia")));
|
|
127
|
-
const antfuConfig = {
|
|
128
|
-
stylistic: {
|
|
129
|
-
indent: 2,
|
|
130
|
-
quotes: "single",
|
|
131
|
-
semi: false,
|
|
132
|
-
overrides: overrides.stylistic
|
|
133
|
-
},
|
|
134
|
-
javascript: {
|
|
135
|
-
overrides: overrides.javascript
|
|
136
|
-
},
|
|
137
|
-
vue: {
|
|
138
|
-
overrides: overrides.vue
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
return (0, import_eslint_config2.default)(
|
|
142
|
-
deepMerge(antfuConfig, options),
|
|
143
|
-
...configs,
|
|
144
|
-
...userConfigs
|
|
145
|
-
).prepend({
|
|
146
|
-
name: "vida/imports/setup",
|
|
147
|
-
settings: {
|
|
148
|
-
"import-x/resolver-next": [
|
|
149
|
-
(0, import_eslint_import_resolver_oxc.createOxcImportResolver)()
|
|
150
|
-
]
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
var index_default = defineConfig;
|
|
155
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
156
|
-
0 && (module.exports = {
|
|
157
|
-
deepMerge,
|
|
158
|
-
defineConfig,
|
|
159
|
-
...require("@antfu/eslint-config")
|
|
160
|
-
});
|
package/dist/index.d.cts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import * as eslint_flat_config_utils from 'eslint-flat-config-utils';
|
|
2
|
-
import * as _antfu_eslint_config from '@antfu/eslint-config';
|
|
3
|
-
import { OptionsConfig as OptionsConfig$1, TypedFlatConfigItem as TypedFlatConfigItem$1 } from '@antfu/eslint-config';
|
|
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
|
-
* Disallow use of storeToRefs inside defineStore
|
|
29
|
-
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/no-store-to-refs-in-store.md
|
|
30
|
-
*/
|
|
31
|
-
'pinia/no-store-to-refs-in-store'?: Linter.RuleEntry<[]>
|
|
32
|
-
/**
|
|
33
|
-
* Encourages defining each store in a separate file.
|
|
34
|
-
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/prefer-single-store-per-file.md
|
|
35
|
-
*/
|
|
36
|
-
'pinia/prefer-single-store-per-file'?: Linter.RuleEntry<[]>
|
|
37
|
-
/**
|
|
38
|
-
* Enforces the convention of naming stores with the prefix `use` followed by the store name.
|
|
39
|
-
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/prefer-use-store-naming-convention.md
|
|
40
|
-
*/
|
|
41
|
-
'pinia/prefer-use-store-naming-convention'?: Linter.RuleEntry<PiniaPreferUseStoreNamingConvention>
|
|
42
|
-
/**
|
|
43
|
-
* In setup stores all state properties must be exported.
|
|
44
|
-
* @see https://github.com/lisilinhart/eslint-plugin-pinia/blob/main/docs/rules/require-setup-store-properties-export.md
|
|
45
|
-
*/
|
|
46
|
-
'pinia/require-setup-store-properties-export'?: Linter.RuleEntry<[]>
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/* ======= Declarations ======= */
|
|
50
|
-
// ----- pinia/prefer-use-store-naming-convention -----
|
|
51
|
-
type PiniaPreferUseStoreNamingConvention = []|[{
|
|
52
|
-
checkStoreNameMismatch?: boolean
|
|
53
|
-
storeSuffix?: string
|
|
54
|
-
[k: string]: unknown | undefined
|
|
55
|
-
}]
|
|
56
|
-
|
|
57
|
-
type Rules = RuleOptions;
|
|
58
|
-
type TypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins'> & {
|
|
59
|
-
/**
|
|
60
|
-
* 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.
|
|
61
|
-
*
|
|
62
|
-
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
63
|
-
*/
|
|
64
|
-
plugins?: Record<string, any>;
|
|
65
|
-
};
|
|
66
|
-
interface OptionsOverrides {
|
|
67
|
-
overrides?: TypedFlatConfigItem['rules'];
|
|
68
|
-
}
|
|
69
|
-
type OptionsConfig = Omit<OptionsConfig$1, 'overrides'> & {
|
|
70
|
-
/**
|
|
71
|
-
* Enable Pinia support.
|
|
72
|
-
*
|
|
73
|
-
* @default auto-detect based on the dependencies
|
|
74
|
-
*/
|
|
75
|
-
pinia?: boolean | OptionsOverrides;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
declare function deepMerge<T>(target: T, source: T): T;
|
|
79
|
-
|
|
80
|
-
declare function defineConfig(options?: OptionsConfig & TypedFlatConfigItem$1, ...userConfigs: TypedFlatConfigItem$1[]): eslint_flat_config_utils.FlatConfigComposer<TypedFlatConfigItem$1, _antfu_eslint_config.ConfigNames>;
|
|
81
|
-
|
|
82
|
-
export { deepMerge, defineConfig as default, defineConfig };
|