@eslint-react/shared 1.24.0-next.1 → 1.24.0-next.12
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 +218 -220
- package/dist/index.d.ts +218 -220
- package/dist/index.js +79 -99
- package/dist/index.mjs +77 -96
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
import { _ } from '@eslint-react/eff';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* The NPM scope for this project.
|
|
@@ -69,7 +70,7 @@ type SchemaWithPipe<TPipe extends [
|
|
|
69
70
|
*
|
|
70
71
|
* @internal
|
|
71
72
|
*/
|
|
72
|
-
readonly '~standard':
|
|
73
|
+
readonly '~standard': StandardProps<InferInput<FirstTupleItem<TPipe>>, InferOutput<LastTupleItem<TPipe>>>;
|
|
73
74
|
/**
|
|
74
75
|
* Parses unknown input values.
|
|
75
76
|
*
|
|
@@ -113,7 +114,7 @@ type SchemaWithPipeAsync<TPipe extends [
|
|
|
113
114
|
*
|
|
114
115
|
* @internal
|
|
115
116
|
*/
|
|
116
|
-
readonly '~standard':
|
|
117
|
+
readonly '~standard': StandardProps<InferInput<FirstTupleItem<TPipe>>, InferOutput<LastTupleItem<TPipe>>>;
|
|
117
118
|
/**
|
|
118
119
|
* Parses unknown input values.
|
|
119
120
|
*
|
|
@@ -138,7 +139,7 @@ type SchemaWithPipeAsync<TPipe extends [
|
|
|
138
139
|
};
|
|
139
140
|
|
|
140
141
|
/**
|
|
141
|
-
* Base metadata
|
|
142
|
+
* Base metadata interface.
|
|
142
143
|
*/
|
|
143
144
|
interface BaseMetadata<TInput> {
|
|
144
145
|
/**
|
|
@@ -166,7 +167,7 @@ interface BaseMetadata<TInput> {
|
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
/**
|
|
169
|
-
* Unknown dataset
|
|
170
|
+
* Unknown dataset interface.
|
|
170
171
|
*/
|
|
171
172
|
interface UnknownDataset {
|
|
172
173
|
/**
|
|
@@ -183,7 +184,7 @@ interface UnknownDataset {
|
|
|
183
184
|
issues?: undefined;
|
|
184
185
|
}
|
|
185
186
|
/**
|
|
186
|
-
* Success dataset
|
|
187
|
+
* Success dataset interface.
|
|
187
188
|
*/
|
|
188
189
|
interface SuccessDataset<TValue> {
|
|
189
190
|
/**
|
|
@@ -200,7 +201,7 @@ interface SuccessDataset<TValue> {
|
|
|
200
201
|
issues?: undefined;
|
|
201
202
|
}
|
|
202
203
|
/**
|
|
203
|
-
* Partial dataset
|
|
204
|
+
* Partial dataset interface.
|
|
204
205
|
*/
|
|
205
206
|
interface PartialDataset<TValue, TIssue extends BaseIssue<unknown>> {
|
|
206
207
|
/**
|
|
@@ -217,7 +218,7 @@ interface PartialDataset<TValue, TIssue extends BaseIssue<unknown>> {
|
|
|
217
218
|
issues: [TIssue, ...TIssue[]];
|
|
218
219
|
}
|
|
219
220
|
/**
|
|
220
|
-
* Failure dataset
|
|
221
|
+
* Failure dataset interface.
|
|
221
222
|
*/
|
|
222
223
|
interface FailureDataset<TIssue extends BaseIssue<unknown>> {
|
|
223
224
|
/**
|
|
@@ -241,7 +242,7 @@ type OutputDataset<TValue, TIssue extends BaseIssue<unknown>> = SuccessDataset<T
|
|
|
241
242
|
/**
|
|
242
243
|
* The Standard Schema properties interface.
|
|
243
244
|
*/
|
|
244
|
-
interface
|
|
245
|
+
interface StandardProps<TInput, TOutput> {
|
|
245
246
|
/**
|
|
246
247
|
* The version number of the standard.
|
|
247
248
|
*/
|
|
@@ -253,24 +254,24 @@ interface StandardSchemaProps<Input, Output> {
|
|
|
253
254
|
/**
|
|
254
255
|
* Validates unknown input values.
|
|
255
256
|
*/
|
|
256
|
-
readonly validate: (value: unknown) => StandardResult<
|
|
257
|
+
readonly validate: (value: unknown) => StandardResult<TOutput> | Promise<StandardResult<TOutput>>;
|
|
257
258
|
/**
|
|
258
259
|
* Inferred types associated with the schema.
|
|
259
260
|
*/
|
|
260
|
-
readonly types?: StandardTypes<
|
|
261
|
+
readonly types?: StandardTypes<TInput, TOutput> | undefined;
|
|
261
262
|
}
|
|
262
263
|
/**
|
|
263
264
|
* The result interface of the validate function.
|
|
264
265
|
*/
|
|
265
|
-
type StandardResult<
|
|
266
|
+
type StandardResult<TOutput> = StandardSuccessResult<TOutput> | StandardFailureResult;
|
|
266
267
|
/**
|
|
267
268
|
* The result interface if validation succeeds.
|
|
268
269
|
*/
|
|
269
|
-
interface StandardSuccessResult<
|
|
270
|
+
interface StandardSuccessResult<TOutput> {
|
|
270
271
|
/**
|
|
271
272
|
* The typed output value.
|
|
272
273
|
*/
|
|
273
|
-
readonly value:
|
|
274
|
+
readonly value: TOutput;
|
|
274
275
|
/**
|
|
275
276
|
* The non-existent issues.
|
|
276
277
|
*/
|
|
@@ -296,33 +297,33 @@ interface StandardIssue {
|
|
|
296
297
|
/**
|
|
297
298
|
* The path of the issue, if any.
|
|
298
299
|
*/
|
|
299
|
-
readonly path?: readonly (PropertyKey |
|
|
300
|
+
readonly path?: readonly (PropertyKey | StandardPathItem)[] | undefined;
|
|
300
301
|
}
|
|
301
302
|
/**
|
|
302
|
-
* The path
|
|
303
|
+
* The path item interface of the issue.
|
|
303
304
|
*/
|
|
304
|
-
interface
|
|
305
|
+
interface StandardPathItem {
|
|
305
306
|
/**
|
|
306
|
-
* The key
|
|
307
|
+
* The key of the path item.
|
|
307
308
|
*/
|
|
308
309
|
readonly key: PropertyKey;
|
|
309
310
|
}
|
|
310
311
|
/**
|
|
311
|
-
* The
|
|
312
|
+
* The Standard Schema types interface.
|
|
312
313
|
*/
|
|
313
|
-
interface StandardTypes<
|
|
314
|
+
interface StandardTypes<TInput, TOutput> {
|
|
314
315
|
/**
|
|
315
316
|
* The input type of the schema.
|
|
316
317
|
*/
|
|
317
|
-
readonly input:
|
|
318
|
+
readonly input: TInput;
|
|
318
319
|
/**
|
|
319
320
|
* The output type of the schema.
|
|
320
321
|
*/
|
|
321
|
-
readonly output:
|
|
322
|
+
readonly output: TOutput;
|
|
322
323
|
}
|
|
323
324
|
|
|
324
325
|
/**
|
|
325
|
-
* Base schema
|
|
326
|
+
* Base schema interface.
|
|
326
327
|
*/
|
|
327
328
|
interface BaseSchema<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
|
|
328
329
|
/**
|
|
@@ -350,7 +351,7 @@ interface BaseSchema<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
|
|
|
350
351
|
*
|
|
351
352
|
* @internal
|
|
352
353
|
*/
|
|
353
|
-
readonly '~standard':
|
|
354
|
+
readonly '~standard': StandardProps<TInput, TOutput>;
|
|
354
355
|
/**
|
|
355
356
|
* Parses unknown input values.
|
|
356
357
|
*
|
|
@@ -374,7 +375,7 @@ interface BaseSchema<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
|
|
|
374
375
|
} | undefined;
|
|
375
376
|
}
|
|
376
377
|
/**
|
|
377
|
-
* Base schema async
|
|
378
|
+
* Base schema async interface.
|
|
378
379
|
*/
|
|
379
380
|
interface BaseSchemaAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>> extends Omit<BaseSchema<TInput, TOutput, TIssue>, 'reference' | 'async' | '~run'> {
|
|
380
381
|
/**
|
|
@@ -399,7 +400,7 @@ interface BaseSchemaAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>> ex
|
|
|
399
400
|
}
|
|
400
401
|
|
|
401
402
|
/**
|
|
402
|
-
* Base transformation
|
|
403
|
+
* Base transformation interface.
|
|
403
404
|
*/
|
|
404
405
|
interface BaseTransformation<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
|
|
405
406
|
/**
|
|
@@ -441,7 +442,7 @@ interface BaseTransformation<TInput, TOutput, TIssue extends BaseIssue<unknown>>
|
|
|
441
442
|
} | undefined;
|
|
442
443
|
}
|
|
443
444
|
/**
|
|
444
|
-
* Base transformation async
|
|
445
|
+
* Base transformation async interface.
|
|
445
446
|
*/
|
|
446
447
|
interface BaseTransformationAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>> extends Omit<BaseTransformation<TInput, TOutput, TIssue>, 'reference' | 'async' | '~run'> {
|
|
447
448
|
/**
|
|
@@ -466,7 +467,7 @@ interface BaseTransformationAsync<TInput, TOutput, TIssue extends BaseIssue<unkn
|
|
|
466
467
|
}
|
|
467
468
|
|
|
468
469
|
/**
|
|
469
|
-
* Base validation
|
|
470
|
+
* Base validation interface.
|
|
470
471
|
*/
|
|
471
472
|
interface BaseValidation<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
|
|
472
473
|
/**
|
|
@@ -512,7 +513,7 @@ interface BaseValidation<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
|
|
|
512
513
|
} | undefined;
|
|
513
514
|
}
|
|
514
515
|
/**
|
|
515
|
-
* Base validation async
|
|
516
|
+
* Base validation async interface.
|
|
516
517
|
*/
|
|
517
518
|
interface BaseValidationAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>> extends Omit<BaseValidation<TInput, TOutput, TIssue>, 'reference' | 'async' | '~run'> {
|
|
518
519
|
/**
|
|
@@ -619,13 +620,13 @@ type SchemaWithoutPipe<TSchema extends BaseSchema<unknown, unknown, BaseIssue<un
|
|
|
619
620
|
};
|
|
620
621
|
|
|
621
622
|
/**
|
|
622
|
-
* Object entries
|
|
623
|
+
* Object entries interface.
|
|
623
624
|
*/
|
|
624
625
|
interface ObjectEntries {
|
|
625
626
|
[key: string]: BaseSchema<unknown, unknown, BaseIssue<unknown>>;
|
|
626
627
|
}
|
|
627
628
|
/**
|
|
628
|
-
* Object entries async
|
|
629
|
+
* Object entries async interface.
|
|
629
630
|
*/
|
|
630
631
|
interface ObjectEntriesAsync {
|
|
631
632
|
[key: string]: BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>;
|
|
@@ -702,7 +703,7 @@ type InferObjectOutput<TEntries extends ObjectEntries | ObjectEntriesAsync> = Pr
|
|
|
702
703
|
type InferObjectIssue<TEntries extends ObjectEntries | ObjectEntriesAsync> = InferIssue<TEntries[keyof TEntries]>;
|
|
703
704
|
|
|
704
705
|
/**
|
|
705
|
-
* Array path item
|
|
706
|
+
* Array path item interface.
|
|
706
707
|
*/
|
|
707
708
|
interface ArrayPathItem {
|
|
708
709
|
/**
|
|
@@ -727,7 +728,7 @@ interface ArrayPathItem {
|
|
|
727
728
|
readonly value: unknown;
|
|
728
729
|
}
|
|
729
730
|
/**
|
|
730
|
-
* Map path item
|
|
731
|
+
* Map path item interface.
|
|
731
732
|
*/
|
|
732
733
|
interface MapPathItem {
|
|
733
734
|
/**
|
|
@@ -752,7 +753,7 @@ interface MapPathItem {
|
|
|
752
753
|
readonly value: unknown;
|
|
753
754
|
}
|
|
754
755
|
/**
|
|
755
|
-
* Object path item
|
|
756
|
+
* Object path item interface.
|
|
756
757
|
*/
|
|
757
758
|
interface ObjectPathItem {
|
|
758
759
|
/**
|
|
@@ -777,7 +778,7 @@ interface ObjectPathItem {
|
|
|
777
778
|
readonly value: unknown;
|
|
778
779
|
}
|
|
779
780
|
/**
|
|
780
|
-
* Set path item
|
|
781
|
+
* Set path item interface.
|
|
781
782
|
*/
|
|
782
783
|
interface SetPathItem {
|
|
783
784
|
/**
|
|
@@ -802,7 +803,7 @@ interface SetPathItem {
|
|
|
802
803
|
readonly value: unknown;
|
|
803
804
|
}
|
|
804
805
|
/**
|
|
805
|
-
* Unknown path item
|
|
806
|
+
* Unknown path item interface.
|
|
806
807
|
*/
|
|
807
808
|
interface UnknownPathItem {
|
|
808
809
|
/**
|
|
@@ -831,7 +832,7 @@ interface UnknownPathItem {
|
|
|
831
832
|
*/
|
|
832
833
|
type IssuePathItem = ArrayPathItem | MapPathItem | ObjectPathItem | SetPathItem | UnknownPathItem;
|
|
833
834
|
/**
|
|
834
|
-
* Base issue
|
|
835
|
+
* Base issue interface.
|
|
835
836
|
*/
|
|
836
837
|
interface BaseIssue<TInput> extends Config<BaseIssue<TInput>> {
|
|
837
838
|
/**
|
|
@@ -873,7 +874,7 @@ interface BaseIssue<TInput> extends Config<BaseIssue<TInput>> {
|
|
|
873
874
|
}
|
|
874
875
|
|
|
875
876
|
/**
|
|
876
|
-
* Config
|
|
877
|
+
* Config interface.
|
|
877
878
|
*/
|
|
878
879
|
interface Config<TIssue extends BaseIssue<unknown>> {
|
|
879
880
|
/**
|
|
@@ -895,7 +896,7 @@ interface Config<TIssue extends BaseIssue<unknown>> {
|
|
|
895
896
|
}
|
|
896
897
|
|
|
897
898
|
/**
|
|
898
|
-
* Array issue
|
|
899
|
+
* Array issue interface.
|
|
899
900
|
*/
|
|
900
901
|
interface ArrayIssue extends BaseIssue<unknown> {
|
|
901
902
|
/**
|
|
@@ -913,7 +914,7 @@ interface ArrayIssue extends BaseIssue<unknown> {
|
|
|
913
914
|
}
|
|
914
915
|
|
|
915
916
|
/**
|
|
916
|
-
* Array schema
|
|
917
|
+
* Array schema interface.
|
|
917
918
|
*/
|
|
918
919
|
interface ArraySchema<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TMessage extends ErrorMessage<ArrayIssue> | undefined> extends BaseSchema<InferInput<TItem>[], InferOutput<TItem>[], ArrayIssue | InferIssue<TItem>> {
|
|
919
920
|
/**
|
|
@@ -956,7 +957,7 @@ declare function array<const TItem extends BaseSchema<unknown, unknown, BaseIssu
|
|
|
956
957
|
declare function array<const TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TMessage extends ErrorMessage<ArrayIssue> | undefined>(item: TItem, message: TMessage): ArraySchema<TItem, TMessage>;
|
|
957
958
|
|
|
958
959
|
/**
|
|
959
|
-
* Boolean issue
|
|
960
|
+
* Boolean issue interface.
|
|
960
961
|
*/
|
|
961
962
|
interface BooleanIssue extends BaseIssue<unknown> {
|
|
962
963
|
/**
|
|
@@ -973,7 +974,7 @@ interface BooleanIssue extends BaseIssue<unknown> {
|
|
|
973
974
|
readonly expected: 'boolean';
|
|
974
975
|
}
|
|
975
976
|
/**
|
|
976
|
-
* Boolean schema
|
|
977
|
+
* Boolean schema interface.
|
|
977
978
|
*/
|
|
978
979
|
interface BooleanSchema<TMessage extends ErrorMessage<BooleanIssue> | undefined> extends BaseSchema<boolean, boolean, BooleanIssue> {
|
|
979
980
|
/**
|
|
@@ -1008,73 +1009,13 @@ declare function boolean(): BooleanSchema<undefined>;
|
|
|
1008
1009
|
*/
|
|
1009
1010
|
declare function boolean<const TMessage extends ErrorMessage<BooleanIssue> | undefined>(message: TMessage): BooleanSchema<TMessage>;
|
|
1010
1011
|
|
|
1011
|
-
/**
|
|
1012
|
-
* Class type.
|
|
1013
|
-
*/
|
|
1014
|
-
type Class = new (...args: any[]) => any;
|
|
1015
|
-
/**
|
|
1016
|
-
* Instance issue type.
|
|
1017
|
-
*/
|
|
1018
|
-
interface InstanceIssue extends BaseIssue<unknown> {
|
|
1019
|
-
/**
|
|
1020
|
-
* The issue kind.
|
|
1021
|
-
*/
|
|
1022
|
-
readonly kind: 'schema';
|
|
1023
|
-
/**
|
|
1024
|
-
* The issue type.
|
|
1025
|
-
*/
|
|
1026
|
-
readonly type: 'instance';
|
|
1027
|
-
/**
|
|
1028
|
-
* The expected property.
|
|
1029
|
-
*/
|
|
1030
|
-
readonly expected: string;
|
|
1031
|
-
}
|
|
1032
|
-
/**
|
|
1033
|
-
* Instance schema type.
|
|
1034
|
-
*/
|
|
1035
|
-
interface InstanceSchema<TClass extends Class, TMessage extends ErrorMessage<InstanceIssue> | undefined> extends BaseSchema<InstanceType<TClass>, InstanceType<TClass>, InstanceIssue> {
|
|
1036
|
-
/**
|
|
1037
|
-
* The schema type.
|
|
1038
|
-
*/
|
|
1039
|
-
readonly type: 'instance';
|
|
1040
|
-
/**
|
|
1041
|
-
* The schema reference.
|
|
1042
|
-
*/
|
|
1043
|
-
readonly reference: typeof instance;
|
|
1044
|
-
/**
|
|
1045
|
-
* The class of the instance.
|
|
1046
|
-
*/
|
|
1047
|
-
readonly class: TClass;
|
|
1048
|
-
/**
|
|
1049
|
-
* The error message.
|
|
1050
|
-
*/
|
|
1051
|
-
readonly message: TMessage;
|
|
1052
|
-
}
|
|
1053
|
-
/**
|
|
1054
|
-
* Creates an instance schema.
|
|
1055
|
-
*
|
|
1056
|
-
* @param class_ The class of the instance.
|
|
1057
|
-
*
|
|
1058
|
-
* @returns An instance schema.
|
|
1059
|
-
*/
|
|
1060
|
-
declare function instance<TClass extends Class>(class_: TClass): InstanceSchema<TClass, undefined>;
|
|
1061
|
-
/**
|
|
1062
|
-
* Creates an instance schema.
|
|
1063
|
-
*
|
|
1064
|
-
* @param class_ The class of the instance.
|
|
1065
|
-
* @param message The error message.
|
|
1066
|
-
*
|
|
1067
|
-
* @returns An instance schema.
|
|
1068
|
-
*/
|
|
1069
|
-
declare function instance<TClass extends Class, const TMessage extends ErrorMessage<InstanceIssue> | undefined>(class_: TClass, message: TMessage): InstanceSchema<TClass, TMessage>;
|
|
1070
|
-
|
|
1071
1012
|
/**
|
|
1072
1013
|
* Infer nullish output type.
|
|
1073
1014
|
*/
|
|
1074
1015
|
type InferNullishOutput<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped, null | undefined>> = undefined extends TDefault ? InferOutput<TWrapped> | null | undefined : InferOutput<TWrapped> | Extract<DefaultValue<TDefault>, null | undefined>;
|
|
1075
1016
|
|
|
1076
1017
|
/**
|
|
1077
|
-
* Nullish schema
|
|
1018
|
+
* Nullish schema interface.
|
|
1078
1019
|
*/
|
|
1079
1020
|
interface NullishSchema<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TDefault extends Default<TWrapped, null | undefined>> extends BaseSchema<InferInput<TWrapped> | null | undefined, InferNullishOutput<TWrapped, TDefault>, InferIssue<TWrapped>> {
|
|
1080
1021
|
/**
|
|
@@ -1117,7 +1058,7 @@ declare function nullish<const TWrapped extends BaseSchema<unknown, unknown, Bas
|
|
|
1117
1058
|
declare function nullish<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TDefault extends Default<TWrapped, null | undefined>>(wrapped: TWrapped, default_: TDefault): NullishSchema<TWrapped, TDefault>;
|
|
1118
1059
|
|
|
1119
1060
|
/**
|
|
1120
|
-
* Nullish schema async
|
|
1061
|
+
* Nullish schema async interface.
|
|
1121
1062
|
*/
|
|
1122
1063
|
interface NullishSchemaAsync<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped, null | undefined>> extends BaseSchemaAsync<InferInput<TWrapped> | null | undefined, InferNullishOutput<TWrapped, TDefault>, InferIssue<TWrapped>> {
|
|
1123
1064
|
/**
|
|
@@ -1160,7 +1101,7 @@ declare function nullishAsync<const TWrapped extends BaseSchema<unknown, unknown
|
|
|
1160
1101
|
declare function nullishAsync<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, const TDefault extends DefaultAsync<TWrapped, null | undefined>>(wrapped: TWrapped, default_: TDefault): NullishSchemaAsync<TWrapped, TDefault>;
|
|
1161
1102
|
|
|
1162
1103
|
/**
|
|
1163
|
-
* Object issue
|
|
1104
|
+
* Object issue interface.
|
|
1164
1105
|
*/
|
|
1165
1106
|
interface ObjectIssue extends BaseIssue<unknown> {
|
|
1166
1107
|
/**
|
|
@@ -1178,7 +1119,7 @@ interface ObjectIssue extends BaseIssue<unknown> {
|
|
|
1178
1119
|
}
|
|
1179
1120
|
|
|
1180
1121
|
/**
|
|
1181
|
-
* Object schema
|
|
1122
|
+
* Object schema interface.
|
|
1182
1123
|
*/
|
|
1183
1124
|
interface ObjectSchema<TEntries extends ObjectEntries, TMessage extends ErrorMessage<ObjectIssue> | undefined> extends BaseSchema<InferObjectInput<TEntries>, InferObjectOutput<TEntries>, ObjectIssue | InferObjectIssue<TEntries>> {
|
|
1184
1125
|
/**
|
|
@@ -1236,7 +1177,7 @@ declare function object<const TEntries extends ObjectEntries, const TMessage ext
|
|
|
1236
1177
|
type InferOptionalOutput<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped, undefined>> = undefined extends TDefault ? InferOutput<TWrapped> | undefined : InferOutput<TWrapped> | Extract<DefaultValue<TDefault>, undefined>;
|
|
1237
1178
|
|
|
1238
1179
|
/**
|
|
1239
|
-
* Optional schema
|
|
1180
|
+
* Optional schema interface.
|
|
1240
1181
|
*/
|
|
1241
1182
|
interface OptionalSchema<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TDefault extends Default<TWrapped, undefined>> extends BaseSchema<InferInput<TWrapped> | undefined, InferOptionalOutput<TWrapped, TDefault>, InferIssue<TWrapped>> {
|
|
1242
1183
|
/**
|
|
@@ -1279,7 +1220,7 @@ declare function optional<const TWrapped extends BaseSchema<unknown, unknown, Ba
|
|
|
1279
1220
|
declare function optional<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TDefault extends Default<TWrapped, undefined>>(wrapped: TWrapped, default_: TDefault): OptionalSchema<TWrapped, TDefault>;
|
|
1280
1221
|
|
|
1281
1222
|
/**
|
|
1282
|
-
* Optional schema async
|
|
1223
|
+
* Optional schema async interface.
|
|
1283
1224
|
*/
|
|
1284
1225
|
interface OptionalSchemaAsync<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped, undefined>> extends BaseSchemaAsync<InferInput<TWrapped> | undefined, InferOptionalOutput<TWrapped, TDefault>, InferIssue<TWrapped>> {
|
|
1285
1226
|
/**
|
|
@@ -1322,7 +1263,7 @@ declare function optionalAsync<const TWrapped extends BaseSchema<unknown, unknow
|
|
|
1322
1263
|
declare function optionalAsync<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, const TDefault extends DefaultAsync<TWrapped, undefined>>(wrapped: TWrapped, default_: TDefault): OptionalSchemaAsync<TWrapped, TDefault>;
|
|
1323
1264
|
|
|
1324
1265
|
/**
|
|
1325
|
-
* String issue
|
|
1266
|
+
* String issue interface.
|
|
1326
1267
|
*/
|
|
1327
1268
|
interface StringIssue extends BaseIssue<unknown> {
|
|
1328
1269
|
/**
|
|
@@ -1339,7 +1280,7 @@ interface StringIssue extends BaseIssue<unknown> {
|
|
|
1339
1280
|
readonly expected: 'string';
|
|
1340
1281
|
}
|
|
1341
1282
|
/**
|
|
1342
|
-
* String schema
|
|
1283
|
+
* String schema interface.
|
|
1343
1284
|
*/
|
|
1344
1285
|
interface StringSchema<TMessage extends ErrorMessage<StringIssue> | undefined> extends BaseSchema<string, string, StringIssue> {
|
|
1345
1286
|
/**
|
|
@@ -1375,7 +1316,7 @@ declare function string(): StringSchema<undefined>;
|
|
|
1375
1316
|
declare function string<const TMessage extends ErrorMessage<StringIssue> | undefined>(message: TMessage): StringSchema<TMessage>;
|
|
1376
1317
|
|
|
1377
1318
|
/**
|
|
1378
|
-
* Readonly action
|
|
1319
|
+
* Readonly action interface.
|
|
1379
1320
|
*/
|
|
1380
1321
|
interface ReadonlyAction<TInput> extends BaseTransformation<TInput, Readonly<TInput>, never> {
|
|
1381
1322
|
/**
|
|
@@ -1394,37 +1335,30 @@ interface ReadonlyAction<TInput> extends BaseTransformation<TInput, Readonly<TIn
|
|
|
1394
1335
|
*/
|
|
1395
1336
|
declare function readonly<TInput>(): ReadonlyAction<TInput>;
|
|
1396
1337
|
|
|
1397
|
-
/**
|
|
1398
|
-
* @internal
|
|
1399
|
-
* @description
|
|
1400
|
-
* This allows the rule to know some key information before checking for user-defined hooks.
|
|
1401
|
-
* For example, the position of the `deps` argument for the user-defined `useCustomEffect` hook that represents the built-in `useEffect` hook.
|
|
1402
|
-
*/
|
|
1403
|
-
declare const CustomHookSchema: ObjectSchema<{}, undefined>;
|
|
1404
1338
|
/**
|
|
1405
1339
|
* @internal
|
|
1406
1340
|
*/
|
|
1407
|
-
declare const
|
|
1341
|
+
declare const CustomComponentPropSchema: ObjectSchema<{
|
|
1408
1342
|
/**
|
|
1409
|
-
* The name of the
|
|
1343
|
+
* The name of the prop in the user-defined component.
|
|
1410
1344
|
* @example
|
|
1411
1345
|
* "to"
|
|
1412
1346
|
*/
|
|
1413
1347
|
readonly name: StringSchema<undefined>;
|
|
1414
1348
|
/**
|
|
1415
|
-
* The name of the
|
|
1349
|
+
* The name of the prop in the built-in component.
|
|
1416
1350
|
* @example
|
|
1417
1351
|
* "href"
|
|
1418
1352
|
*/
|
|
1419
1353
|
readonly as: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
1420
1354
|
/**
|
|
1421
|
-
* Whether the
|
|
1355
|
+
* Whether the prop is controlled or not in the user-defined component.
|
|
1422
1356
|
* @example
|
|
1423
1357
|
* `true`
|
|
1424
1358
|
*/
|
|
1425
1359
|
readonly controlled: OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
1426
1360
|
/**
|
|
1427
|
-
* The default value of the
|
|
1361
|
+
* The default value of the prop in the user-defined component.
|
|
1428
1362
|
* @example
|
|
1429
1363
|
* `"/"`
|
|
1430
1364
|
*/
|
|
@@ -1435,8 +1369,7 @@ declare const CustomAttributeSchema: ObjectSchema<{
|
|
|
1435
1369
|
* @description
|
|
1436
1370
|
* This will provide some key information to the rule before checking for user-defined components.
|
|
1437
1371
|
* For example:
|
|
1438
|
-
* Which
|
|
1439
|
-
* Which attributes are used as `children` props for a user-defined `Button` component to receive children of that component.
|
|
1372
|
+
* Which prop is used as the `href` prop for the user-defined `Link` component that represents the built-in `a` element.
|
|
1440
1373
|
*/
|
|
1441
1374
|
declare const CustomComponentSchema: ObjectSchema<{
|
|
1442
1375
|
/**
|
|
@@ -1447,6 +1380,7 @@ declare const CustomComponentSchema: ObjectSchema<{
|
|
|
1447
1380
|
readonly name: StringSchema<undefined>;
|
|
1448
1381
|
/**
|
|
1449
1382
|
* The ESQuery selector to select the component precisely.
|
|
1383
|
+
* @internal
|
|
1450
1384
|
* @example
|
|
1451
1385
|
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
1452
1386
|
*/
|
|
@@ -1458,68 +1392,57 @@ declare const CustomComponentSchema: ObjectSchema<{
|
|
|
1458
1392
|
*/
|
|
1459
1393
|
readonly as: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
1460
1394
|
/**
|
|
1461
|
-
*
|
|
1395
|
+
* Attributes mapping between the user-defined component and the built-in component.
|
|
1462
1396
|
* @example
|
|
1463
1397
|
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
1464
1398
|
*/
|
|
1465
1399
|
readonly attributes: OptionalSchema<ArraySchema<ObjectSchema<{
|
|
1466
1400
|
/**
|
|
1467
|
-
* The name of the
|
|
1401
|
+
* The name of the prop in the user-defined component.
|
|
1468
1402
|
* @example
|
|
1469
1403
|
* "to"
|
|
1470
1404
|
*/
|
|
1471
1405
|
readonly name: StringSchema<undefined>;
|
|
1472
1406
|
/**
|
|
1473
|
-
* The name of the
|
|
1407
|
+
* The name of the prop in the built-in component.
|
|
1474
1408
|
* @example
|
|
1475
1409
|
* "href"
|
|
1476
1410
|
*/
|
|
1477
1411
|
readonly as: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
1478
1412
|
/**
|
|
1479
|
-
* Whether the
|
|
1413
|
+
* Whether the prop is controlled or not in the user-defined component.
|
|
1480
1414
|
* @example
|
|
1481
1415
|
* `true`
|
|
1482
1416
|
*/
|
|
1483
1417
|
readonly controlled: OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
1484
1418
|
/**
|
|
1485
|
-
* The default value of the
|
|
1419
|
+
* The default value of the prop in the user-defined component.
|
|
1486
1420
|
* @example
|
|
1487
1421
|
* `"/"`
|
|
1488
1422
|
*/
|
|
1489
1423
|
readonly defaultValue: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
1490
1424
|
}, undefined>, undefined>, undefined>;
|
|
1491
1425
|
}, undefined>;
|
|
1492
|
-
declare const
|
|
1493
|
-
readonly
|
|
1494
|
-
readonly
|
|
1495
|
-
readonly
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
*/
|
|
1513
|
-
readonly controlled: OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
1514
|
-
/**
|
|
1515
|
-
* The default value of the attribute in the user-defined component.
|
|
1516
|
-
* @example
|
|
1517
|
-
* `"/"`
|
|
1518
|
-
*/
|
|
1519
|
-
readonly defaultValue: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
1520
|
-
}, undefined>, undefined>, readonly []>;
|
|
1521
|
-
readonly re: InstanceSchema<RegExpConstructor, undefined>;
|
|
1522
|
-
readonly selector: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
1426
|
+
declare const CustomHooksSchema: ObjectSchema<{
|
|
1427
|
+
readonly use: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1428
|
+
readonly useActionState: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1429
|
+
readonly useCallback: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1430
|
+
readonly useContext: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1431
|
+
readonly useDebugValue: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1432
|
+
readonly useDeferredValue: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1433
|
+
readonly useEffect: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1434
|
+
readonly useFormStatus: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1435
|
+
readonly useId: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1436
|
+
readonly useImperativeHandle: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1437
|
+
readonly useInsertionEffect: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1438
|
+
readonly useLayoutEffect: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1439
|
+
readonly useMemo: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1440
|
+
readonly useOptimistic: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1441
|
+
readonly useReducer: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1442
|
+
readonly useRef: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1443
|
+
readonly useState: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1444
|
+
readonly useSyncExternalStore: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1445
|
+
readonly useTransition: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
1523
1446
|
}, undefined>;
|
|
1524
1447
|
/**
|
|
1525
1448
|
* @internal
|
|
@@ -1531,41 +1454,41 @@ declare const ESLintReactSettingsSchema: ObjectSchema<{
|
|
|
1531
1454
|
* @default `"react"`
|
|
1532
1455
|
* @example `"@pika/react"`
|
|
1533
1456
|
*/
|
|
1534
|
-
readonly importSource: OptionalSchema<StringSchema<undefined>,
|
|
1457
|
+
readonly importSource: OptionalSchema<StringSchema<undefined>, "react">;
|
|
1535
1458
|
/**
|
|
1536
1459
|
* The identifier that’s used for JSX Element creation.
|
|
1537
1460
|
* @default `"createElement"`
|
|
1538
1461
|
* @deprecated
|
|
1539
1462
|
*/
|
|
1540
|
-
readonly jsxPragma: OptionalSchema<StringSchema<undefined>,
|
|
1463
|
+
readonly jsxPragma: OptionalSchema<StringSchema<undefined>, "createElement">;
|
|
1541
1464
|
/**
|
|
1542
1465
|
* The identifier that’s used for JSX fragment elements.
|
|
1543
1466
|
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
1544
1467
|
* @default `"Fragment"`
|
|
1545
1468
|
* @deprecated
|
|
1546
1469
|
*/
|
|
1547
|
-
readonly jsxPragmaFrag: OptionalSchema<StringSchema<undefined>,
|
|
1470
|
+
readonly jsxPragmaFrag: OptionalSchema<StringSchema<undefined>, "Fragment">;
|
|
1548
1471
|
/**
|
|
1549
1472
|
* The name of the prop that is used for polymorphic components.
|
|
1550
1473
|
* @description This is used to determine the type of the component.
|
|
1551
1474
|
* @example `"as"`
|
|
1552
1475
|
*/
|
|
1553
|
-
readonly polymorphicPropName: OptionalSchema<StringSchema<undefined>,
|
|
1476
|
+
readonly polymorphicPropName: OptionalSchema<StringSchema<undefined>, "as">;
|
|
1554
1477
|
/**
|
|
1555
1478
|
* @internal
|
|
1556
1479
|
*/
|
|
1557
|
-
readonly strict: OptionalSchema<BooleanSchema<undefined>,
|
|
1480
|
+
readonly strict: OptionalSchema<BooleanSchema<undefined>, false>;
|
|
1558
1481
|
/**
|
|
1559
1482
|
* @internal
|
|
1560
1483
|
*/
|
|
1561
|
-
readonly strictImportCheck: OptionalSchema<BooleanSchema<undefined>,
|
|
1484
|
+
readonly strictImportCheck: OptionalSchema<BooleanSchema<undefined>, false>;
|
|
1562
1485
|
/**
|
|
1563
1486
|
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
1564
1487
|
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
1565
1488
|
* @example `"18.3.1"`
|
|
1566
1489
|
* @default `"detect"`
|
|
1567
1490
|
*/
|
|
1568
|
-
readonly version: OptionalSchema<StringSchema<undefined>,
|
|
1491
|
+
readonly version: OptionalSchema<StringSchema<undefined>, "detect">;
|
|
1569
1492
|
/**
|
|
1570
1493
|
* An array of user-defined components
|
|
1571
1494
|
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
@@ -1580,6 +1503,7 @@ declare const ESLintReactSettingsSchema: ObjectSchema<{
|
|
|
1580
1503
|
readonly name: StringSchema<undefined>;
|
|
1581
1504
|
/**
|
|
1582
1505
|
* The ESQuery selector to select the component precisely.
|
|
1506
|
+
* @internal
|
|
1583
1507
|
* @example
|
|
1584
1508
|
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
1585
1509
|
*/
|
|
@@ -1591,31 +1515,31 @@ declare const ESLintReactSettingsSchema: ObjectSchema<{
|
|
|
1591
1515
|
*/
|
|
1592
1516
|
readonly as: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
1593
1517
|
/**
|
|
1594
|
-
*
|
|
1518
|
+
* Attributes mapping between the user-defined component and the built-in component.
|
|
1595
1519
|
* @example
|
|
1596
1520
|
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
1597
1521
|
*/
|
|
1598
1522
|
readonly attributes: OptionalSchema<ArraySchema<ObjectSchema<{
|
|
1599
1523
|
/**
|
|
1600
|
-
* The name of the
|
|
1524
|
+
* The name of the prop in the user-defined component.
|
|
1601
1525
|
* @example
|
|
1602
1526
|
* "to"
|
|
1603
1527
|
*/
|
|
1604
1528
|
readonly name: StringSchema<undefined>;
|
|
1605
1529
|
/**
|
|
1606
|
-
* The name of the
|
|
1530
|
+
* The name of the prop in the built-in component.
|
|
1607
1531
|
* @example
|
|
1608
1532
|
* "href"
|
|
1609
1533
|
*/
|
|
1610
1534
|
readonly as: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
1611
1535
|
/**
|
|
1612
|
-
* Whether the
|
|
1536
|
+
* Whether the prop is controlled or not in the user-defined component.
|
|
1613
1537
|
* @example
|
|
1614
1538
|
* `true`
|
|
1615
1539
|
*/
|
|
1616
1540
|
readonly controlled: OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
1617
1541
|
/**
|
|
1618
|
-
* The default value of the
|
|
1542
|
+
* The default value of the prop in the user-defined component.
|
|
1619
1543
|
* @example
|
|
1620
1544
|
* `"/"`
|
|
1621
1545
|
*/
|
|
@@ -1623,7 +1547,7 @@ declare const ESLintReactSettingsSchema: ObjectSchema<{
|
|
|
1623
1547
|
}, undefined>, undefined>, undefined>;
|
|
1624
1548
|
}, undefined>, undefined>, undefined>;
|
|
1625
1549
|
/**
|
|
1626
|
-
* A object
|
|
1550
|
+
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
1627
1551
|
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
1628
1552
|
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
1629
1553
|
*/
|
|
@@ -1660,41 +1584,41 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1660
1584
|
* @default `"react"`
|
|
1661
1585
|
* @example `"@pika/react"`
|
|
1662
1586
|
*/
|
|
1663
|
-
readonly importSource: OptionalSchema<StringSchema<undefined>,
|
|
1587
|
+
readonly importSource: OptionalSchema<StringSchema<undefined>, "react">;
|
|
1664
1588
|
/**
|
|
1665
1589
|
* The identifier that’s used for JSX Element creation.
|
|
1666
1590
|
* @default `"createElement"`
|
|
1667
1591
|
* @deprecated
|
|
1668
1592
|
*/
|
|
1669
|
-
readonly jsxPragma: OptionalSchema<StringSchema<undefined>,
|
|
1593
|
+
readonly jsxPragma: OptionalSchema<StringSchema<undefined>, "createElement">;
|
|
1670
1594
|
/**
|
|
1671
1595
|
* The identifier that’s used for JSX fragment elements.
|
|
1672
1596
|
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
1673
1597
|
* @default `"Fragment"`
|
|
1674
1598
|
* @deprecated
|
|
1675
1599
|
*/
|
|
1676
|
-
readonly jsxPragmaFrag: OptionalSchema<StringSchema<undefined>,
|
|
1600
|
+
readonly jsxPragmaFrag: OptionalSchema<StringSchema<undefined>, "Fragment">;
|
|
1677
1601
|
/**
|
|
1678
1602
|
* The name of the prop that is used for polymorphic components.
|
|
1679
1603
|
* @description This is used to determine the type of the component.
|
|
1680
1604
|
* @example `"as"`
|
|
1681
1605
|
*/
|
|
1682
|
-
readonly polymorphicPropName: OptionalSchema<StringSchema<undefined>,
|
|
1606
|
+
readonly polymorphicPropName: OptionalSchema<StringSchema<undefined>, "as">;
|
|
1683
1607
|
/**
|
|
1684
1608
|
* @internal
|
|
1685
1609
|
*/
|
|
1686
|
-
readonly strict: OptionalSchema<BooleanSchema<undefined>,
|
|
1610
|
+
readonly strict: OptionalSchema<BooleanSchema<undefined>, false>;
|
|
1687
1611
|
/**
|
|
1688
1612
|
* @internal
|
|
1689
1613
|
*/
|
|
1690
|
-
readonly strictImportCheck: OptionalSchema<BooleanSchema<undefined>,
|
|
1614
|
+
readonly strictImportCheck: OptionalSchema<BooleanSchema<undefined>, false>;
|
|
1691
1615
|
/**
|
|
1692
1616
|
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
1693
1617
|
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
1694
1618
|
* @example `"18.3.1"`
|
|
1695
1619
|
* @default `"detect"`
|
|
1696
1620
|
*/
|
|
1697
|
-
readonly version: OptionalSchema<StringSchema<undefined>,
|
|
1621
|
+
readonly version: OptionalSchema<StringSchema<undefined>, "detect">;
|
|
1698
1622
|
/**
|
|
1699
1623
|
* An array of user-defined components
|
|
1700
1624
|
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
@@ -1709,6 +1633,7 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1709
1633
|
readonly name: StringSchema<undefined>;
|
|
1710
1634
|
/**
|
|
1711
1635
|
* The ESQuery selector to select the component precisely.
|
|
1636
|
+
* @internal
|
|
1712
1637
|
* @example
|
|
1713
1638
|
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
1714
1639
|
*/
|
|
@@ -1720,31 +1645,31 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1720
1645
|
*/
|
|
1721
1646
|
readonly as: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
1722
1647
|
/**
|
|
1723
|
-
*
|
|
1648
|
+
* Attributes mapping between the user-defined component and the built-in component.
|
|
1724
1649
|
* @example
|
|
1725
1650
|
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
1726
1651
|
*/
|
|
1727
1652
|
readonly attributes: OptionalSchema<ArraySchema<ObjectSchema<{
|
|
1728
1653
|
/**
|
|
1729
|
-
* The name of the
|
|
1654
|
+
* The name of the prop in the user-defined component.
|
|
1730
1655
|
* @example
|
|
1731
1656
|
* "to"
|
|
1732
1657
|
*/
|
|
1733
1658
|
readonly name: StringSchema<undefined>;
|
|
1734
1659
|
/**
|
|
1735
|
-
* The name of the
|
|
1660
|
+
* The name of the prop in the built-in component.
|
|
1736
1661
|
* @example
|
|
1737
1662
|
* "href"
|
|
1738
1663
|
*/
|
|
1739
1664
|
readonly as: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
1740
1665
|
/**
|
|
1741
|
-
* Whether the
|
|
1666
|
+
* Whether the prop is controlled or not in the user-defined component.
|
|
1742
1667
|
* @example
|
|
1743
1668
|
* `true`
|
|
1744
1669
|
*/
|
|
1745
1670
|
readonly controlled: OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
1746
1671
|
/**
|
|
1747
|
-
* The default value of the
|
|
1672
|
+
* The default value of the prop in the user-defined component.
|
|
1748
1673
|
* @example
|
|
1749
1674
|
* `"/"`
|
|
1750
1675
|
*/
|
|
@@ -1752,7 +1677,7 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1752
1677
|
}, undefined>, undefined>, undefined>;
|
|
1753
1678
|
}, undefined>, undefined>, undefined>;
|
|
1754
1679
|
/**
|
|
1755
|
-
* A object
|
|
1680
|
+
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
1756
1681
|
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
1757
1682
|
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
1758
1683
|
*/
|
|
@@ -1786,41 +1711,41 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1786
1711
|
* @default `"react"`
|
|
1787
1712
|
* @example `"@pika/react"`
|
|
1788
1713
|
*/
|
|
1789
|
-
readonly importSource: OptionalSchema<StringSchema<undefined>,
|
|
1714
|
+
readonly importSource: OptionalSchema<StringSchema<undefined>, "react">;
|
|
1790
1715
|
/**
|
|
1791
1716
|
* The identifier that’s used for JSX Element creation.
|
|
1792
1717
|
* @default `"createElement"`
|
|
1793
1718
|
* @deprecated
|
|
1794
1719
|
*/
|
|
1795
|
-
readonly jsxPragma: OptionalSchema<StringSchema<undefined>,
|
|
1720
|
+
readonly jsxPragma: OptionalSchema<StringSchema<undefined>, "createElement">;
|
|
1796
1721
|
/**
|
|
1797
1722
|
* The identifier that’s used for JSX fragment elements.
|
|
1798
1723
|
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
1799
1724
|
* @default `"Fragment"`
|
|
1800
1725
|
* @deprecated
|
|
1801
1726
|
*/
|
|
1802
|
-
readonly jsxPragmaFrag: OptionalSchema<StringSchema<undefined>,
|
|
1727
|
+
readonly jsxPragmaFrag: OptionalSchema<StringSchema<undefined>, "Fragment">;
|
|
1803
1728
|
/**
|
|
1804
1729
|
* The name of the prop that is used for polymorphic components.
|
|
1805
1730
|
* @description This is used to determine the type of the component.
|
|
1806
1731
|
* @example `"as"`
|
|
1807
1732
|
*/
|
|
1808
|
-
readonly polymorphicPropName: OptionalSchema<StringSchema<undefined>,
|
|
1733
|
+
readonly polymorphicPropName: OptionalSchema<StringSchema<undefined>, "as">;
|
|
1809
1734
|
/**
|
|
1810
1735
|
* @internal
|
|
1811
1736
|
*/
|
|
1812
|
-
readonly strict: OptionalSchema<BooleanSchema<undefined>,
|
|
1737
|
+
readonly strict: OptionalSchema<BooleanSchema<undefined>, false>;
|
|
1813
1738
|
/**
|
|
1814
1739
|
* @internal
|
|
1815
1740
|
*/
|
|
1816
|
-
readonly strictImportCheck: OptionalSchema<BooleanSchema<undefined>,
|
|
1741
|
+
readonly strictImportCheck: OptionalSchema<BooleanSchema<undefined>, false>;
|
|
1817
1742
|
/**
|
|
1818
1743
|
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
1819
1744
|
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
1820
1745
|
* @example `"18.3.1"`
|
|
1821
1746
|
* @default `"detect"`
|
|
1822
1747
|
*/
|
|
1823
|
-
readonly version: OptionalSchema<StringSchema<undefined>,
|
|
1748
|
+
readonly version: OptionalSchema<StringSchema<undefined>, "detect">;
|
|
1824
1749
|
/**
|
|
1825
1750
|
* An array of user-defined components
|
|
1826
1751
|
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
@@ -1835,6 +1760,7 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1835
1760
|
readonly name: StringSchema<undefined>;
|
|
1836
1761
|
/**
|
|
1837
1762
|
* The ESQuery selector to select the component precisely.
|
|
1763
|
+
* @internal
|
|
1838
1764
|
* @example
|
|
1839
1765
|
* `JSXElement:has(JSXAttribute[name.name='component'][value.value='a'])`
|
|
1840
1766
|
*/
|
|
@@ -1846,31 +1772,31 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1846
1772
|
*/
|
|
1847
1773
|
readonly as: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
1848
1774
|
/**
|
|
1849
|
-
*
|
|
1775
|
+
* Attributes mapping between the user-defined component and the built-in component.
|
|
1850
1776
|
* @example
|
|
1851
1777
|
* `Link` component has a `to` attribute that represents the `href` attribute in the built-in `a` element with a default value of `"/"`.
|
|
1852
1778
|
*/
|
|
1853
1779
|
readonly attributes: OptionalSchema<ArraySchema<ObjectSchema<{
|
|
1854
1780
|
/**
|
|
1855
|
-
* The name of the
|
|
1781
|
+
* The name of the prop in the user-defined component.
|
|
1856
1782
|
* @example
|
|
1857
1783
|
* "to"
|
|
1858
1784
|
*/
|
|
1859
1785
|
readonly name: StringSchema<undefined>;
|
|
1860
1786
|
/**
|
|
1861
|
-
* The name of the
|
|
1787
|
+
* The name of the prop in the built-in component.
|
|
1862
1788
|
* @example
|
|
1863
1789
|
* "href"
|
|
1864
1790
|
*/
|
|
1865
1791
|
readonly as: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
1866
1792
|
/**
|
|
1867
|
-
* Whether the
|
|
1793
|
+
* Whether the prop is controlled or not in the user-defined component.
|
|
1868
1794
|
* @example
|
|
1869
1795
|
* `true`
|
|
1870
1796
|
*/
|
|
1871
1797
|
readonly controlled: OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
1872
1798
|
/**
|
|
1873
|
-
* The default value of the
|
|
1799
|
+
* The default value of the prop in the user-defined component.
|
|
1874
1800
|
* @example
|
|
1875
1801
|
* `"/"`
|
|
1876
1802
|
*/
|
|
@@ -1878,7 +1804,7 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1878
1804
|
}, undefined>, undefined>, undefined>;
|
|
1879
1805
|
}, undefined>, undefined>, undefined>;
|
|
1880
1806
|
/**
|
|
1881
|
-
* A object
|
|
1807
|
+
* A object to define additional hooks that are equivalent to the built-in React Hooks.
|
|
1882
1808
|
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
1883
1809
|
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
1884
1810
|
*/
|
|
@@ -1905,20 +1831,37 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1905
1831
|
}, undefined>, undefined>;
|
|
1906
1832
|
}, undefined>, undefined>;
|
|
1907
1833
|
}, undefined>, {}>;
|
|
1908
|
-
type CustomHook = InferOutput<typeof CustomHookSchema>;
|
|
1909
|
-
type CustomAttribute = InferOutput<typeof CustomAttributeSchema>;
|
|
1910
1834
|
type CustomComponent = InferOutput<typeof CustomComponentSchema>;
|
|
1911
|
-
type
|
|
1835
|
+
type CustomComponentProp = InferOutput<typeof CustomComponentPropSchema>;
|
|
1836
|
+
type CustomHooks = InferOutput<typeof CustomHooksSchema>;
|
|
1912
1837
|
type ESLintReactSettings = InferOutput<typeof ESLintReactSettingsSchema>;
|
|
1913
1838
|
type ESLintSettings = InferOutput<typeof ESLintSettingsSchema>;
|
|
1914
1839
|
/**
|
|
1915
|
-
*
|
|
1916
|
-
* @internal
|
|
1840
|
+
* The default ESLint settings for "react-x".
|
|
1917
1841
|
*/
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
}
|
|
1842
|
+
declare const DEFAULT_ESLINT_REACT_SETTINGS: {
|
|
1843
|
+
readonly additionalHooks: {
|
|
1844
|
+
readonly useLayoutEffect: ["useIsomorphicLayoutEffect"];
|
|
1845
|
+
};
|
|
1846
|
+
readonly version: string;
|
|
1847
|
+
readonly importSource: string;
|
|
1848
|
+
readonly jsxPragma: string;
|
|
1849
|
+
readonly jsxPragmaFrag: string;
|
|
1850
|
+
readonly polymorphicPropName: string;
|
|
1851
|
+
readonly strict: boolean;
|
|
1852
|
+
readonly strictImportCheck: boolean;
|
|
1853
|
+
readonly additionalComponents?: {
|
|
1854
|
+
name: string;
|
|
1855
|
+
as?: string;
|
|
1856
|
+
selector?: string;
|
|
1857
|
+
attributes?: {
|
|
1858
|
+
name: string;
|
|
1859
|
+
as?: string;
|
|
1860
|
+
controlled?: boolean;
|
|
1861
|
+
defaultValue?: string;
|
|
1862
|
+
}[];
|
|
1863
|
+
}[];
|
|
1864
|
+
};
|
|
1922
1865
|
|
|
1923
1866
|
interface Dictionary<Type> {
|
|
1924
1867
|
[key: string]: Type;
|
|
@@ -2186,17 +2129,29 @@ type PartialObjectDeep<ObjectType extends object, Options extends PartialDeepOpt
|
|
|
2186
2129
|
[KeyType in keyof ObjectType]?: PartialDeep<ObjectType[KeyType], Options>
|
|
2187
2130
|
};
|
|
2188
2131
|
|
|
2132
|
+
interface CustomComponentNormalized {
|
|
2133
|
+
name: string;
|
|
2134
|
+
as: string;
|
|
2135
|
+
attributes: CustomComponentPropNormalized[];
|
|
2136
|
+
re: RegExp;
|
|
2137
|
+
}
|
|
2138
|
+
interface CustomComponentPropNormalized {
|
|
2139
|
+
name: string;
|
|
2140
|
+
as: string;
|
|
2141
|
+
defaultValue?: string | _;
|
|
2142
|
+
}
|
|
2189
2143
|
/**
|
|
2190
|
-
* The
|
|
2144
|
+
* The normalized version of the `ESLintReactSettings`.
|
|
2145
|
+
* @internal
|
|
2191
2146
|
*/
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
}
|
|
2147
|
+
interface ESLintReactSettingsNormalized {
|
|
2148
|
+
additionalComponents: CustomComponentNormalized[];
|
|
2149
|
+
additionalHooks: CustomHooks;
|
|
2150
|
+
importSource?: string;
|
|
2151
|
+
polymorphicPropName?: string | _;
|
|
2152
|
+
strictImportCheck: boolean;
|
|
2153
|
+
version: string;
|
|
2154
|
+
}
|
|
2200
2155
|
/**
|
|
2201
2156
|
* Unsafely casts settings from a data object from `context.settings`.
|
|
2202
2157
|
* @internal
|
|
@@ -2212,12 +2167,12 @@ declare function unsafeDecodeSettings(data: unknown): PartialDeep<ESLintReactSet
|
|
|
2212
2167
|
*/
|
|
2213
2168
|
declare const decodeSettings: Memoized<(data: unknown) => ESLintReactSettings>;
|
|
2214
2169
|
/**
|
|
2215
|
-
*
|
|
2170
|
+
* The memoized version of `ESLintReactSettings`.
|
|
2216
2171
|
* @param settings The settings.
|
|
2217
2172
|
* @returns The normalized settings.
|
|
2218
2173
|
* @internal
|
|
2219
2174
|
*/
|
|
2220
|
-
declare const
|
|
2175
|
+
declare const toNormalizedSettings: Memoized<({ additionalComponents, additionalHooks, version, ...rest }: ESLintReactSettings) => ESLintReactSettingsNormalized>;
|
|
2221
2176
|
declare function getSettingsFromContext(context: {
|
|
2222
2177
|
settings: unknown;
|
|
2223
2178
|
}): ESLintReactSettingsNormalized;
|
|
@@ -2233,4 +2188,47 @@ declare module "@typescript-eslint/utils/ts-eslint" {
|
|
|
2233
2188
|
}
|
|
2234
2189
|
}
|
|
2235
2190
|
|
|
2236
|
-
|
|
2191
|
+
/**
|
|
2192
|
+
* Rule severity.
|
|
2193
|
+
* @since 0.0.1
|
|
2194
|
+
*/
|
|
2195
|
+
type RuleSeverity = "error" | "off" | "warn";
|
|
2196
|
+
/**
|
|
2197
|
+
* Rule declaration.
|
|
2198
|
+
* @internal
|
|
2199
|
+
* @since 0.0.1
|
|
2200
|
+
*/
|
|
2201
|
+
type RuleDeclaration = [RuleSeverity, Record<string, unknown>?] | RuleSeverity;
|
|
2202
|
+
/**
|
|
2203
|
+
* Rule config preset.
|
|
2204
|
+
* @since 0.0.1
|
|
2205
|
+
*/
|
|
2206
|
+
type RulePreset = Record<string, RuleDeclaration>;
|
|
2207
|
+
/**
|
|
2208
|
+
* Rule creator function.
|
|
2209
|
+
* @since 0.0.1
|
|
2210
|
+
* @internal
|
|
2211
|
+
*/
|
|
2212
|
+
type RuleCreator = Parameters<ReturnType<typeof ESLintUtils.RuleCreator>>[0]["create"];
|
|
2213
|
+
/**
|
|
2214
|
+
* Rule context.
|
|
2215
|
+
* @since 0.0.1
|
|
2216
|
+
*/
|
|
2217
|
+
type RuleContext = Parameters<RuleCreator>[0];
|
|
2218
|
+
/**
|
|
2219
|
+
* Rule options.
|
|
2220
|
+
* @since 0.0.1
|
|
2221
|
+
*/
|
|
2222
|
+
type RuleOptions = Parameters<RuleCreator>[1];
|
|
2223
|
+
/**
|
|
2224
|
+
* Rule namespace.
|
|
2225
|
+
* @since 0.0.1
|
|
2226
|
+
*/
|
|
2227
|
+
type RuleNamespace = "x" | "dom" | "web-api" | "hooks-extra" | "naming-convention" | "debug";
|
|
2228
|
+
/**
|
|
2229
|
+
* Rule feature.
|
|
2230
|
+
* @since 1.20.0
|
|
2231
|
+
*/
|
|
2232
|
+
type RuleFeature = "CFG" | "CHK" | "DBG" | "FIX" | "MOD" | "TSC";
|
|
2233
|
+
|
|
2234
|
+
export { type CustomComponent, type CustomComponentNormalized, type CustomComponentProp, type CustomComponentPropNormalized, CustomComponentPropSchema, CustomComponentSchema, type CustomHooks, CustomHooksSchema, DEFAULT_ESLINT_REACT_SETTINGS, DOM_HTML_COMPONENT_TYPES, DOM_SVG_COMPONENT_TYPES, type ESLintReactSettings, type ESLintReactSettingsNormalized, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, type RuleContext, type RuleDeclaration, type RuleFeature, type RuleNamespace, type RuleOptions, type RulePreset, type RuleSeverity, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, getReactVersion, getSettingsFromContext, toNormalizedSettings, unsafeDecodeSettings };
|