@eslint-react/shared 1.24.0-next.0 → 1.24.0-next.11
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 +168 -170
- package/dist/index.d.ts +168 -170
- package/dist/index.js +78 -97
- package/dist/index.mjs +76 -94
- package/package.json +3 -3
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.
|
|
@@ -1008,66 +1009,6 @@ 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
|
*/
|
|
@@ -1396,35 +1337,28 @@ declare function readonly<TInput>(): ReadonlyAction<TInput>;
|
|
|
1396
1337
|
|
|
1397
1338
|
/**
|
|
1398
1339
|
* @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
1340
|
*/
|
|
1403
|
-
declare const
|
|
1404
|
-
/**
|
|
1405
|
-
* @internal
|
|
1406
|
-
*/
|
|
1407
|
-
declare const CustomAttributeSchema: ObjectSchema<{
|
|
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 };
|