@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.d.cts CHANGED
@@ -1,30 +1,71 @@
1
- import { ESLint } from "eslint";
1
+ import { Linter } from "eslint";
2
2
 
3
3
  //#region src/ESLintConfig.d.ts
4
- declare namespace ESLintConfig {
5
- /**
6
- *
7
- * @param configs
8
- */
9
- function concat(...configs: ESLint.ConfigData[]): ESLint.ConfigData;
10
- /**
11
- * Always return 'off'. `_status` is the previous rule value.
12
- *
13
- * @param _status
14
- */
15
- function fixme(_status: string | number | [string | number, ...any[]] | undefined): "off";
16
- /**
17
- * Renames rules in the given object according to the given map.
18
- *
19
- * Given a map `{ 'old-prefix': 'new-prefix' }`, and a rule object
20
- * `{ 'old-prefix/rule-name': 'error' }`, this function will return
21
- * `{ 'new-prefix/rule-name': 'error' }`.
22
- *
23
- * @param rules The object containing the rules to rename.
24
- * @param map The object containing the rename map.
25
- */
26
- function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
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
- declare namespace Project {
89
- /**
90
- * A type of a file extension
91
- */
92
- type Extension = `.${string}`;
93
- /**
94
- * Object hash of all well-known file extension category to file extensions mapping
95
- */
96
- type ExtensionRegistry = { [K in LanguageId]: readonly Extension[] };
97
- /**
98
- * Supported ECMA version
99
- *
100
- * @example
101
- * ```ts
102
- * Project.ecmaVersion() // 2022
103
- * ```
104
- */
105
- function ecmaVersion(): 2022;
106
- /**
107
- * Return a list of extensions
108
- *
109
- * @example
110
- * ```ts
111
- * Project.queryExtensions(['javascript']); // ['.js', '.cjs', ...]
112
- * Project.queryExtensions(['typescript', 'typescriptreact']); // ['.ts', '.mts', ..., '.tsx']
113
- * ```
114
- *
115
- * @param languages
116
- */
117
- function queryExtensions(languages: LanguageId[]): readonly Extension[];
118
- /**
119
- * Supported file extensions
120
- *
121
- * @example
122
- * ```ts
123
- * Project.sourceExtensions() // ['.ts', '.js', ...]
124
- * ```
125
- */
126
- function sourceExtensions(): readonly `.${string}`[];
127
- /**
128
- * Resource file extensions
129
- *
130
- * @example
131
- * ```ts
132
- * Project.resourceExtensions() // ['.css', '.sass', ...]
133
- * ```
134
- */
135
- function resourceExtensions(): readonly `.${string}`[];
136
- /**
137
- * Files and folders to always ignore
138
- *
139
- * @example
140
- * ```ts
141
- * IGNORED // ['node_modules/', 'build/', ...]
142
- * ```
143
- */
144
- function ignored(): readonly string[];
145
- /**
146
- * Return a RegExp that will match any list of extensions
147
- *
148
- * @param extensions
149
- * @example
150
- * ```ts
151
- * Project.extensionsToMatcher(['.js', '.ts']) // RegExp = /(\.js|\.ts)$/
152
- * ```
153
- */
154
- function extensionsToMatcher(extensions: readonly Extension[]): RegExp;
155
- /**
156
- * Return a glob matcher that will match any list of extensions
157
- *
158
- * @param extensions
159
- * @example
160
- * ```ts
161
- * Project.extensionsToGlob(['.js', '.ts']) // '*.+(js|ts)'
162
- * ```
163
- */
164
- function extensionsToGlob(extensions: readonly Extension[]): string;
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 { ESLint } from "eslint";
1
+ import { Linter } from "eslint";
2
2
 
3
3
  //#region src/ESLintConfig.d.ts
4
- declare namespace ESLintConfig {
5
- /**
6
- *
7
- * @param configs
8
- */
9
- function concat(...configs: ESLint.ConfigData[]): ESLint.ConfigData;
10
- /**
11
- * Always return 'off'. `_status` is the previous rule value.
12
- *
13
- * @param _status
14
- */
15
- function fixme(_status: string | number | [string | number, ...any[]] | undefined): "off";
16
- /**
17
- * Renames rules in the given object according to the given map.
18
- *
19
- * Given a map `{ 'old-prefix': 'new-prefix' }`, and a rule object
20
- * `{ 'old-prefix/rule-name': 'error' }`, this function will return
21
- * `{ 'new-prefix/rule-name': 'error' }`.
22
- *
23
- * @param rules The object containing the rules to rename.
24
- * @param map The object containing the rename map.
25
- */
26
- function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
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
- declare namespace Project {
89
- /**
90
- * A type of a file extension
91
- */
92
- type Extension = `.${string}`;
93
- /**
94
- * Object hash of all well-known file extension category to file extensions mapping
95
- */
96
- type ExtensionRegistry = { [K in LanguageId]: readonly Extension[] };
97
- /**
98
- * Supported ECMA version
99
- *
100
- * @example
101
- * ```ts
102
- * Project.ecmaVersion() // 2022
103
- * ```
104
- */
105
- function ecmaVersion(): 2022;
106
- /**
107
- * Return a list of extensions
108
- *
109
- * @example
110
- * ```ts
111
- * Project.queryExtensions(['javascript']); // ['.js', '.cjs', ...]
112
- * Project.queryExtensions(['typescript', 'typescriptreact']); // ['.ts', '.mts', ..., '.tsx']
113
- * ```
114
- *
115
- * @param languages
116
- */
117
- function queryExtensions(languages: LanguageId[]): readonly Extension[];
118
- /**
119
- * Supported file extensions
120
- *
121
- * @example
122
- * ```ts
123
- * Project.sourceExtensions() // ['.ts', '.js', ...]
124
- * ```
125
- */
126
- function sourceExtensions(): readonly `.${string}`[];
127
- /**
128
- * Resource file extensions
129
- *
130
- * @example
131
- * ```ts
132
- * Project.resourceExtensions() // ['.css', '.sass', ...]
133
- * ```
134
- */
135
- function resourceExtensions(): readonly `.${string}`[];
136
- /**
137
- * Files and folders to always ignore
138
- *
139
- * @example
140
- * ```ts
141
- * IGNORED // ['node_modules/', 'build/', ...]
142
- * ```
143
- */
144
- function ignored(): readonly string[];
145
- /**
146
- * Return a RegExp that will match any list of extensions
147
- *
148
- * @param extensions
149
- * @example
150
- * ```ts
151
- * Project.extensionsToMatcher(['.js', '.ts']) // RegExp = /(\.js|\.ts)$/
152
- * ```
153
- */
154
- function extensionsToMatcher(extensions: readonly Extension[]): RegExp;
155
- /**
156
- * Return a glob matcher that will match any list of extensions
157
- *
158
- * @param extensions
159
- * @example
160
- * ```ts
161
- * Project.extensionsToGlob(['.js', '.ts']) // '*.+(js|ts)'
162
- * ```
163
- */
164
- function extensionsToGlob(extensions: readonly Extension[]): string;
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