@so1ve/eslint-config 4.1.7 → 4.2.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/configs/astro.d.mts +8 -0
- package/dist/configs/astro.mjs +49 -0
- package/dist/configs/command.d.mts +6 -0
- package/dist/configs/command.mjs +10 -0
- package/dist/configs/comments.d.mts +6 -0
- package/dist/configs/comments.mjs +19 -0
- package/dist/configs/de-morgan.d.mts +6 -0
- package/dist/configs/de-morgan.mjs +10 -0
- package/dist/configs/formatting.d.mts +6 -0
- package/dist/configs/formatting.mjs +294 -0
- package/dist/configs/html.d.mts +6 -0
- package/dist/configs/html.mjs +37 -0
- package/dist/configs/ignores.d.mts +6 -0
- package/dist/configs/ignores.mjs +14 -0
- package/dist/configs/imports.d.mts +6 -0
- package/dist/configs/imports.mjs +75 -0
- package/dist/configs/index.d.mts +24 -0
- package/dist/configs/index.mjs +26 -0
- package/dist/configs/javascript.d.mts +8 -0
- package/dist/configs/javascript.mjs +326 -0
- package/dist/configs/jsonc.d.mts +6 -0
- package/dist/configs/jsonc.mjs +30 -0
- package/dist/configs/mdx.d.mts +9 -0
- package/dist/configs/mdx.mjs +43 -0
- package/dist/configs/node.d.mts +6 -0
- package/dist/configs/node.mjs +21 -0
- package/dist/configs/only-error.d.mts +6 -0
- package/dist/configs/only-error.mjs +10 -0
- package/dist/configs/perfectionist.d.mts +6 -0
- package/dist/configs/perfectionist.mjs +34 -0
- package/dist/configs/pnpm.d.mts +6 -0
- package/dist/configs/pnpm.mjs +106 -0
- package/dist/configs/promise.d.mts +6 -0
- package/dist/configs/promise.mjs +13 -0
- package/dist/configs/solid.d.mts +9 -0
- package/dist/configs/solid.mjs +24 -0
- package/dist/configs/sort-imports.d.mts +6 -0
- package/dist/configs/sort-imports.mjs +11 -0
- package/dist/configs/test.d.mts +8 -0
- package/dist/configs/test.mjs +46 -0
- package/dist/configs/toml.d.mts +8 -0
- package/dist/configs/toml.mjs +24 -0
- package/dist/configs/typescript.d.mts +10 -0
- package/dist/configs/typescript.mjs +232 -0
- package/dist/configs/unicorn.d.mts +6 -0
- package/dist/configs/unicorn.mjs +61 -0
- package/dist/configs/vue.d.mts +9 -0
- package/dist/configs/vue.mjs +194 -0
- package/dist/configs/yaml.d.mts +8 -0
- package/dist/configs/yaml.mjs +25 -0
- package/dist/factory.d.mts +21 -0
- package/dist/factory.mjs +114 -0
- package/dist/globs.d.mts +31 -0
- package/dist/globs.mjs +80 -0
- package/dist/index.d.mts +30 -16646
- package/dist/index.mjs +28 -2298
- package/dist/plugins.mjs +15 -0
- package/dist/typegen.d.mts +16308 -0
- package/dist/types.d.mts +175 -0
- package/dist/utils.d.mts +30 -0
- package/dist/utils.mjs +32 -0
- package/package.json +4 -6
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { RuleOptions } from "./typegen.mjs";
|
|
2
|
+
import { FlatGitignoreOptions } from "eslint-config-flat-gitignore";
|
|
3
|
+
import { ParserOptions } from "@typescript-eslint/utils/ts-eslint";
|
|
4
|
+
import { Linter } from "eslint";
|
|
5
|
+
|
|
6
|
+
//#region src/types.d.ts
|
|
7
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
8
|
+
type MaybeArray<T> = T | T[];
|
|
9
|
+
type Rules = RuleOptions;
|
|
10
|
+
type TypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins"> & {
|
|
11
|
+
/**
|
|
12
|
+
* An object containing a name-value mapping of plugin names to plugin
|
|
13
|
+
* objects. When `files` is specified, these plugins are only available to the
|
|
14
|
+
* matching files.
|
|
15
|
+
*
|
|
16
|
+
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
17
|
+
*/
|
|
18
|
+
plugins?: Record<string, any>;
|
|
19
|
+
};
|
|
20
|
+
interface OptionsComponentExts {
|
|
21
|
+
/**
|
|
22
|
+
* Additional extensions for components.
|
|
23
|
+
*/
|
|
24
|
+
componentExts?: string[];
|
|
25
|
+
}
|
|
26
|
+
interface OptionsTypeScriptParserOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Additional parser options for TypeScript.
|
|
29
|
+
*/
|
|
30
|
+
parserOptions?: Partial<ParserOptions>;
|
|
31
|
+
}
|
|
32
|
+
interface OptionsHasTypeScript {
|
|
33
|
+
typescript?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface OptionsPnpm {
|
|
36
|
+
/**
|
|
37
|
+
* Requires catalogs usage
|
|
38
|
+
*/
|
|
39
|
+
catalogs?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Enable linting for package.json
|
|
42
|
+
*
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
json?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Enable linting for pnpm-workspace.yaml
|
|
48
|
+
*
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
yaml?: boolean;
|
|
52
|
+
}
|
|
53
|
+
interface OptionsOverrides {
|
|
54
|
+
overrides?: TypedFlatConfigItem["rules"];
|
|
55
|
+
}
|
|
56
|
+
interface Options extends OptionsComponentExts {
|
|
57
|
+
/**
|
|
58
|
+
* Enable gitignore support.
|
|
59
|
+
*
|
|
60
|
+
* Passing an object to configure the options.
|
|
61
|
+
*
|
|
62
|
+
* @default true
|
|
63
|
+
* @see https://github.com/antfu/eslint-config-flat-gitignore
|
|
64
|
+
*/
|
|
65
|
+
gitignore?: boolean | FlatGitignoreOptions;
|
|
66
|
+
/**
|
|
67
|
+
* Extend the global ignores.
|
|
68
|
+
*
|
|
69
|
+
* Passing an array to extends the ignores. Passing a function to modify the
|
|
70
|
+
* default ignores.
|
|
71
|
+
*
|
|
72
|
+
* @default [ ]
|
|
73
|
+
*/
|
|
74
|
+
ignores?: string[] | ((originals: string[]) => string[]);
|
|
75
|
+
/**
|
|
76
|
+
* Enable pnpm catalogs support.
|
|
77
|
+
*
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
pnpm?: boolean | OptionsPnpm;
|
|
81
|
+
/**
|
|
82
|
+
* Core rules. Can't be disabled.
|
|
83
|
+
*/
|
|
84
|
+
javascript?: OptionsOverrides;
|
|
85
|
+
/**
|
|
86
|
+
* Enable HTML support.
|
|
87
|
+
*/
|
|
88
|
+
html?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Enable TypeScript support.
|
|
91
|
+
*
|
|
92
|
+
* Passing an object to enable TypeScript Language Server support.
|
|
93
|
+
*
|
|
94
|
+
* @default auto-detect based on the dependencies
|
|
95
|
+
*/
|
|
96
|
+
typescript?: boolean | OptionsOverrides;
|
|
97
|
+
/**
|
|
98
|
+
* Enable test support.
|
|
99
|
+
*
|
|
100
|
+
* @default true
|
|
101
|
+
*/
|
|
102
|
+
test?: boolean | OptionsOverrides;
|
|
103
|
+
/**
|
|
104
|
+
* Enable Astro support.
|
|
105
|
+
*
|
|
106
|
+
* @default auto-detect based on the dependencies
|
|
107
|
+
*/
|
|
108
|
+
astro?: boolean | OptionsOverrides;
|
|
109
|
+
/**
|
|
110
|
+
* Enable Vue support.
|
|
111
|
+
*
|
|
112
|
+
* @default auto-detect based on the dependencies
|
|
113
|
+
*/
|
|
114
|
+
vue?: boolean | OptionsOverrides;
|
|
115
|
+
/**
|
|
116
|
+
* Enable Solid.js support.
|
|
117
|
+
*
|
|
118
|
+
* @default auto-detect based on the dependencies
|
|
119
|
+
*/
|
|
120
|
+
solid?: boolean | OptionsOverrides;
|
|
121
|
+
/**
|
|
122
|
+
* Enable JSONC support.
|
|
123
|
+
*
|
|
124
|
+
* @default true
|
|
125
|
+
*/
|
|
126
|
+
jsonc?: boolean | OptionsOverrides;
|
|
127
|
+
/**
|
|
128
|
+
* Enable YAML support.
|
|
129
|
+
*
|
|
130
|
+
* @default true
|
|
131
|
+
*/
|
|
132
|
+
yaml?: boolean | OptionsOverrides;
|
|
133
|
+
/**
|
|
134
|
+
* Enable TOML support.
|
|
135
|
+
*
|
|
136
|
+
* @default true
|
|
137
|
+
*/
|
|
138
|
+
toml?: boolean | OptionsOverrides;
|
|
139
|
+
/**
|
|
140
|
+
* Enable markdown and mdx support.
|
|
141
|
+
*
|
|
142
|
+
* @default true
|
|
143
|
+
*/
|
|
144
|
+
mdx?: boolean | OptionsOverrides;
|
|
145
|
+
/**
|
|
146
|
+
* Enable formatting rules.
|
|
147
|
+
*
|
|
148
|
+
* @default true
|
|
149
|
+
*/
|
|
150
|
+
formatting?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Enable perfectionist rules.
|
|
153
|
+
*
|
|
154
|
+
* @default true
|
|
155
|
+
*/
|
|
156
|
+
perfectionist?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Provide overrides for rules for each integration.
|
|
159
|
+
*
|
|
160
|
+
* @deprecated Use `overrides` option in each integration key instead
|
|
161
|
+
*/
|
|
162
|
+
overrides?: {
|
|
163
|
+
javascript?: TypedFlatConfigItem["rules"];
|
|
164
|
+
typescript?: TypedFlatConfigItem["rules"];
|
|
165
|
+
test?: TypedFlatConfigItem["rules"];
|
|
166
|
+
vue?: TypedFlatConfigItem["rules"];
|
|
167
|
+
solid?: TypedFlatConfigItem["rules"];
|
|
168
|
+
jsonc?: TypedFlatConfigItem["rules"];
|
|
169
|
+
mdx?: TypedFlatConfigItem["rules"];
|
|
170
|
+
yaml?: TypedFlatConfigItem["rules"];
|
|
171
|
+
toml?: TypedFlatConfigItem["rules"];
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
export { MaybeArray, MaybePromise, Options, OptionsComponentExts, OptionsHasTypeScript, OptionsOverrides, OptionsPnpm, OptionsTypeScriptParserOptions, Rules, TypedFlatConfigItem };
|
package/dist/utils.d.mts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { MaybePromise } from "./types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/utils.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Rename plugin prefixes in a rule object. Accepts a map of prefixes to rename.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { renameRules } from "@antfu/eslint-config";
|
|
12
|
+
*
|
|
13
|
+
* export default [
|
|
14
|
+
* {
|
|
15
|
+
* rules: renameRules(
|
|
16
|
+
* {
|
|
17
|
+
* "@typescript-eslint/indent": "error",
|
|
18
|
+
* },
|
|
19
|
+
* { "@typescript-eslint": "ts" },
|
|
20
|
+
* ),
|
|
21
|
+
* },
|
|
22
|
+
* ];
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare const renameRules: (rules: Record<string, any>, map: Record<string, string>) => Record<string, any>;
|
|
26
|
+
declare function interopDefault<T>(m: MaybePromise<T>): Promise<T extends {
|
|
27
|
+
default: infer U;
|
|
28
|
+
} ? U : T>;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { interopDefault, renameRules };
|
package/dist/utils.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/utils.ts
|
|
2
|
+
/**
|
|
3
|
+
* Rename plugin prefixes in a rule object. Accepts a map of prefixes to rename.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { renameRules } from "@antfu/eslint-config";
|
|
9
|
+
*
|
|
10
|
+
* export default [
|
|
11
|
+
* {
|
|
12
|
+
* rules: renameRules(
|
|
13
|
+
* {
|
|
14
|
+
* "@typescript-eslint/indent": "error",
|
|
15
|
+
* },
|
|
16
|
+
* { "@typescript-eslint": "ts" },
|
|
17
|
+
* ),
|
|
18
|
+
* },
|
|
19
|
+
* ];
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
const renameRules = (rules, map) => Object.fromEntries(Object.entries(rules).map(([key, value]) => {
|
|
23
|
+
for (const [from, to] of Object.entries(map)) if (key.startsWith(`${from}/`)) return [to + key.slice(from.length), value];
|
|
24
|
+
return [key, value];
|
|
25
|
+
}));
|
|
26
|
+
async function interopDefault(m) {
|
|
27
|
+
const resolved = await m;
|
|
28
|
+
return resolved.default ?? resolved;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { interopDefault, renameRules };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@so1ve/eslint-config",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Ray's eslint config.",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"eslint-plugin-astro": "^1.5.0",
|
|
49
49
|
"eslint-plugin-case-police": "^2.1.1",
|
|
50
50
|
"eslint-plugin-command": "^3.4.0",
|
|
51
|
+
"eslint-plugin-de-morgan": "^2.0.0",
|
|
51
52
|
"eslint-plugin-html": "^8.1.3",
|
|
52
53
|
"eslint-plugin-import-lite": "^0.4.0",
|
|
53
54
|
"eslint-plugin-import-x": "^4.16.1",
|
|
@@ -69,6 +70,7 @@
|
|
|
69
70
|
"eslint-plugin-unused-imports": "^4.3.0",
|
|
70
71
|
"eslint-plugin-vue": "^10.6.2",
|
|
71
72
|
"eslint-plugin-yml": "^1.19.1",
|
|
73
|
+
"find-up-simple": "^1.0.1",
|
|
72
74
|
"globals": "^16.5.0",
|
|
73
75
|
"jsonc-eslint-parser": "^2.4.2",
|
|
74
76
|
"local-pkg": "^1.1.2",
|
|
@@ -76,11 +78,7 @@
|
|
|
76
78
|
"typescript-eslint": "^8.50.1",
|
|
77
79
|
"vue-eslint-parser": "^10.2.0",
|
|
78
80
|
"yaml-eslint-parser": "^1.3.2",
|
|
79
|
-
"@so1ve/eslint-plugin": "4.
|
|
80
|
-
},
|
|
81
|
-
"devDependencies": {
|
|
82
|
-
"eslint-plugin-de-morgan": "^2.0.0",
|
|
83
|
-
"find-up-simple": "^1.0.1"
|
|
81
|
+
"@so1ve/eslint-plugin": "4.2.0"
|
|
84
82
|
},
|
|
85
83
|
"peerDependencies": {
|
|
86
84
|
"eslint": "^9.39.2",
|