@alint-js/plugin-js 0.0.32 → 0.0.34
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 +647 -15
- package/dist/index.mjs +8 -2
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -85,7 +85,627 @@ interface SourceText {
|
|
|
85
85
|
text: string;
|
|
86
86
|
}
|
|
87
87
|
//#endregion
|
|
88
|
-
//#region
|
|
88
|
+
//#region ../../node_modules/.pnpm/valibot@1.4.2_typescript@6.0.3/node_modules/valibot/dist/index.d.mts
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/types/metadata.d.ts
|
|
91
|
+
/**
|
|
92
|
+
* Base metadata interface.
|
|
93
|
+
*/
|
|
94
|
+
interface BaseMetadata$1<TInput$1> {
|
|
95
|
+
/**
|
|
96
|
+
* The object kind.
|
|
97
|
+
*/
|
|
98
|
+
readonly kind: "metadata";
|
|
99
|
+
/**
|
|
100
|
+
* The metadata type.
|
|
101
|
+
*/
|
|
102
|
+
readonly type: string;
|
|
103
|
+
/**
|
|
104
|
+
* The metadata reference.
|
|
105
|
+
*/
|
|
106
|
+
readonly reference: (...args: any[]) => BaseMetadata$1<any>;
|
|
107
|
+
/**
|
|
108
|
+
* The input, output and issue type.
|
|
109
|
+
*
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
readonly "~types"?: {
|
|
113
|
+
readonly input: TInput$1;
|
|
114
|
+
readonly output: TInput$1;
|
|
115
|
+
readonly issue: never;
|
|
116
|
+
} | undefined;
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/types/dataset.d.ts
|
|
120
|
+
/**
|
|
121
|
+
* Unknown dataset interface.
|
|
122
|
+
*/
|
|
123
|
+
interface UnknownDataset$1 {
|
|
124
|
+
/**
|
|
125
|
+
* Whether is's typed.
|
|
126
|
+
*/
|
|
127
|
+
typed?: false;
|
|
128
|
+
/**
|
|
129
|
+
* The dataset value.
|
|
130
|
+
*/
|
|
131
|
+
value: unknown;
|
|
132
|
+
/**
|
|
133
|
+
* The dataset issues.
|
|
134
|
+
*/
|
|
135
|
+
issues?: undefined;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Success dataset interface.
|
|
139
|
+
*/
|
|
140
|
+
interface SuccessDataset$1<TValue$1> {
|
|
141
|
+
/**
|
|
142
|
+
* Whether is's typed.
|
|
143
|
+
*/
|
|
144
|
+
typed: true;
|
|
145
|
+
/**
|
|
146
|
+
* The dataset value.
|
|
147
|
+
*/
|
|
148
|
+
value: TValue$1;
|
|
149
|
+
/**
|
|
150
|
+
* The dataset issues.
|
|
151
|
+
*/
|
|
152
|
+
issues?: undefined;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Partial dataset interface.
|
|
156
|
+
*/
|
|
157
|
+
interface PartialDataset$1<TValue$1, TIssue extends BaseIssue$1<unknown>> {
|
|
158
|
+
/**
|
|
159
|
+
* Whether is's typed.
|
|
160
|
+
*/
|
|
161
|
+
typed: true;
|
|
162
|
+
/**
|
|
163
|
+
* The dataset value.
|
|
164
|
+
*/
|
|
165
|
+
value: TValue$1;
|
|
166
|
+
/**
|
|
167
|
+
* The dataset issues.
|
|
168
|
+
*/
|
|
169
|
+
issues: [TIssue, ...TIssue[]];
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Failure dataset interface.
|
|
173
|
+
*/
|
|
174
|
+
interface FailureDataset$1<TIssue extends BaseIssue$1<unknown>> {
|
|
175
|
+
/**
|
|
176
|
+
* Whether is's typed.
|
|
177
|
+
*/
|
|
178
|
+
typed: false;
|
|
179
|
+
/**
|
|
180
|
+
* The dataset value.
|
|
181
|
+
*/
|
|
182
|
+
value: unknown;
|
|
183
|
+
/**
|
|
184
|
+
* The dataset issues.
|
|
185
|
+
*/
|
|
186
|
+
issues: [TIssue, ...TIssue[]];
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Output dataset type.
|
|
190
|
+
*/
|
|
191
|
+
type OutputDataset$1<TValue$1, TIssue extends BaseIssue$1<unknown>> = SuccessDataset$1<TValue$1> | PartialDataset$1<TValue$1, TIssue> | FailureDataset$1<TIssue>;
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/types/standard.d.ts
|
|
194
|
+
/**
|
|
195
|
+
* The Standard Schema properties interface.
|
|
196
|
+
*/
|
|
197
|
+
interface StandardProps$1<TInput$1, TOutput$1> {
|
|
198
|
+
/**
|
|
199
|
+
* The version number of the standard.
|
|
200
|
+
*/
|
|
201
|
+
readonly version: 1;
|
|
202
|
+
/**
|
|
203
|
+
* The vendor name of the schema library.
|
|
204
|
+
*/
|
|
205
|
+
readonly vendor: "valibot";
|
|
206
|
+
/**
|
|
207
|
+
* Validates unknown input values.
|
|
208
|
+
*/
|
|
209
|
+
readonly validate: (value: unknown) => StandardResult$1<TOutput$1> | Promise<StandardResult$1<TOutput$1>>;
|
|
210
|
+
/**
|
|
211
|
+
* Inferred types associated with the schema.
|
|
212
|
+
*/
|
|
213
|
+
readonly types?: StandardTypes$1<TInput$1, TOutput$1> | undefined;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* The result interface of the validate function.
|
|
217
|
+
*/
|
|
218
|
+
type StandardResult$1<TOutput$1> = StandardSuccessResult$1<TOutput$1> | StandardFailureResult$1;
|
|
219
|
+
/**
|
|
220
|
+
* The result interface if validation succeeds.
|
|
221
|
+
*/
|
|
222
|
+
interface StandardSuccessResult$1<TOutput$1> {
|
|
223
|
+
/**
|
|
224
|
+
* The typed output value.
|
|
225
|
+
*/
|
|
226
|
+
readonly value: TOutput$1;
|
|
227
|
+
/**
|
|
228
|
+
* The non-existent issues.
|
|
229
|
+
*/
|
|
230
|
+
readonly issues?: undefined;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The result interface if validation fails.
|
|
234
|
+
*/
|
|
235
|
+
interface StandardFailureResult$1 {
|
|
236
|
+
/**
|
|
237
|
+
* The issues of failed validation.
|
|
238
|
+
*/
|
|
239
|
+
readonly issues: readonly StandardIssue$1[];
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* The issue interface of the failure output.
|
|
243
|
+
*/
|
|
244
|
+
interface StandardIssue$1 {
|
|
245
|
+
/**
|
|
246
|
+
* The error message of the issue.
|
|
247
|
+
*/
|
|
248
|
+
readonly message: string;
|
|
249
|
+
/**
|
|
250
|
+
* The path of the issue, if any.
|
|
251
|
+
*/
|
|
252
|
+
readonly path?: readonly (PropertyKey | StandardPathItem$1)[] | undefined;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* The path item interface of the issue.
|
|
256
|
+
*/
|
|
257
|
+
interface StandardPathItem$1 {
|
|
258
|
+
/**
|
|
259
|
+
* The key of the path item.
|
|
260
|
+
*/
|
|
261
|
+
readonly key: PropertyKey;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* The Standard Schema types interface.
|
|
265
|
+
*/
|
|
266
|
+
interface StandardTypes$1<TInput$1, TOutput$1> {
|
|
267
|
+
/**
|
|
268
|
+
* The input type of the schema.
|
|
269
|
+
*/
|
|
270
|
+
readonly input: TInput$1;
|
|
271
|
+
/**
|
|
272
|
+
* The output type of the schema.
|
|
273
|
+
*/
|
|
274
|
+
readonly output: TOutput$1;
|
|
275
|
+
}
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region src/types/schema.d.ts
|
|
278
|
+
/**
|
|
279
|
+
* Base schema interface.
|
|
280
|
+
*/
|
|
281
|
+
interface BaseSchema$1<TInput$1, TOutput$1, TIssue extends BaseIssue$1<unknown>> {
|
|
282
|
+
/**
|
|
283
|
+
* The object kind.
|
|
284
|
+
*/
|
|
285
|
+
readonly kind: "schema";
|
|
286
|
+
/**
|
|
287
|
+
* The schema type.
|
|
288
|
+
*/
|
|
289
|
+
readonly type: string;
|
|
290
|
+
/**
|
|
291
|
+
* The schema reference.
|
|
292
|
+
*/
|
|
293
|
+
readonly reference: (...args: any[]) => BaseSchema$1<unknown, unknown, BaseIssue$1<unknown>>;
|
|
294
|
+
/**
|
|
295
|
+
* The expected property.
|
|
296
|
+
*/
|
|
297
|
+
readonly expects: string;
|
|
298
|
+
/**
|
|
299
|
+
* Whether it's async.
|
|
300
|
+
*/
|
|
301
|
+
readonly async: false;
|
|
302
|
+
/**
|
|
303
|
+
* The Standard Schema properties.
|
|
304
|
+
*
|
|
305
|
+
* @internal
|
|
306
|
+
*/
|
|
307
|
+
readonly "~standard": StandardProps$1<TInput$1, TOutput$1>;
|
|
308
|
+
/**
|
|
309
|
+
* Parses unknown input values.
|
|
310
|
+
*
|
|
311
|
+
* @param dataset The input dataset.
|
|
312
|
+
* @param config The configuration.
|
|
313
|
+
*
|
|
314
|
+
* @returns The output dataset.
|
|
315
|
+
*
|
|
316
|
+
* @internal
|
|
317
|
+
*/
|
|
318
|
+
readonly "~run": (dataset: UnknownDataset$1, config: Config$1<BaseIssue$1<unknown>>) => OutputDataset$1<TOutput$1, TIssue>;
|
|
319
|
+
/**
|
|
320
|
+
* The input, output and issue type.
|
|
321
|
+
*
|
|
322
|
+
* @internal
|
|
323
|
+
*/
|
|
324
|
+
readonly "~types"?: {
|
|
325
|
+
readonly input: TInput$1;
|
|
326
|
+
readonly output: TOutput$1;
|
|
327
|
+
readonly issue: TIssue;
|
|
328
|
+
} | undefined;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Base schema async interface.
|
|
332
|
+
*/
|
|
333
|
+
interface BaseSchemaAsync$1<TInput$1, TOutput$1, TIssue extends BaseIssue$1<unknown>> extends Omit<BaseSchema$1<TInput$1, TOutput$1, TIssue>, "reference" | "async" | "~run"> {
|
|
334
|
+
/**
|
|
335
|
+
* The schema reference.
|
|
336
|
+
*/
|
|
337
|
+
readonly reference: (...args: any[]) => BaseSchema$1<unknown, unknown, BaseIssue$1<unknown>> | BaseSchemaAsync$1<unknown, unknown, BaseIssue$1<unknown>>;
|
|
338
|
+
/**
|
|
339
|
+
* Whether it's async.
|
|
340
|
+
*/
|
|
341
|
+
readonly async: true;
|
|
342
|
+
/**
|
|
343
|
+
* Parses unknown input values.
|
|
344
|
+
*
|
|
345
|
+
* @param dataset The input dataset.
|
|
346
|
+
* @param config The configuration.
|
|
347
|
+
*
|
|
348
|
+
* @returns The output dataset.
|
|
349
|
+
*
|
|
350
|
+
* @internal
|
|
351
|
+
*/
|
|
352
|
+
readonly "~run": (dataset: UnknownDataset$1, config: Config$1<BaseIssue$1<unknown>>) => Promise<OutputDataset$1<TOutput$1, TIssue>>;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Generic schema type.
|
|
356
|
+
*/
|
|
357
|
+
type GenericSchema<TInput$1 = unknown, TOutput$1 = TInput$1, TIssue extends BaseIssue$1<unknown> = BaseIssue$1<unknown>> = BaseSchema$1<TInput$1, TOutput$1, TIssue>;
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/types/transformation.d.ts
|
|
360
|
+
/**
|
|
361
|
+
* Base transformation interface.
|
|
362
|
+
*/
|
|
363
|
+
interface BaseTransformation$1<TInput$1, TOutput$1, TIssue extends BaseIssue$1<unknown>> {
|
|
364
|
+
/**
|
|
365
|
+
* The object kind.
|
|
366
|
+
*/
|
|
367
|
+
readonly kind: "transformation";
|
|
368
|
+
/**
|
|
369
|
+
* The transformation type.
|
|
370
|
+
*/
|
|
371
|
+
readonly type: string;
|
|
372
|
+
/**
|
|
373
|
+
* The transformation reference.
|
|
374
|
+
*/
|
|
375
|
+
readonly reference: (...args: any[]) => BaseTransformation$1<any, any, BaseIssue$1<unknown>>;
|
|
376
|
+
/**
|
|
377
|
+
* Whether it's async.
|
|
378
|
+
*/
|
|
379
|
+
readonly async: false;
|
|
380
|
+
/**
|
|
381
|
+
* Transforms known input values.
|
|
382
|
+
*
|
|
383
|
+
* @param dataset The input dataset.
|
|
384
|
+
* @param config The configuration.
|
|
385
|
+
*
|
|
386
|
+
* @returns The output dataset.
|
|
387
|
+
*
|
|
388
|
+
* @internal
|
|
389
|
+
*/
|
|
390
|
+
readonly "~run": (dataset: SuccessDataset$1<TInput$1>, config: Config$1<BaseIssue$1<unknown>>) => OutputDataset$1<TOutput$1, BaseIssue$1<unknown> | TIssue>;
|
|
391
|
+
/**
|
|
392
|
+
* The input, output and issue type.
|
|
393
|
+
*
|
|
394
|
+
* @internal
|
|
395
|
+
*/
|
|
396
|
+
readonly "~types"?: {
|
|
397
|
+
readonly input: TInput$1;
|
|
398
|
+
readonly output: TOutput$1;
|
|
399
|
+
readonly issue: TIssue;
|
|
400
|
+
} | undefined;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Base transformation async interface.
|
|
404
|
+
*/
|
|
405
|
+
interface BaseTransformationAsync$1<TInput$1, TOutput$1, TIssue extends BaseIssue$1<unknown>> extends Omit<BaseTransformation$1<TInput$1, TOutput$1, TIssue>, "reference" | "async" | "~run"> {
|
|
406
|
+
/**
|
|
407
|
+
* The transformation reference.
|
|
408
|
+
*/
|
|
409
|
+
readonly reference: (...args: any[]) => BaseTransformation$1<any, any, BaseIssue$1<unknown>> | BaseTransformationAsync$1<any, any, BaseIssue$1<unknown>>;
|
|
410
|
+
/**
|
|
411
|
+
* Whether it's async.
|
|
412
|
+
*/
|
|
413
|
+
readonly async: true;
|
|
414
|
+
/**
|
|
415
|
+
* Transforms known input values.
|
|
416
|
+
*
|
|
417
|
+
* @param dataset The input dataset.
|
|
418
|
+
* @param config The configuration.
|
|
419
|
+
*
|
|
420
|
+
* @returns The output dataset.
|
|
421
|
+
*
|
|
422
|
+
* @internal
|
|
423
|
+
*/
|
|
424
|
+
readonly "~run": (dataset: SuccessDataset$1<TInput$1>, config: Config$1<BaseIssue$1<unknown>>) => Promise<OutputDataset$1<TOutput$1, BaseIssue$1<unknown> | TIssue>>;
|
|
425
|
+
}
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/types/validation.d.ts
|
|
428
|
+
/**
|
|
429
|
+
* Base validation interface.
|
|
430
|
+
*/
|
|
431
|
+
interface BaseValidation$1<TInput$1, TOutput$1, TIssue extends BaseIssue$1<unknown>> {
|
|
432
|
+
/**
|
|
433
|
+
* The object kind.
|
|
434
|
+
*/
|
|
435
|
+
readonly kind: "validation";
|
|
436
|
+
/**
|
|
437
|
+
* The validation type.
|
|
438
|
+
*/
|
|
439
|
+
readonly type: string;
|
|
440
|
+
/**
|
|
441
|
+
* The validation reference.
|
|
442
|
+
*/
|
|
443
|
+
readonly reference: (...args: any[]) => BaseValidation$1<any, any, BaseIssue$1<unknown>>;
|
|
444
|
+
/**
|
|
445
|
+
* The expected property.
|
|
446
|
+
*/
|
|
447
|
+
readonly expects: string | null;
|
|
448
|
+
/**
|
|
449
|
+
* Whether it's async.
|
|
450
|
+
*/
|
|
451
|
+
readonly async: false;
|
|
452
|
+
/**
|
|
453
|
+
* Validates known input values.
|
|
454
|
+
*
|
|
455
|
+
* @param dataset The input dataset.
|
|
456
|
+
* @param config The configuration.
|
|
457
|
+
*
|
|
458
|
+
* @returns The output dataset.
|
|
459
|
+
*
|
|
460
|
+
* @internal
|
|
461
|
+
*/
|
|
462
|
+
readonly "~run": (dataset: OutputDataset$1<TInput$1, BaseIssue$1<unknown>>, config: Config$1<BaseIssue$1<unknown>>) => OutputDataset$1<TOutput$1, BaseIssue$1<unknown> | TIssue>;
|
|
463
|
+
/**
|
|
464
|
+
* The input, output and issue type.
|
|
465
|
+
*
|
|
466
|
+
* @internal
|
|
467
|
+
*/
|
|
468
|
+
readonly "~types"?: {
|
|
469
|
+
readonly input: TInput$1;
|
|
470
|
+
readonly output: TOutput$1;
|
|
471
|
+
readonly issue: TIssue;
|
|
472
|
+
} | undefined;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Base validation async interface.
|
|
476
|
+
*/
|
|
477
|
+
interface BaseValidationAsync$1<TInput$1, TOutput$1, TIssue extends BaseIssue$1<unknown>> extends Omit<BaseValidation$1<TInput$1, TOutput$1, TIssue>, "reference" | "async" | "~run"> {
|
|
478
|
+
/**
|
|
479
|
+
* The validation reference.
|
|
480
|
+
*/
|
|
481
|
+
readonly reference: (...args: any[]) => BaseValidation$1<any, any, BaseIssue$1<unknown>> | BaseValidationAsync$1<any, any, BaseIssue$1<unknown>>;
|
|
482
|
+
/**
|
|
483
|
+
* Whether it's async.
|
|
484
|
+
*/
|
|
485
|
+
readonly async: true;
|
|
486
|
+
/**
|
|
487
|
+
* Validates known input values.
|
|
488
|
+
*
|
|
489
|
+
* @param dataset The input dataset.
|
|
490
|
+
* @param config The configuration.
|
|
491
|
+
*
|
|
492
|
+
* @returns The output dataset.
|
|
493
|
+
*
|
|
494
|
+
* @internal
|
|
495
|
+
*/
|
|
496
|
+
readonly "~run": (dataset: OutputDataset$1<TInput$1, BaseIssue$1<unknown>>, config: Config$1<BaseIssue$1<unknown>>) => Promise<OutputDataset$1<TOutput$1, BaseIssue$1<unknown> | TIssue>>;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Infer output type.
|
|
500
|
+
*/
|
|
501
|
+
type InferOutput$1<TItem$1 extends BaseSchema$1<unknown, unknown, BaseIssue$1<unknown>> | BaseSchemaAsync$1<unknown, unknown, BaseIssue$1<unknown>> | BaseValidation$1<any, unknown, BaseIssue$1<unknown>> | BaseValidationAsync$1<any, unknown, BaseIssue$1<unknown>> | BaseTransformation$1<any, unknown, BaseIssue$1<unknown>> | BaseTransformationAsync$1<any, unknown, BaseIssue$1<unknown>> | BaseMetadata$1<any>> = NonNullable<TItem$1["~types"]>["output"];
|
|
502
|
+
/**
|
|
503
|
+
* Constructs a type that is maybe readonly.
|
|
504
|
+
*/
|
|
505
|
+
type MaybeReadonly$1<TValue$1> = TValue$1 | Readonly<TValue$1>;
|
|
506
|
+
//#endregion
|
|
507
|
+
//#region src/types/other.d.ts
|
|
508
|
+
/**
|
|
509
|
+
* Error message type.
|
|
510
|
+
*/
|
|
511
|
+
type ErrorMessage$1<TIssue extends BaseIssue$1<unknown>> = ((issue: TIssue) => string) | string;
|
|
512
|
+
//#endregion
|
|
513
|
+
//#region src/types/issue.d.ts
|
|
514
|
+
/**
|
|
515
|
+
* Array path item interface.
|
|
516
|
+
*/
|
|
517
|
+
interface ArrayPathItem$1 {
|
|
518
|
+
/**
|
|
519
|
+
* The path item type.
|
|
520
|
+
*/
|
|
521
|
+
readonly type: "array";
|
|
522
|
+
/**
|
|
523
|
+
* The path item origin.
|
|
524
|
+
*/
|
|
525
|
+
readonly origin: "value";
|
|
526
|
+
/**
|
|
527
|
+
* The path item input.
|
|
528
|
+
*/
|
|
529
|
+
readonly input: MaybeReadonly$1<unknown[]>;
|
|
530
|
+
/**
|
|
531
|
+
* The path item key.
|
|
532
|
+
*/
|
|
533
|
+
readonly key: number;
|
|
534
|
+
/**
|
|
535
|
+
* The path item value.
|
|
536
|
+
*/
|
|
537
|
+
readonly value: unknown;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Map path item interface.
|
|
541
|
+
*/
|
|
542
|
+
interface MapPathItem$1 {
|
|
543
|
+
/**
|
|
544
|
+
* The path item type.
|
|
545
|
+
*/
|
|
546
|
+
readonly type: "map";
|
|
547
|
+
/**
|
|
548
|
+
* The path item origin.
|
|
549
|
+
*/
|
|
550
|
+
readonly origin: "key" | "value";
|
|
551
|
+
/**
|
|
552
|
+
* The path item input.
|
|
553
|
+
*/
|
|
554
|
+
readonly input: Map<unknown, unknown>;
|
|
555
|
+
/**
|
|
556
|
+
* The path item key.
|
|
557
|
+
*/
|
|
558
|
+
readonly key: unknown;
|
|
559
|
+
/**
|
|
560
|
+
* The path item value.
|
|
561
|
+
*/
|
|
562
|
+
readonly value: unknown;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Object path item interface.
|
|
566
|
+
*/
|
|
567
|
+
interface ObjectPathItem$1 {
|
|
568
|
+
/**
|
|
569
|
+
* The path item type.
|
|
570
|
+
*/
|
|
571
|
+
readonly type: "object";
|
|
572
|
+
/**
|
|
573
|
+
* The path item origin.
|
|
574
|
+
*/
|
|
575
|
+
readonly origin: "key" | "value";
|
|
576
|
+
/**
|
|
577
|
+
* The path item input.
|
|
578
|
+
*/
|
|
579
|
+
readonly input: Record<string, unknown>;
|
|
580
|
+
/**
|
|
581
|
+
* The path item key.
|
|
582
|
+
*/
|
|
583
|
+
readonly key: string;
|
|
584
|
+
/**
|
|
585
|
+
* The path item value.
|
|
586
|
+
*/
|
|
587
|
+
readonly value: unknown;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Set path item interface.
|
|
591
|
+
*/
|
|
592
|
+
interface SetPathItem$1 {
|
|
593
|
+
/**
|
|
594
|
+
* The path item type.
|
|
595
|
+
*/
|
|
596
|
+
readonly type: "set";
|
|
597
|
+
/**
|
|
598
|
+
* The path item origin.
|
|
599
|
+
*/
|
|
600
|
+
readonly origin: "value";
|
|
601
|
+
/**
|
|
602
|
+
* The path item input.
|
|
603
|
+
*/
|
|
604
|
+
readonly input: Set<unknown>;
|
|
605
|
+
/**
|
|
606
|
+
* The path item key.
|
|
607
|
+
*/
|
|
608
|
+
readonly key: null;
|
|
609
|
+
/**
|
|
610
|
+
* The path item key.
|
|
611
|
+
*/
|
|
612
|
+
readonly value: unknown;
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Unknown path item interface.
|
|
616
|
+
*/
|
|
617
|
+
interface UnknownPathItem$1 {
|
|
618
|
+
/**
|
|
619
|
+
* The path item type.
|
|
620
|
+
*/
|
|
621
|
+
readonly type: "unknown";
|
|
622
|
+
/**
|
|
623
|
+
* The path item origin.
|
|
624
|
+
*/
|
|
625
|
+
readonly origin: "key" | "value";
|
|
626
|
+
/**
|
|
627
|
+
* The path item input.
|
|
628
|
+
*/
|
|
629
|
+
readonly input: unknown;
|
|
630
|
+
/**
|
|
631
|
+
* The path item key.
|
|
632
|
+
*/
|
|
633
|
+
readonly key: unknown;
|
|
634
|
+
/**
|
|
635
|
+
* The path item value.
|
|
636
|
+
*/
|
|
637
|
+
readonly value: unknown;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Issue path item type.
|
|
641
|
+
*/
|
|
642
|
+
type IssuePathItem$1 = ArrayPathItem$1 | MapPathItem$1 | ObjectPathItem$1 | SetPathItem$1 | UnknownPathItem$1;
|
|
643
|
+
/**
|
|
644
|
+
* Base issue interface.
|
|
645
|
+
*/
|
|
646
|
+
interface BaseIssue$1<TInput$1> extends Config$1<BaseIssue$1<TInput$1>> {
|
|
647
|
+
/**
|
|
648
|
+
* The issue kind.
|
|
649
|
+
*/
|
|
650
|
+
readonly kind: "schema" | "validation" | "transformation";
|
|
651
|
+
/**
|
|
652
|
+
* The issue type.
|
|
653
|
+
*/
|
|
654
|
+
readonly type: string;
|
|
655
|
+
/**
|
|
656
|
+
* The raw input data.
|
|
657
|
+
*/
|
|
658
|
+
readonly input: TInput$1;
|
|
659
|
+
/**
|
|
660
|
+
* The expected property.
|
|
661
|
+
*/
|
|
662
|
+
readonly expected: string | null;
|
|
663
|
+
/**
|
|
664
|
+
* The received property.
|
|
665
|
+
*/
|
|
666
|
+
readonly received: string;
|
|
667
|
+
/**
|
|
668
|
+
* The error message.
|
|
669
|
+
*/
|
|
670
|
+
readonly message: string;
|
|
671
|
+
/**
|
|
672
|
+
* The input requirement.
|
|
673
|
+
*/
|
|
674
|
+
readonly requirement?: unknown | undefined;
|
|
675
|
+
/**
|
|
676
|
+
* The issue path.
|
|
677
|
+
*/
|
|
678
|
+
readonly path?: [IssuePathItem$1, ...IssuePathItem$1[]] | undefined;
|
|
679
|
+
/**
|
|
680
|
+
* The sub issues.
|
|
681
|
+
*/
|
|
682
|
+
readonly issues?: [BaseIssue$1<TInput$1>, ...BaseIssue$1<TInput$1>[]] | undefined;
|
|
683
|
+
}
|
|
684
|
+
//#endregion
|
|
685
|
+
//#region src/types/config.d.ts
|
|
686
|
+
/**
|
|
687
|
+
* Config interface.
|
|
688
|
+
*/
|
|
689
|
+
interface Config$1<TIssue extends BaseIssue$1<unknown>> {
|
|
690
|
+
/**
|
|
691
|
+
* The selected language.
|
|
692
|
+
*/
|
|
693
|
+
readonly lang?: string | undefined;
|
|
694
|
+
/**
|
|
695
|
+
* The error message.
|
|
696
|
+
*/
|
|
697
|
+
readonly message?: ErrorMessage$1<TIssue> | undefined;
|
|
698
|
+
/**
|
|
699
|
+
* Whether it should be aborted early.
|
|
700
|
+
*/
|
|
701
|
+
readonly abortEarly?: boolean | undefined;
|
|
702
|
+
/**
|
|
703
|
+
* Whether a pipe should be aborted early.
|
|
704
|
+
*/
|
|
705
|
+
readonly abortPipeEarly?: boolean | undefined;
|
|
706
|
+
}
|
|
707
|
+
//#endregion
|
|
708
|
+
//#region ../core/dist/types-m5T_UL76.d.mts
|
|
89
709
|
//#region src/config/types.d.ts
|
|
90
710
|
type ModelSize = 'large' | 'medium' | 'small';
|
|
91
711
|
interface RunnerCacheConfig {
|
|
@@ -208,11 +828,11 @@ interface LanguageDefinition {
|
|
|
208
828
|
extract: (file: SourceFile, context: LanguageContext) => Awaitable<SourceTarget[]>;
|
|
209
829
|
name: string;
|
|
210
830
|
}
|
|
211
|
-
interface PluginDefinition {
|
|
831
|
+
interface PluginDefinition<Rules extends Record<string, RuleDefinition<any>> = Record<string, RuleDefinition<any>>> {
|
|
212
832
|
configs?: Record<string, AlintConfigInput>;
|
|
213
833
|
languages?: Record<string, LanguageDefinition>;
|
|
214
834
|
processors?: Record<string, ProcessorDefinition>;
|
|
215
|
-
rules?:
|
|
835
|
+
rules?: Rules;
|
|
216
836
|
}
|
|
217
837
|
interface ProcessorDefinition {
|
|
218
838
|
postprocess?: (diagnostics: DiagnosticDescriptor[], context: ProcessorPostprocessContext) => Awaitable<DiagnosticDescriptor[]>;
|
|
@@ -227,8 +847,8 @@ interface ProjectTarget {
|
|
|
227
847
|
type RuleCacheConfig = boolean | {
|
|
228
848
|
level?: 'target';
|
|
229
849
|
};
|
|
230
|
-
type RuleConfigEntry = [RuleSeverity] | RuleSeverity;
|
|
231
|
-
interface RuleContext {
|
|
850
|
+
type RuleConfigEntry<Options extends readonly unknown[] = readonly []> = readonly [RuleSeverity, ...Partial<Options>] | RuleSeverity;
|
|
851
|
+
interface RuleContext<Options extends readonly unknown[] = readonly []> {
|
|
232
852
|
agent?: AgentAdapter;
|
|
233
853
|
cwd: string;
|
|
234
854
|
id: string;
|
|
@@ -240,6 +860,7 @@ interface RuleContext {
|
|
|
240
860
|
recordUsage: (usage: RuleInferenceUsageRecord) => void;
|
|
241
861
|
};
|
|
242
862
|
model: (selector?: ModelRequirement | string) => Promise<ResolvedModel>;
|
|
863
|
+
options: Options;
|
|
243
864
|
outputLanguage?: string;
|
|
244
865
|
report: (diagnostic: DiagnosticDescriptor) => void;
|
|
245
866
|
settings: Record<string, unknown>;
|
|
@@ -252,12 +873,13 @@ interface RuleContext {
|
|
|
252
873
|
signal?: AbortSignal;
|
|
253
874
|
src: SourceRuntime;
|
|
254
875
|
}
|
|
255
|
-
interface RuleDefinition {
|
|
876
|
+
interface RuleDefinition<OptionsSchema extends RuleOptionsSchema = []> {
|
|
256
877
|
cache?: RuleCacheConfig;
|
|
257
878
|
/** Additional stable rule inputs, such as imported prompts, that invalidate cached results when changed. */
|
|
258
879
|
cacheKey?: unknown;
|
|
259
|
-
create: (context: RuleContext) => RuleHandlers;
|
|
880
|
+
create: (context: RuleContext<RuleOptionsOutput<OptionsSchema>>) => RuleHandlers;
|
|
260
881
|
model?: ModelRequirement;
|
|
882
|
+
options?: OptionsSchema;
|
|
261
883
|
}
|
|
262
884
|
type RuleHandlers = RuleSpecializedHandlers | RuleWithHandler;
|
|
263
885
|
interface RuleInferenceUsageRecord {
|
|
@@ -270,6 +892,8 @@ interface RuleInferenceUsageRecord {
|
|
|
270
892
|
ruleId?: string;
|
|
271
893
|
totalTokens?: number;
|
|
272
894
|
}
|
|
895
|
+
type RuleOptionsOutput<OptionsSchema extends RuleOptionsSchema> = { readonly [Index in keyof OptionsSchema]: InferOutput$1<OptionsSchema[Index]>; };
|
|
896
|
+
type RuleOptionsSchema = readonly GenericSchema[];
|
|
273
897
|
type RuleSeverity = 'error' | 'off' | 'warn';
|
|
274
898
|
interface RuleSpecializedHandlers {
|
|
275
899
|
onTargetClass?: (target: ClassTarget) => Awaitable<void>;
|
|
@@ -1870,27 +2494,35 @@ declare function createJudgeMessages(source: string, retryFeedback: string | und
|
|
|
1870
2494
|
declare function createReportFindingsToolParameters(): JsonSchema;
|
|
1871
2495
|
//#endregion
|
|
1872
2496
|
//#region src/rules/inline-miniature-normalizer/rule.d.ts
|
|
1873
|
-
declare const inlineMiniatureNormalizerRule: RuleDefinition
|
|
2497
|
+
declare const inlineMiniatureNormalizerRule: RuleDefinition<[]>;
|
|
1874
2498
|
//#endregion
|
|
1875
2499
|
//#region src/rules/no-mixed-layers-without-abstraction/rule.d.ts
|
|
1876
|
-
declare const mixedLayersWithoutAbstractionRule: RuleDefinition
|
|
2500
|
+
declare const mixedLayersWithoutAbstractionRule: RuleDefinition<[]>;
|
|
1877
2501
|
//#endregion
|
|
1878
2502
|
//#region src/rules/no-private-schema-toolkit/rule.d.ts
|
|
1879
|
-
declare const privateSchemaToolkitRule: RuleDefinition
|
|
2503
|
+
declare const privateSchemaToolkitRule: RuleDefinition<[]>;
|
|
1880
2504
|
//#endregion
|
|
1881
2505
|
//#region src/rules/no-redundant-binding/rule.d.ts
|
|
1882
|
-
declare const redundantBindingRule: RuleDefinition
|
|
2506
|
+
declare const redundantBindingRule: RuleDefinition<[]>;
|
|
1883
2507
|
//#endregion
|
|
1884
2508
|
//#region src/rules/no-redundant-jsdoc/rule.d.ts
|
|
1885
|
-
declare const redundantJsdocRule: RuleDefinition
|
|
2509
|
+
declare const redundantJsdocRule: RuleDefinition<[]>;
|
|
1886
2510
|
//#endregion
|
|
1887
2511
|
//#region src/rules/no-trivial-wrapper-stack/rule.d.ts
|
|
1888
|
-
declare const trivialWrapperStackRule: RuleDefinition
|
|
2512
|
+
declare const trivialWrapperStackRule: RuleDefinition<[]>;
|
|
1889
2513
|
//#endregion
|
|
1890
2514
|
//#region src/rules/no-vacuous-function/rule.d.ts
|
|
1891
|
-
declare const vacuousFunctionRule: RuleDefinition
|
|
2515
|
+
declare const vacuousFunctionRule: RuleDefinition<[]>;
|
|
1892
2516
|
//#endregion
|
|
1893
2517
|
//#region src/index.d.ts
|
|
1894
|
-
declare const _default: PluginDefinition
|
|
2518
|
+
declare const _default: PluginDefinition<{
|
|
2519
|
+
readonly 'inline-miniature-normalizer': RuleDefinition<[]>;
|
|
2520
|
+
readonly 'no-mixed-layers-without-abstraction': RuleDefinition<[]>;
|
|
2521
|
+
readonly 'no-private-schema-toolkit': RuleDefinition<[]>;
|
|
2522
|
+
readonly 'no-redundant-binding': RuleDefinition<[]>;
|
|
2523
|
+
readonly 'no-redundant-jsdoc': RuleDefinition<[]>;
|
|
2524
|
+
readonly 'no-trivial-wrapper-stack': RuleDefinition<[]>;
|
|
2525
|
+
readonly 'no-vacuous-function': RuleDefinition<[]>;
|
|
2526
|
+
}>;
|
|
1895
2527
|
//#endregion
|
|
1896
2528
|
export { createJudgeMessages, createReportFindingsToolParameters, _default as default, inlineMiniatureNormalizerRule, judgeFindingSchema, judgeResponseSchema, mixedLayersWithoutAbstractionRule, privateSchemaToolkitRule, redundantBindingRule, redundantJsdocRule, trivialWrapperStackRule, vacuousFunctionRule };
|
package/dist/index.mjs
CHANGED
|
@@ -1946,7 +1946,10 @@ Finding granularity:
|
|
|
1946
1946
|
- Put supporting types and constants in relatedDeclarations unless they independently own an operation or policy.
|
|
1947
1947
|
- relatedDeclarations may cue supporting declarations and cooperation, movement, or call relationships between primary findings, but must not replace a primary finding for an independently owned operation, adaptation, or policy.
|
|
1948
1948
|
- Do not replace declaration findings with one file-level summary.
|
|
1949
|
-
- Each suggestion must
|
|
1949
|
+
- Each suggestion must identify the declarations that belong together, the focused boundary role they should form, and the lower-level knowledge that boundary should remove from the consumer.
|
|
1950
|
+
- Each suggestion must be directly actionable from the warning text alone without inventing concrete symbol names. Include: the boundary responsibility, the kind of semantic operation or result it should expose, the caller-side dependency to replace, and the migration grouping for related declarations.
|
|
1951
|
+
- Do not propose exact owner names, function names, type names, file paths, or API signatures unless those names already exist in the reviewed source. Prefer role-level wording such as "an account-resolution boundary" or "a semantic search operation" over fabricated names.
|
|
1952
|
+
- Do not merely restate that layers are mixed. Say what code should move or stay, what kind of boundary the consumer should call afterward, and what lower-level concepts the consumer should stop knowing.
|
|
1950
1953
|
- Use relatedDeclarations to cue declarations that should move together, call through the proposed boundary, or stop depending on each other directly.
|
|
1951
1954
|
|
|
1952
1955
|
Do not report:
|
|
@@ -2194,7 +2197,7 @@ function reportMixedLayerFindings(ctx, filePath, findings) {
|
|
|
2194
2197
|
column: 0,
|
|
2195
2198
|
line: finding.line
|
|
2196
2199
|
} },
|
|
2197
|
-
message: finding
|
|
2200
|
+
message: formatMixedLayerMessage(finding)
|
|
2198
2201
|
});
|
|
2199
2202
|
}
|
|
2200
2203
|
function selectReportedMixedLayerFindings(decisions) {
|
|
@@ -2213,6 +2216,9 @@ function selectReportedMixedLayerFindings(decisions) {
|
|
|
2213
2216
|
}
|
|
2214
2217
|
return selectedFindings;
|
|
2215
2218
|
}
|
|
2219
|
+
function formatMixedLayerMessage(finding) {
|
|
2220
|
+
return [finding.message, `Suggestion: ${finding.suggestion}`].join("\n");
|
|
2221
|
+
}
|
|
2216
2222
|
function renderMixedLayerDraft(findings) {
|
|
2217
2223
|
return JSON.stringify({ findings: findings.map((finding) => ({
|
|
2218
2224
|
boundaryKind: finding.boundaryKind,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alint-js/plugin-js",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.34",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.mts",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"@valibot/to-json-schema": "^1.7.1",
|
|
17
17
|
"apeira": "^0.0.7",
|
|
18
18
|
"valibot": "^1.4.2",
|
|
19
|
-
"@alint-js/
|
|
20
|
-
"@alint-js/
|
|
19
|
+
"@alint-js/core": "0.0.34",
|
|
20
|
+
"@alint-js/plugin": "0.0.34"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "tsdown",
|