@w5s/dev 3.3.0 → 3.3.3
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.cjs +254 -162
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +153 -104
- package/dist/index.d.ts +153 -104
- package/dist/index.js +252 -150
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/ESLintConfig.ts +122 -71
- package/src/Project.ts +141 -133
- package/src/ProjectScript.ts +1 -0
- package/dist/index.d.cts.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,30 +1,71 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Linter } from "eslint";
|
|
2
2
|
|
|
3
3
|
//#region src/ESLintConfig.d.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Return a new merged flat configuration
|
|
6
|
+
*
|
|
7
|
+
* @param configs
|
|
8
|
+
*/
|
|
9
|
+
declare function merge<T extends Linter.Config = Linter.Config>(...configs: Array<T>): T;
|
|
10
|
+
/**
|
|
11
|
+
* Concat multiple flat configs into a single flat config array.
|
|
12
|
+
*
|
|
13
|
+
* It also resolves promises and flattens the result.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import eslint from '@eslint/js'
|
|
19
|
+
*
|
|
20
|
+
* export default ESLintConfig.concat(
|
|
21
|
+
* {
|
|
22
|
+
* plugins: {},
|
|
23
|
+
* rules: {},
|
|
24
|
+
* },
|
|
25
|
+
* // It can also takes a array of configs:
|
|
26
|
+
* [
|
|
27
|
+
* {
|
|
28
|
+
* plugins: {},
|
|
29
|
+
* rules: {},
|
|
30
|
+
* }
|
|
31
|
+
* // ...
|
|
32
|
+
* ],
|
|
33
|
+
* // Or promises:
|
|
34
|
+
* Promise.resolve({
|
|
35
|
+
* files: ['*.ts'],
|
|
36
|
+
* rules: {},
|
|
37
|
+
* })
|
|
38
|
+
* );
|
|
39
|
+
* ```
|
|
40
|
+
* @param configs
|
|
41
|
+
*/
|
|
42
|
+
declare function concat<T extends Linter.Config = Linter.Config>(...configs: Array<T | ReadonlyArray<T> | Promise<T> | Promise<ReadonlyArray<T>>>): Promise<Array<T>>;
|
|
43
|
+
/**
|
|
44
|
+
* Always return 'off'. `_status` is the previous rule value.
|
|
45
|
+
*
|
|
46
|
+
* @param _status
|
|
47
|
+
*/
|
|
48
|
+
declare function fixme(_status: string | number | [string | number, ...any[]] | undefined): "off";
|
|
49
|
+
/**
|
|
50
|
+
* Renames rules in the given object according to the given map.
|
|
51
|
+
*
|
|
52
|
+
* Given a map `{ 'old-prefix': 'new-prefix' }`, and a rule object
|
|
53
|
+
* `{ 'old-prefix/rule-name': 'error' }`, this function will return
|
|
54
|
+
* `{ 'new-prefix/rule-name': 'error' }`.
|
|
55
|
+
*
|
|
56
|
+
* @param rules The object containing the rules to rename.
|
|
57
|
+
* @param map The object containing the rename map.
|
|
58
|
+
*/
|
|
59
|
+
declare function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
|
|
60
|
+
/**
|
|
61
|
+
* @namespace
|
|
62
|
+
*/
|
|
63
|
+
declare const ESLintConfig: Readonly<{
|
|
64
|
+
merge: typeof merge;
|
|
65
|
+
concat: typeof concat;
|
|
66
|
+
fixme: typeof fixme;
|
|
67
|
+
renameRules: typeof renameRules;
|
|
68
|
+
}>;
|
|
28
69
|
//#endregion
|
|
29
70
|
//#region src/interopDefault.d.ts
|
|
30
71
|
/**
|
|
@@ -85,84 +126,91 @@ declare const meta: Readonly<{
|
|
|
85
126
|
}>;
|
|
86
127
|
//#endregion
|
|
87
128
|
//#region src/Project.d.ts
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
129
|
+
/**
|
|
130
|
+
* A type of a file extension
|
|
131
|
+
*/
|
|
132
|
+
type Extension = `.${string}`;
|
|
133
|
+
/**
|
|
134
|
+
* Object hash of all well-known file extension category to file extensions mapping
|
|
135
|
+
*/
|
|
136
|
+
type ExtensionRegistry = { [K in LanguageId]: readonly Extension[] };
|
|
137
|
+
/**
|
|
138
|
+
* Supported ECMA version
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```ts
|
|
142
|
+
* Project.ecmaVersion() // 2022
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
declare function ecmaVersion(): 2022;
|
|
146
|
+
/**
|
|
147
|
+
* Return a list of extensions
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* Project.queryExtensions(['javascript']); // ['.js', '.cjs', ...]
|
|
152
|
+
* Project.queryExtensions(['typescript', 'typescriptreact']); // ['.ts', '.mts', ..., '.tsx']
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* @param languages
|
|
156
|
+
*/
|
|
157
|
+
declare function queryExtensions(languages: LanguageId[]): readonly Extension[];
|
|
158
|
+
/**
|
|
159
|
+
* Supported file extensions
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* Project.sourceExtensions() // ['.ts', '.js', ...]
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
declare function sourceExtensions(): readonly `.${string}`[];
|
|
167
|
+
/**
|
|
168
|
+
* Resource file extensions
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```ts
|
|
172
|
+
* Project.resourceExtensions() // ['.css', '.sass', ...]
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
declare function resourceExtensions(): readonly `.${string}`[];
|
|
176
|
+
/**
|
|
177
|
+
* Files and folders to always ignore
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* IGNORED // ['node_modules/', 'build/', ...]
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
declare function ignored(): readonly string[];
|
|
185
|
+
/**
|
|
186
|
+
* Return a RegExp that will match any list of extensions
|
|
187
|
+
*
|
|
188
|
+
* @param extensions
|
|
189
|
+
* @example
|
|
190
|
+
* ```ts
|
|
191
|
+
* Project.extensionsToMatcher(['.js', '.ts']) // RegExp = /(\.js|\.ts)$/
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
declare function extensionsToMatcher(extensions: readonly Extension[]): RegExp;
|
|
195
|
+
/**
|
|
196
|
+
* Return a glob matcher that will match any list of extensions
|
|
197
|
+
*
|
|
198
|
+
* @param extensions
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* Project.extensionsToGlob(['.js', '.ts']) // '*.+(js|ts)'
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
declare function extensionsToGlob(extensions: readonly Extension[]): string;
|
|
205
|
+
declare const Project: Readonly<{
|
|
206
|
+
ecmaVersion: typeof ecmaVersion;
|
|
207
|
+
extensionsToGlob: typeof extensionsToGlob;
|
|
208
|
+
extensionsToMatcher: typeof extensionsToMatcher;
|
|
209
|
+
ignored: typeof ignored;
|
|
210
|
+
queryExtensions: typeof queryExtensions;
|
|
211
|
+
resourceExtensions: typeof resourceExtensions;
|
|
212
|
+
sourceExtensions: typeof sourceExtensions;
|
|
213
|
+
}>;
|
|
166
214
|
//#endregion
|
|
167
215
|
//#region src/ProjectScript.d.ts
|
|
168
216
|
/**
|
|
@@ -183,9 +231,10 @@ declare const ProjectScript: {
|
|
|
183
231
|
readonly Rescue: "rescue";
|
|
184
232
|
readonly Spellcheck: "spellcheck";
|
|
185
233
|
readonly Test: "test";
|
|
234
|
+
readonly Typecheck: "typecheck";
|
|
186
235
|
readonly Validate: "validate";
|
|
187
236
|
};
|
|
188
237
|
type ProjectScript = (typeof ProjectScript)[keyof typeof ProjectScript];
|
|
189
238
|
//#endregion
|
|
190
|
-
export { ESLintConfig, LanguageId, LanguageIdMap, Project, ProjectScript, interopDefault, meta };
|
|
239
|
+
export { ESLintConfig, Extension, ExtensionRegistry, LanguageId, LanguageIdMap, Project, ProjectScript, interopDefault, meta };
|
|
191
240
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,30 +1,71 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Linter } from "eslint";
|
|
2
2
|
|
|
3
3
|
//#region src/ESLintConfig.d.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Return a new merged flat configuration
|
|
6
|
+
*
|
|
7
|
+
* @param configs
|
|
8
|
+
*/
|
|
9
|
+
declare function merge<T extends Linter.Config = Linter.Config>(...configs: Array<T>): T;
|
|
10
|
+
/**
|
|
11
|
+
* Concat multiple flat configs into a single flat config array.
|
|
12
|
+
*
|
|
13
|
+
* It also resolves promises and flattens the result.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import eslint from '@eslint/js'
|
|
19
|
+
*
|
|
20
|
+
* export default ESLintConfig.concat(
|
|
21
|
+
* {
|
|
22
|
+
* plugins: {},
|
|
23
|
+
* rules: {},
|
|
24
|
+
* },
|
|
25
|
+
* // It can also takes a array of configs:
|
|
26
|
+
* [
|
|
27
|
+
* {
|
|
28
|
+
* plugins: {},
|
|
29
|
+
* rules: {},
|
|
30
|
+
* }
|
|
31
|
+
* // ...
|
|
32
|
+
* ],
|
|
33
|
+
* // Or promises:
|
|
34
|
+
* Promise.resolve({
|
|
35
|
+
* files: ['*.ts'],
|
|
36
|
+
* rules: {},
|
|
37
|
+
* })
|
|
38
|
+
* );
|
|
39
|
+
* ```
|
|
40
|
+
* @param configs
|
|
41
|
+
*/
|
|
42
|
+
declare function concat<T extends Linter.Config = Linter.Config>(...configs: Array<T | ReadonlyArray<T> | Promise<T> | Promise<ReadonlyArray<T>>>): Promise<Array<T>>;
|
|
43
|
+
/**
|
|
44
|
+
* Always return 'off'. `_status` is the previous rule value.
|
|
45
|
+
*
|
|
46
|
+
* @param _status
|
|
47
|
+
*/
|
|
48
|
+
declare function fixme(_status: string | number | [string | number, ...any[]] | undefined): "off";
|
|
49
|
+
/**
|
|
50
|
+
* Renames rules in the given object according to the given map.
|
|
51
|
+
*
|
|
52
|
+
* Given a map `{ 'old-prefix': 'new-prefix' }`, and a rule object
|
|
53
|
+
* `{ 'old-prefix/rule-name': 'error' }`, this function will return
|
|
54
|
+
* `{ 'new-prefix/rule-name': 'error' }`.
|
|
55
|
+
*
|
|
56
|
+
* @param rules The object containing the rules to rename.
|
|
57
|
+
* @param map The object containing the rename map.
|
|
58
|
+
*/
|
|
59
|
+
declare function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
|
|
60
|
+
/**
|
|
61
|
+
* @namespace
|
|
62
|
+
*/
|
|
63
|
+
declare const ESLintConfig: Readonly<{
|
|
64
|
+
merge: typeof merge;
|
|
65
|
+
concat: typeof concat;
|
|
66
|
+
fixme: typeof fixme;
|
|
67
|
+
renameRules: typeof renameRules;
|
|
68
|
+
}>;
|
|
28
69
|
//#endregion
|
|
29
70
|
//#region src/interopDefault.d.ts
|
|
30
71
|
/**
|
|
@@ -85,84 +126,91 @@ declare const meta: Readonly<{
|
|
|
85
126
|
}>;
|
|
86
127
|
//#endregion
|
|
87
128
|
//#region src/Project.d.ts
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
129
|
+
/**
|
|
130
|
+
* A type of a file extension
|
|
131
|
+
*/
|
|
132
|
+
type Extension = `.${string}`;
|
|
133
|
+
/**
|
|
134
|
+
* Object hash of all well-known file extension category to file extensions mapping
|
|
135
|
+
*/
|
|
136
|
+
type ExtensionRegistry = { [K in LanguageId]: readonly Extension[] };
|
|
137
|
+
/**
|
|
138
|
+
* Supported ECMA version
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```ts
|
|
142
|
+
* Project.ecmaVersion() // 2022
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
declare function ecmaVersion(): 2022;
|
|
146
|
+
/**
|
|
147
|
+
* Return a list of extensions
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* Project.queryExtensions(['javascript']); // ['.js', '.cjs', ...]
|
|
152
|
+
* Project.queryExtensions(['typescript', 'typescriptreact']); // ['.ts', '.mts', ..., '.tsx']
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* @param languages
|
|
156
|
+
*/
|
|
157
|
+
declare function queryExtensions(languages: LanguageId[]): readonly Extension[];
|
|
158
|
+
/**
|
|
159
|
+
* Supported file extensions
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* Project.sourceExtensions() // ['.ts', '.js', ...]
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
declare function sourceExtensions(): readonly `.${string}`[];
|
|
167
|
+
/**
|
|
168
|
+
* Resource file extensions
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```ts
|
|
172
|
+
* Project.resourceExtensions() // ['.css', '.sass', ...]
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
declare function resourceExtensions(): readonly `.${string}`[];
|
|
176
|
+
/**
|
|
177
|
+
* Files and folders to always ignore
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* IGNORED // ['node_modules/', 'build/', ...]
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
declare function ignored(): readonly string[];
|
|
185
|
+
/**
|
|
186
|
+
* Return a RegExp that will match any list of extensions
|
|
187
|
+
*
|
|
188
|
+
* @param extensions
|
|
189
|
+
* @example
|
|
190
|
+
* ```ts
|
|
191
|
+
* Project.extensionsToMatcher(['.js', '.ts']) // RegExp = /(\.js|\.ts)$/
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
declare function extensionsToMatcher(extensions: readonly Extension[]): RegExp;
|
|
195
|
+
/**
|
|
196
|
+
* Return a glob matcher that will match any list of extensions
|
|
197
|
+
*
|
|
198
|
+
* @param extensions
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* Project.extensionsToGlob(['.js', '.ts']) // '*.+(js|ts)'
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
declare function extensionsToGlob(extensions: readonly Extension[]): string;
|
|
205
|
+
declare const Project: Readonly<{
|
|
206
|
+
ecmaVersion: typeof ecmaVersion;
|
|
207
|
+
extensionsToGlob: typeof extensionsToGlob;
|
|
208
|
+
extensionsToMatcher: typeof extensionsToMatcher;
|
|
209
|
+
ignored: typeof ignored;
|
|
210
|
+
queryExtensions: typeof queryExtensions;
|
|
211
|
+
resourceExtensions: typeof resourceExtensions;
|
|
212
|
+
sourceExtensions: typeof sourceExtensions;
|
|
213
|
+
}>;
|
|
166
214
|
//#endregion
|
|
167
215
|
//#region src/ProjectScript.d.ts
|
|
168
216
|
/**
|
|
@@ -183,9 +231,10 @@ declare const ProjectScript: {
|
|
|
183
231
|
readonly Rescue: "rescue";
|
|
184
232
|
readonly Spellcheck: "spellcheck";
|
|
185
233
|
readonly Test: "test";
|
|
234
|
+
readonly Typecheck: "typecheck";
|
|
186
235
|
readonly Validate: "validate";
|
|
187
236
|
};
|
|
188
237
|
type ProjectScript = (typeof ProjectScript)[keyof typeof ProjectScript];
|
|
189
238
|
//#endregion
|
|
190
|
-
export { ESLintConfig, LanguageId, LanguageIdMap, Project, ProjectScript, interopDefault, meta };
|
|
239
|
+
export { ESLintConfig, Extension, ExtensionRegistry, LanguageId, LanguageIdMap, Project, ProjectScript, interopDefault, meta };
|
|
191
240
|
//# sourceMappingURL=index.d.ts.map
|