@alint-js/plugin 0.0.33 → 0.0.35
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.mts +673 -14
- package/dist/index.mjs +2 -2
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -84,7 +84,633 @@ interface SourceText {
|
|
|
84
84
|
text: string;
|
|
85
85
|
}
|
|
86
86
|
//#endregion
|
|
87
|
-
//#region
|
|
87
|
+
//#region ../../node_modules/.pnpm/valibot@1.4.2_typescript@6.0.3/node_modules/valibot/dist/index.d.mts
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/types/metadata.d.ts
|
|
90
|
+
/**
|
|
91
|
+
* Base metadata interface.
|
|
92
|
+
*/
|
|
93
|
+
interface BaseMetadata<TInput$1> {
|
|
94
|
+
/**
|
|
95
|
+
* The object kind.
|
|
96
|
+
*/
|
|
97
|
+
readonly kind: "metadata";
|
|
98
|
+
/**
|
|
99
|
+
* The metadata type.
|
|
100
|
+
*/
|
|
101
|
+
readonly type: string;
|
|
102
|
+
/**
|
|
103
|
+
* The metadata reference.
|
|
104
|
+
*/
|
|
105
|
+
readonly reference: (...args: any[]) => BaseMetadata<any>;
|
|
106
|
+
/**
|
|
107
|
+
* The input, output and issue type.
|
|
108
|
+
*
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
readonly "~types"?: {
|
|
112
|
+
readonly input: TInput$1;
|
|
113
|
+
readonly output: TInput$1;
|
|
114
|
+
readonly issue: never;
|
|
115
|
+
} | undefined;
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/types/dataset.d.ts
|
|
119
|
+
/**
|
|
120
|
+
* Unknown dataset interface.
|
|
121
|
+
*/
|
|
122
|
+
interface UnknownDataset {
|
|
123
|
+
/**
|
|
124
|
+
* Whether is's typed.
|
|
125
|
+
*/
|
|
126
|
+
typed?: false;
|
|
127
|
+
/**
|
|
128
|
+
* The dataset value.
|
|
129
|
+
*/
|
|
130
|
+
value: unknown;
|
|
131
|
+
/**
|
|
132
|
+
* The dataset issues.
|
|
133
|
+
*/
|
|
134
|
+
issues?: undefined;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Success dataset interface.
|
|
138
|
+
*/
|
|
139
|
+
interface SuccessDataset<TValue$1> {
|
|
140
|
+
/**
|
|
141
|
+
* Whether is's typed.
|
|
142
|
+
*/
|
|
143
|
+
typed: true;
|
|
144
|
+
/**
|
|
145
|
+
* The dataset value.
|
|
146
|
+
*/
|
|
147
|
+
value: TValue$1;
|
|
148
|
+
/**
|
|
149
|
+
* The dataset issues.
|
|
150
|
+
*/
|
|
151
|
+
issues?: undefined;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Partial dataset interface.
|
|
155
|
+
*/
|
|
156
|
+
interface PartialDataset<TValue$1, TIssue extends BaseIssue<unknown>> {
|
|
157
|
+
/**
|
|
158
|
+
* Whether is's typed.
|
|
159
|
+
*/
|
|
160
|
+
typed: true;
|
|
161
|
+
/**
|
|
162
|
+
* The dataset value.
|
|
163
|
+
*/
|
|
164
|
+
value: TValue$1;
|
|
165
|
+
/**
|
|
166
|
+
* The dataset issues.
|
|
167
|
+
*/
|
|
168
|
+
issues: [TIssue, ...TIssue[]];
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Failure dataset interface.
|
|
172
|
+
*/
|
|
173
|
+
interface FailureDataset<TIssue extends BaseIssue<unknown>> {
|
|
174
|
+
/**
|
|
175
|
+
* Whether is's typed.
|
|
176
|
+
*/
|
|
177
|
+
typed: false;
|
|
178
|
+
/**
|
|
179
|
+
* The dataset value.
|
|
180
|
+
*/
|
|
181
|
+
value: unknown;
|
|
182
|
+
/**
|
|
183
|
+
* The dataset issues.
|
|
184
|
+
*/
|
|
185
|
+
issues: [TIssue, ...TIssue[]];
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Output dataset type.
|
|
189
|
+
*/
|
|
190
|
+
type OutputDataset<TValue$1, TIssue extends BaseIssue<unknown>> = SuccessDataset<TValue$1> | PartialDataset<TValue$1, TIssue> | FailureDataset<TIssue>;
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region src/types/standard.d.ts
|
|
193
|
+
/**
|
|
194
|
+
* The Standard Schema properties interface.
|
|
195
|
+
*/
|
|
196
|
+
interface StandardProps<TInput$1, TOutput$1> {
|
|
197
|
+
/**
|
|
198
|
+
* The version number of the standard.
|
|
199
|
+
*/
|
|
200
|
+
readonly version: 1;
|
|
201
|
+
/**
|
|
202
|
+
* The vendor name of the schema library.
|
|
203
|
+
*/
|
|
204
|
+
readonly vendor: "valibot";
|
|
205
|
+
/**
|
|
206
|
+
* Validates unknown input values.
|
|
207
|
+
*/
|
|
208
|
+
readonly validate: (value: unknown) => StandardResult<TOutput$1> | Promise<StandardResult<TOutput$1>>;
|
|
209
|
+
/**
|
|
210
|
+
* Inferred types associated with the schema.
|
|
211
|
+
*/
|
|
212
|
+
readonly types?: StandardTypes<TInput$1, TOutput$1> | undefined;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The result interface of the validate function.
|
|
216
|
+
*/
|
|
217
|
+
type StandardResult<TOutput$1> = StandardSuccessResult<TOutput$1> | StandardFailureResult;
|
|
218
|
+
/**
|
|
219
|
+
* The result interface if validation succeeds.
|
|
220
|
+
*/
|
|
221
|
+
interface StandardSuccessResult<TOutput$1> {
|
|
222
|
+
/**
|
|
223
|
+
* The typed output value.
|
|
224
|
+
*/
|
|
225
|
+
readonly value: TOutput$1;
|
|
226
|
+
/**
|
|
227
|
+
* The non-existent issues.
|
|
228
|
+
*/
|
|
229
|
+
readonly issues?: undefined;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The result interface if validation fails.
|
|
233
|
+
*/
|
|
234
|
+
interface StandardFailureResult {
|
|
235
|
+
/**
|
|
236
|
+
* The issues of failed validation.
|
|
237
|
+
*/
|
|
238
|
+
readonly issues: readonly StandardIssue[];
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* The issue interface of the failure output.
|
|
242
|
+
*/
|
|
243
|
+
interface StandardIssue {
|
|
244
|
+
/**
|
|
245
|
+
* The error message of the issue.
|
|
246
|
+
*/
|
|
247
|
+
readonly message: string;
|
|
248
|
+
/**
|
|
249
|
+
* The path of the issue, if any.
|
|
250
|
+
*/
|
|
251
|
+
readonly path?: readonly (PropertyKey | StandardPathItem)[] | undefined;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* The path item interface of the issue.
|
|
255
|
+
*/
|
|
256
|
+
interface StandardPathItem {
|
|
257
|
+
/**
|
|
258
|
+
* The key of the path item.
|
|
259
|
+
*/
|
|
260
|
+
readonly key: PropertyKey;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The Standard Schema types interface.
|
|
264
|
+
*/
|
|
265
|
+
interface StandardTypes<TInput$1, TOutput$1> {
|
|
266
|
+
/**
|
|
267
|
+
* The input type of the schema.
|
|
268
|
+
*/
|
|
269
|
+
readonly input: TInput$1;
|
|
270
|
+
/**
|
|
271
|
+
* The output type of the schema.
|
|
272
|
+
*/
|
|
273
|
+
readonly output: TOutput$1;
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/types/schema.d.ts
|
|
277
|
+
/**
|
|
278
|
+
* Base schema interface.
|
|
279
|
+
*/
|
|
280
|
+
interface BaseSchema<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> {
|
|
281
|
+
/**
|
|
282
|
+
* The object kind.
|
|
283
|
+
*/
|
|
284
|
+
readonly kind: "schema";
|
|
285
|
+
/**
|
|
286
|
+
* The schema type.
|
|
287
|
+
*/
|
|
288
|
+
readonly type: string;
|
|
289
|
+
/**
|
|
290
|
+
* The schema reference.
|
|
291
|
+
*/
|
|
292
|
+
readonly reference: (...args: any[]) => BaseSchema<unknown, unknown, BaseIssue<unknown>>;
|
|
293
|
+
/**
|
|
294
|
+
* The expected property.
|
|
295
|
+
*/
|
|
296
|
+
readonly expects: string;
|
|
297
|
+
/**
|
|
298
|
+
* Whether it's async.
|
|
299
|
+
*/
|
|
300
|
+
readonly async: false;
|
|
301
|
+
/**
|
|
302
|
+
* The Standard Schema properties.
|
|
303
|
+
*
|
|
304
|
+
* @internal
|
|
305
|
+
*/
|
|
306
|
+
readonly "~standard": StandardProps<TInput$1, TOutput$1>;
|
|
307
|
+
/**
|
|
308
|
+
* Parses unknown input values.
|
|
309
|
+
*
|
|
310
|
+
* @param dataset The input dataset.
|
|
311
|
+
* @param config The configuration.
|
|
312
|
+
*
|
|
313
|
+
* @returns The output dataset.
|
|
314
|
+
*
|
|
315
|
+
* @internal
|
|
316
|
+
*/
|
|
317
|
+
readonly "~run": (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => OutputDataset<TOutput$1, TIssue>;
|
|
318
|
+
/**
|
|
319
|
+
* The input, output and issue type.
|
|
320
|
+
*
|
|
321
|
+
* @internal
|
|
322
|
+
*/
|
|
323
|
+
readonly "~types"?: {
|
|
324
|
+
readonly input: TInput$1;
|
|
325
|
+
readonly output: TOutput$1;
|
|
326
|
+
readonly issue: TIssue;
|
|
327
|
+
} | undefined;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Base schema async interface.
|
|
331
|
+
*/
|
|
332
|
+
interface BaseSchemaAsync<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> extends Omit<BaseSchema<TInput$1, TOutput$1, TIssue>, "reference" | "async" | "~run"> {
|
|
333
|
+
/**
|
|
334
|
+
* The schema reference.
|
|
335
|
+
*/
|
|
336
|
+
readonly reference: (...args: any[]) => BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>;
|
|
337
|
+
/**
|
|
338
|
+
* Whether it's async.
|
|
339
|
+
*/
|
|
340
|
+
readonly async: true;
|
|
341
|
+
/**
|
|
342
|
+
* Parses unknown input values.
|
|
343
|
+
*
|
|
344
|
+
* @param dataset The input dataset.
|
|
345
|
+
* @param config The configuration.
|
|
346
|
+
*
|
|
347
|
+
* @returns The output dataset.
|
|
348
|
+
*
|
|
349
|
+
* @internal
|
|
350
|
+
*/
|
|
351
|
+
readonly "~run": (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<TOutput$1, TIssue>>;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Generic schema type.
|
|
355
|
+
*/
|
|
356
|
+
type GenericSchema<TInput$1 = unknown, TOutput$1 = TInput$1, TIssue extends BaseIssue<unknown> = BaseIssue<unknown>> = BaseSchema<TInput$1, TOutput$1, TIssue>;
|
|
357
|
+
//#endregion
|
|
358
|
+
//#region src/types/transformation.d.ts
|
|
359
|
+
/**
|
|
360
|
+
* Base transformation interface.
|
|
361
|
+
*/
|
|
362
|
+
interface BaseTransformation<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> {
|
|
363
|
+
/**
|
|
364
|
+
* The object kind.
|
|
365
|
+
*/
|
|
366
|
+
readonly kind: "transformation";
|
|
367
|
+
/**
|
|
368
|
+
* The transformation type.
|
|
369
|
+
*/
|
|
370
|
+
readonly type: string;
|
|
371
|
+
/**
|
|
372
|
+
* The transformation reference.
|
|
373
|
+
*/
|
|
374
|
+
readonly reference: (...args: any[]) => BaseTransformation<any, any, BaseIssue<unknown>>;
|
|
375
|
+
/**
|
|
376
|
+
* Whether it's async.
|
|
377
|
+
*/
|
|
378
|
+
readonly async: false;
|
|
379
|
+
/**
|
|
380
|
+
* Transforms known input values.
|
|
381
|
+
*
|
|
382
|
+
* @param dataset The input dataset.
|
|
383
|
+
* @param config The configuration.
|
|
384
|
+
*
|
|
385
|
+
* @returns The output dataset.
|
|
386
|
+
*
|
|
387
|
+
* @internal
|
|
388
|
+
*/
|
|
389
|
+
readonly "~run": (dataset: SuccessDataset<TInput$1>, config: Config<BaseIssue<unknown>>) => OutputDataset<TOutput$1, BaseIssue<unknown> | TIssue>;
|
|
390
|
+
/**
|
|
391
|
+
* The input, output and issue type.
|
|
392
|
+
*
|
|
393
|
+
* @internal
|
|
394
|
+
*/
|
|
395
|
+
readonly "~types"?: {
|
|
396
|
+
readonly input: TInput$1;
|
|
397
|
+
readonly output: TOutput$1;
|
|
398
|
+
readonly issue: TIssue;
|
|
399
|
+
} | undefined;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Base transformation async interface.
|
|
403
|
+
*/
|
|
404
|
+
interface BaseTransformationAsync<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> extends Omit<BaseTransformation<TInput$1, TOutput$1, TIssue>, "reference" | "async" | "~run"> {
|
|
405
|
+
/**
|
|
406
|
+
* The transformation reference.
|
|
407
|
+
*/
|
|
408
|
+
readonly reference: (...args: any[]) => BaseTransformation<any, any, BaseIssue<unknown>> | BaseTransformationAsync<any, any, BaseIssue<unknown>>;
|
|
409
|
+
/**
|
|
410
|
+
* Whether it's async.
|
|
411
|
+
*/
|
|
412
|
+
readonly async: true;
|
|
413
|
+
/**
|
|
414
|
+
* Transforms known input values.
|
|
415
|
+
*
|
|
416
|
+
* @param dataset The input dataset.
|
|
417
|
+
* @param config The configuration.
|
|
418
|
+
*
|
|
419
|
+
* @returns The output dataset.
|
|
420
|
+
*
|
|
421
|
+
* @internal
|
|
422
|
+
*/
|
|
423
|
+
readonly "~run": (dataset: SuccessDataset<TInput$1>, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<TOutput$1, BaseIssue<unknown> | TIssue>>;
|
|
424
|
+
}
|
|
425
|
+
//#endregion
|
|
426
|
+
//#region src/types/validation.d.ts
|
|
427
|
+
/**
|
|
428
|
+
* Base validation interface.
|
|
429
|
+
*/
|
|
430
|
+
interface BaseValidation<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> {
|
|
431
|
+
/**
|
|
432
|
+
* The object kind.
|
|
433
|
+
*/
|
|
434
|
+
readonly kind: "validation";
|
|
435
|
+
/**
|
|
436
|
+
* The validation type.
|
|
437
|
+
*/
|
|
438
|
+
readonly type: string;
|
|
439
|
+
/**
|
|
440
|
+
* The validation reference.
|
|
441
|
+
*/
|
|
442
|
+
readonly reference: (...args: any[]) => BaseValidation<any, any, BaseIssue<unknown>>;
|
|
443
|
+
/**
|
|
444
|
+
* The expected property.
|
|
445
|
+
*/
|
|
446
|
+
readonly expects: string | null;
|
|
447
|
+
/**
|
|
448
|
+
* Whether it's async.
|
|
449
|
+
*/
|
|
450
|
+
readonly async: false;
|
|
451
|
+
/**
|
|
452
|
+
* Validates known input values.
|
|
453
|
+
*
|
|
454
|
+
* @param dataset The input dataset.
|
|
455
|
+
* @param config The configuration.
|
|
456
|
+
*
|
|
457
|
+
* @returns The output dataset.
|
|
458
|
+
*
|
|
459
|
+
* @internal
|
|
460
|
+
*/
|
|
461
|
+
readonly "~run": (dataset: OutputDataset<TInput$1, BaseIssue<unknown>>, config: Config<BaseIssue<unknown>>) => OutputDataset<TOutput$1, BaseIssue<unknown> | TIssue>;
|
|
462
|
+
/**
|
|
463
|
+
* The input, output and issue type.
|
|
464
|
+
*
|
|
465
|
+
* @internal
|
|
466
|
+
*/
|
|
467
|
+
readonly "~types"?: {
|
|
468
|
+
readonly input: TInput$1;
|
|
469
|
+
readonly output: TOutput$1;
|
|
470
|
+
readonly issue: TIssue;
|
|
471
|
+
} | undefined;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Base validation async interface.
|
|
475
|
+
*/
|
|
476
|
+
interface BaseValidationAsync<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> extends Omit<BaseValidation<TInput$1, TOutput$1, TIssue>, "reference" | "async" | "~run"> {
|
|
477
|
+
/**
|
|
478
|
+
* The validation reference.
|
|
479
|
+
*/
|
|
480
|
+
readonly reference: (...args: any[]) => BaseValidation<any, any, BaseIssue<unknown>> | BaseValidationAsync<any, any, BaseIssue<unknown>>;
|
|
481
|
+
/**
|
|
482
|
+
* Whether it's async.
|
|
483
|
+
*/
|
|
484
|
+
readonly async: true;
|
|
485
|
+
/**
|
|
486
|
+
* Validates known input values.
|
|
487
|
+
*
|
|
488
|
+
* @param dataset The input dataset.
|
|
489
|
+
* @param config The configuration.
|
|
490
|
+
*
|
|
491
|
+
* @returns The output dataset.
|
|
492
|
+
*
|
|
493
|
+
* @internal
|
|
494
|
+
*/
|
|
495
|
+
readonly "~run": (dataset: OutputDataset<TInput$1, BaseIssue<unknown>>, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<TOutput$1, BaseIssue<unknown> | TIssue>>;
|
|
496
|
+
}
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/types/infer.d.ts
|
|
499
|
+
/**
|
|
500
|
+
* Infer input type.
|
|
501
|
+
*/
|
|
502
|
+
type InferInput<TItem$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<any, unknown, BaseIssue<unknown>> | BaseValidationAsync<any, unknown, BaseIssue<unknown>> | BaseTransformation<any, unknown, BaseIssue<unknown>> | BaseTransformationAsync<any, unknown, BaseIssue<unknown>> | BaseMetadata<any>> = NonNullable<TItem$1["~types"]>["input"];
|
|
503
|
+
/**
|
|
504
|
+
* Infer output type.
|
|
505
|
+
*/
|
|
506
|
+
type InferOutput<TItem$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<any, unknown, BaseIssue<unknown>> | BaseValidationAsync<any, unknown, BaseIssue<unknown>> | BaseTransformation<any, unknown, BaseIssue<unknown>> | BaseTransformationAsync<any, unknown, BaseIssue<unknown>> | BaseMetadata<any>> = NonNullable<TItem$1["~types"]>["output"];
|
|
507
|
+
/**
|
|
508
|
+
* Constructs a type that is maybe readonly.
|
|
509
|
+
*/
|
|
510
|
+
type MaybeReadonly<TValue$1> = TValue$1 | Readonly<TValue$1>;
|
|
511
|
+
//#endregion
|
|
512
|
+
//#region src/types/other.d.ts
|
|
513
|
+
/**
|
|
514
|
+
* Error message type.
|
|
515
|
+
*/
|
|
516
|
+
type ErrorMessage<TIssue extends BaseIssue<unknown>> = ((issue: TIssue) => string) | string;
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region src/types/issue.d.ts
|
|
519
|
+
/**
|
|
520
|
+
* Array path item interface.
|
|
521
|
+
*/
|
|
522
|
+
interface ArrayPathItem {
|
|
523
|
+
/**
|
|
524
|
+
* The path item type.
|
|
525
|
+
*/
|
|
526
|
+
readonly type: "array";
|
|
527
|
+
/**
|
|
528
|
+
* The path item origin.
|
|
529
|
+
*/
|
|
530
|
+
readonly origin: "value";
|
|
531
|
+
/**
|
|
532
|
+
* The path item input.
|
|
533
|
+
*/
|
|
534
|
+
readonly input: MaybeReadonly<unknown[]>;
|
|
535
|
+
/**
|
|
536
|
+
* The path item key.
|
|
537
|
+
*/
|
|
538
|
+
readonly key: number;
|
|
539
|
+
/**
|
|
540
|
+
* The path item value.
|
|
541
|
+
*/
|
|
542
|
+
readonly value: unknown;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Map path item interface.
|
|
546
|
+
*/
|
|
547
|
+
interface MapPathItem {
|
|
548
|
+
/**
|
|
549
|
+
* The path item type.
|
|
550
|
+
*/
|
|
551
|
+
readonly type: "map";
|
|
552
|
+
/**
|
|
553
|
+
* The path item origin.
|
|
554
|
+
*/
|
|
555
|
+
readonly origin: "key" | "value";
|
|
556
|
+
/**
|
|
557
|
+
* The path item input.
|
|
558
|
+
*/
|
|
559
|
+
readonly input: Map<unknown, unknown>;
|
|
560
|
+
/**
|
|
561
|
+
* The path item key.
|
|
562
|
+
*/
|
|
563
|
+
readonly key: unknown;
|
|
564
|
+
/**
|
|
565
|
+
* The path item value.
|
|
566
|
+
*/
|
|
567
|
+
readonly value: unknown;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Object path item interface.
|
|
571
|
+
*/
|
|
572
|
+
interface ObjectPathItem {
|
|
573
|
+
/**
|
|
574
|
+
* The path item type.
|
|
575
|
+
*/
|
|
576
|
+
readonly type: "object";
|
|
577
|
+
/**
|
|
578
|
+
* The path item origin.
|
|
579
|
+
*/
|
|
580
|
+
readonly origin: "key" | "value";
|
|
581
|
+
/**
|
|
582
|
+
* The path item input.
|
|
583
|
+
*/
|
|
584
|
+
readonly input: Record<string, unknown>;
|
|
585
|
+
/**
|
|
586
|
+
* The path item key.
|
|
587
|
+
*/
|
|
588
|
+
readonly key: string;
|
|
589
|
+
/**
|
|
590
|
+
* The path item value.
|
|
591
|
+
*/
|
|
592
|
+
readonly value: unknown;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Set path item interface.
|
|
596
|
+
*/
|
|
597
|
+
interface SetPathItem {
|
|
598
|
+
/**
|
|
599
|
+
* The path item type.
|
|
600
|
+
*/
|
|
601
|
+
readonly type: "set";
|
|
602
|
+
/**
|
|
603
|
+
* The path item origin.
|
|
604
|
+
*/
|
|
605
|
+
readonly origin: "value";
|
|
606
|
+
/**
|
|
607
|
+
* The path item input.
|
|
608
|
+
*/
|
|
609
|
+
readonly input: Set<unknown>;
|
|
610
|
+
/**
|
|
611
|
+
* The path item key.
|
|
612
|
+
*/
|
|
613
|
+
readonly key: null;
|
|
614
|
+
/**
|
|
615
|
+
* The path item key.
|
|
616
|
+
*/
|
|
617
|
+
readonly value: unknown;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Unknown path item interface.
|
|
621
|
+
*/
|
|
622
|
+
interface UnknownPathItem {
|
|
623
|
+
/**
|
|
624
|
+
* The path item type.
|
|
625
|
+
*/
|
|
626
|
+
readonly type: "unknown";
|
|
627
|
+
/**
|
|
628
|
+
* The path item origin.
|
|
629
|
+
*/
|
|
630
|
+
readonly origin: "key" | "value";
|
|
631
|
+
/**
|
|
632
|
+
* The path item input.
|
|
633
|
+
*/
|
|
634
|
+
readonly input: unknown;
|
|
635
|
+
/**
|
|
636
|
+
* The path item key.
|
|
637
|
+
*/
|
|
638
|
+
readonly key: unknown;
|
|
639
|
+
/**
|
|
640
|
+
* The path item value.
|
|
641
|
+
*/
|
|
642
|
+
readonly value: unknown;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Issue path item type.
|
|
646
|
+
*/
|
|
647
|
+
type IssuePathItem = ArrayPathItem | MapPathItem | ObjectPathItem | SetPathItem | UnknownPathItem;
|
|
648
|
+
/**
|
|
649
|
+
* Base issue interface.
|
|
650
|
+
*/
|
|
651
|
+
interface BaseIssue<TInput$1> extends Config<BaseIssue<TInput$1>> {
|
|
652
|
+
/**
|
|
653
|
+
* The issue kind.
|
|
654
|
+
*/
|
|
655
|
+
readonly kind: "schema" | "validation" | "transformation";
|
|
656
|
+
/**
|
|
657
|
+
* The issue type.
|
|
658
|
+
*/
|
|
659
|
+
readonly type: string;
|
|
660
|
+
/**
|
|
661
|
+
* The raw input data.
|
|
662
|
+
*/
|
|
663
|
+
readonly input: TInput$1;
|
|
664
|
+
/**
|
|
665
|
+
* The expected property.
|
|
666
|
+
*/
|
|
667
|
+
readonly expected: string | null;
|
|
668
|
+
/**
|
|
669
|
+
* The received property.
|
|
670
|
+
*/
|
|
671
|
+
readonly received: string;
|
|
672
|
+
/**
|
|
673
|
+
* The error message.
|
|
674
|
+
*/
|
|
675
|
+
readonly message: string;
|
|
676
|
+
/**
|
|
677
|
+
* The input requirement.
|
|
678
|
+
*/
|
|
679
|
+
readonly requirement?: unknown | undefined;
|
|
680
|
+
/**
|
|
681
|
+
* The issue path.
|
|
682
|
+
*/
|
|
683
|
+
readonly path?: [IssuePathItem, ...IssuePathItem[]] | undefined;
|
|
684
|
+
/**
|
|
685
|
+
* The sub issues.
|
|
686
|
+
*/
|
|
687
|
+
readonly issues?: [BaseIssue<TInput$1>, ...BaseIssue<TInput$1>[]] | undefined;
|
|
688
|
+
}
|
|
689
|
+
//#endregion
|
|
690
|
+
//#region src/types/config.d.ts
|
|
691
|
+
/**
|
|
692
|
+
* Config interface.
|
|
693
|
+
*/
|
|
694
|
+
interface Config<TIssue extends BaseIssue<unknown>> {
|
|
695
|
+
/**
|
|
696
|
+
* The selected language.
|
|
697
|
+
*/
|
|
698
|
+
readonly lang?: string | undefined;
|
|
699
|
+
/**
|
|
700
|
+
* The error message.
|
|
701
|
+
*/
|
|
702
|
+
readonly message?: ErrorMessage<TIssue> | undefined;
|
|
703
|
+
/**
|
|
704
|
+
* Whether it should be aborted early.
|
|
705
|
+
*/
|
|
706
|
+
readonly abortEarly?: boolean | undefined;
|
|
707
|
+
/**
|
|
708
|
+
* Whether a pipe should be aborted early.
|
|
709
|
+
*/
|
|
710
|
+
readonly abortPipeEarly?: boolean | undefined;
|
|
711
|
+
}
|
|
712
|
+
//#endregion
|
|
713
|
+
//#region ../core/dist/types-m5T_UL76.d.mts
|
|
88
714
|
//#region src/config/types.d.ts
|
|
89
715
|
type ModelSize = 'large' | 'medium' | 'small';
|
|
90
716
|
interface RunnerCacheConfig {
|
|
@@ -205,7 +831,8 @@ interface DirectoryTarget {
|
|
|
205
831
|
interface EnabledRule {
|
|
206
832
|
id: string;
|
|
207
833
|
localId: string;
|
|
208
|
-
|
|
834
|
+
options: readonly unknown[];
|
|
835
|
+
rule: RuleDefinition<any>;
|
|
209
836
|
severity: Exclude<RuleSeverity, 'off'>;
|
|
210
837
|
}
|
|
211
838
|
interface IgnoreConfig {
|
|
@@ -216,11 +843,11 @@ interface LanguageDefinition {
|
|
|
216
843
|
extract: (file: SourceFile, context: LanguageContext) => Awaitable<SourceTarget[]>;
|
|
217
844
|
name: string;
|
|
218
845
|
}
|
|
219
|
-
interface PluginDefinition {
|
|
846
|
+
interface PluginDefinition<Rules extends Record<string, RuleDefinition<any>> = Record<string, RuleDefinition<any>>> {
|
|
220
847
|
configs?: Record<string, AlintConfigInput>;
|
|
221
848
|
languages?: Record<string, LanguageDefinition>;
|
|
222
849
|
processors?: Record<string, ProcessorDefinition>;
|
|
223
|
-
rules?:
|
|
850
|
+
rules?: Rules;
|
|
224
851
|
}
|
|
225
852
|
interface ProcessorDefinition {
|
|
226
853
|
postprocess?: (diagnostics: DiagnosticDescriptor[], context: ProcessorPostprocessContext) => Awaitable<DiagnosticDescriptor[]>;
|
|
@@ -235,8 +862,8 @@ interface ProjectTarget {
|
|
|
235
862
|
type RuleCacheConfig = boolean | {
|
|
236
863
|
level?: 'target';
|
|
237
864
|
};
|
|
238
|
-
type RuleConfigEntry = [RuleSeverity] | RuleSeverity;
|
|
239
|
-
interface RuleContext {
|
|
865
|
+
type RuleConfigEntry<Options extends readonly unknown[] = readonly []> = readonly [RuleSeverity, ...Partial<Options>] | RuleSeverity;
|
|
866
|
+
interface RuleContext<Options extends readonly unknown[] = readonly []> {
|
|
240
867
|
agent?: AgentAdapter;
|
|
241
868
|
cwd: string;
|
|
242
869
|
id: string;
|
|
@@ -248,6 +875,7 @@ interface RuleContext {
|
|
|
248
875
|
recordUsage: (usage: RuleInferenceUsageRecord) => void;
|
|
249
876
|
};
|
|
250
877
|
model: (selector?: ModelRequirement | string) => Promise<ResolvedModel>;
|
|
878
|
+
options: Options;
|
|
251
879
|
outputLanguage?: string;
|
|
252
880
|
report: (diagnostic: DiagnosticDescriptor) => void;
|
|
253
881
|
settings: Record<string, unknown>;
|
|
@@ -260,12 +888,13 @@ interface RuleContext {
|
|
|
260
888
|
signal?: AbortSignal;
|
|
261
889
|
src: SourceRuntime;
|
|
262
890
|
}
|
|
263
|
-
interface RuleDefinition {
|
|
891
|
+
interface RuleDefinition<OptionsSchema extends RuleOptionsSchema = []> {
|
|
264
892
|
cache?: RuleCacheConfig;
|
|
265
893
|
/** Additional stable rule inputs, such as imported prompts, that invalidate cached results when changed. */
|
|
266
894
|
cacheKey?: unknown;
|
|
267
|
-
create: (context: RuleContext) => RuleHandlers;
|
|
895
|
+
create: (context: RuleContext<RuleOptionsOutput<OptionsSchema>>) => RuleHandlers;
|
|
268
896
|
model?: ModelRequirement;
|
|
897
|
+
options?: OptionsSchema;
|
|
269
898
|
}
|
|
270
899
|
type RuleHandlers = RuleSpecializedHandlers | RuleWithHandler;
|
|
271
900
|
interface RuleInferenceUsageRecord {
|
|
@@ -278,9 +907,12 @@ interface RuleInferenceUsageRecord {
|
|
|
278
907
|
ruleId?: string;
|
|
279
908
|
totalTokens?: number;
|
|
280
909
|
}
|
|
910
|
+
type RuleOptionsInput<OptionsSchema extends RuleOptionsSchema> = { readonly [Index in keyof OptionsSchema]: InferInput<OptionsSchema[Index]>; };
|
|
911
|
+
type RuleOptionsOutput<OptionsSchema extends RuleOptionsSchema> = { readonly [Index in keyof OptionsSchema]: InferOutput<OptionsSchema[Index]>; };
|
|
912
|
+
type RuleOptionsSchema = readonly GenericSchema[];
|
|
281
913
|
interface RuleRegistry {
|
|
282
914
|
enabledRules: EnabledRule[];
|
|
283
|
-
rules: Map<string, RuleDefinition
|
|
915
|
+
rules: Map<string, RuleDefinition<any>>;
|
|
284
916
|
}
|
|
285
917
|
type RuleSeverity = 'error' | 'off' | 'warn';
|
|
286
918
|
interface RuleSpecializedHandlers {
|
|
@@ -301,6 +933,38 @@ interface RuleWithHandler {
|
|
|
301
933
|
}
|
|
302
934
|
type Target = DirectoryTarget | ProjectTarget | SourceTarget;
|
|
303
935
|
//#endregion
|
|
936
|
+
//#region ../core/dist/define-CnBawoAI.d.mts
|
|
937
|
+
//#region src/dsl/define.d.ts
|
|
938
|
+
type AnyRuleDefinition = RuleDefinition<any>;
|
|
939
|
+
type ConfigItemWithPluginRules<Plugins, Rules> = Omit<AlintConfigItem, 'plugins' | 'rules'> & {
|
|
940
|
+
plugins?: Plugins;
|
|
941
|
+
rules?: RulesForPlugins<NonNullable<Plugins>, Rules>;
|
|
942
|
+
};
|
|
943
|
+
type ConfigItemWithPlugins<Plugins> = Omit<AlintConfigItem, 'plugins' | 'rules'> & {
|
|
944
|
+
plugins?: Plugins;
|
|
945
|
+
rules?: Record<string, RuleConfigEntry<readonly unknown[]> | undefined>;
|
|
946
|
+
};
|
|
947
|
+
type RuleEntryForPlugins<Plugins, Key extends string> = Key extends `${infer Alias}/${infer RuleName}` ? Alias extends keyof Plugins & string ? Plugins[Alias] extends PluginDefinition<infer Rules> ? RuleName extends keyof Rules & string ? Rules[RuleName] extends RuleDefinition<infer OptionsSchema> ? RuleConfigEntry<RuleOptionsInput<OptionsSchema>> : RuleConfigEntry<readonly unknown[]> : RuleConfigEntry<readonly unknown[]> : RuleConfigEntry<readonly unknown[]> : RuleConfigEntry<readonly unknown[]> : RuleConfigEntry<readonly unknown[]>;
|
|
948
|
+
type RulesForPlugins<Plugins, Rules> = { readonly [Key in keyof Rules]: Key extends string ? RuleEntryForPlugins<Plugins, Key> : never; };
|
|
949
|
+
type TypedConfigInput<Item> = Item extends readonly [] ? readonly [] : Item extends readonly [unknown, ...unknown[]] ? { readonly [Index in keyof Item]: TypedConfigInput<Item[Index]>; } : Item extends readonly (infer Element)[] ? readonly TypedConfigInput<Element>[] : TypedConfigItem<Item>;
|
|
950
|
+
type TypedConfigItem<Item> = Item extends {
|
|
951
|
+
plugins?: infer Plugins;
|
|
952
|
+
rules?: infer Rules;
|
|
953
|
+
} ? ConfigItemWithPluginRules<Plugins, Rules> : TypedConfigItemWithoutRuleConfig<Item>;
|
|
954
|
+
type TypedConfigItemWithoutRuleConfig<Item> = Item extends {
|
|
955
|
+
plugins?: infer Plugins;
|
|
956
|
+
} ? ConfigItemWithPlugins<Plugins> : AlintConfigItem;
|
|
957
|
+
declare function defineConfig<const Config extends readonly unknown[]>(config: Config & TypedConfigInput<Config>): AlintConfig;
|
|
958
|
+
declare function definePlugin<const Rules extends Record<string, AnyRuleDefinition> = Record<string, AnyRuleDefinition>>(plugin: Omit<PluginDefinition<Rules>, 'rules'> & {
|
|
959
|
+
rules?: Rules;
|
|
960
|
+
}): PluginDefinition<Rules>;
|
|
961
|
+
declare function defineRule(rule: Omit<RuleDefinition<[]>, 'options'> & {
|
|
962
|
+
options?: undefined;
|
|
963
|
+
}): RuleDefinition<[]>;
|
|
964
|
+
declare function defineRule<const OptionsSchema extends RuleOptionsSchema>(rule: RuleDefinition<OptionsSchema> & {
|
|
965
|
+
options: OptionsSchema;
|
|
966
|
+
}): RuleDefinition<OptionsSchema>;
|
|
967
|
+
//#endregion
|
|
304
968
|
//#region ../core/dist/agent.d.mts
|
|
305
969
|
//#region src/agent/retry.d.ts
|
|
306
970
|
/**
|
|
@@ -314,9 +978,4 @@ declare function isRetryableAgentError(error: unknown): error is RetryableAgentE
|
|
|
314
978
|
declare function defineTool(tool: AgentTool): AgentTool;
|
|
315
979
|
declare function requireAgent(context: Pick<RuleContext, 'agent' | 'id' | 'signal'>): AgentAdapter;
|
|
316
980
|
//#endregion
|
|
317
|
-
//#region src/index.d.ts
|
|
318
|
-
declare function defineConfig(config: readonly AlintConfigInput[]): AlintConfig;
|
|
319
|
-
declare function definePlugin(plugin: PluginDefinition): PluginDefinition;
|
|
320
|
-
declare function defineRule(rule: RuleDefinition): RuleDefinition;
|
|
321
|
-
//#endregion
|
|
322
981
|
export { type AgentAdapter, type AgentRequest, type AgentResult, type AgentTool, type AgentUsage, type AlintConfig, type AlintConfigExtends, type AlintConfigInput, type AlintConfigItem, type AlintLinterOptions, type Awaitable, type ClassTarget, type DiagnosticDescriptor, type DiagnosticLocation, type DirectoryTarget, type EnabledRule, type FileTarget, type FunctionTarget, type IgnoreConfig, type LanguageContext, type LanguageDefinition, type LineRange, type ModelRequirement, type PluginDefinition, type ProcessedSource, type ProcessedSourceOrigin, type ProcessorContext, type ProcessorDefinition, type ProcessorPostprocessContext, type ProjectTarget, type ResolvedModel, type ResolvedProvider, RetryableAgentError, type RuleCacheConfig, type RuleConfigEntry, type RuleContext, type RuleDefinition, type RuleHandlers, type RuleInferenceUsageRecord, type RuleRegistry, type RuleSeverity, type RuleSpecializedHandlers, type RuleWithHandler, type SourceFile, type SourceLocation, type SourcePosition, type SourceRange, type SourceRuntime, type SourceTarget, type SourceTargetKind, type SourceTargetOfKind, type SourceTargetOrigin, type SourceText, type Target, defineConfig, definePlugin, defineRule, defineTool, isRetryableAgentError, requireAgent };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../core/dist/agent-
|
|
1
|
+
//#region ../core/dist/agent-B6GG68NX.mjs
|
|
2
2
|
/**
|
|
3
3
|
* Declares that the complete adapter invocation can be safely replayed.
|
|
4
4
|
* Adapters must not throw this after a tool or another externally visible side effect starts.
|
|
@@ -24,7 +24,7 @@ function requireAgent(context) {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
|
-
//#region
|
|
27
|
+
//#region ../core/dist/define-Da342Fcx.mjs
|
|
28
28
|
function defineConfig(config) {
|
|
29
29
|
return config;
|
|
30
30
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alint-js/plugin",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.35",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.mts",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"dist"
|
|
14
14
|
],
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"
|
|
16
|
+
"valibot": "^1.4.2",
|
|
17
|
+
"@alint-js/core": "0.0.35"
|
|
17
18
|
},
|
|
18
19
|
"scripts": {
|
|
19
20
|
"build": "tsdown",
|