@eslint-react/shared 1.8.2 → 1.8.3-beta.2
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 +165 -2
- package/dist/index.d.ts +165 -2
- package/dist/index.js +63 -0
- package/dist/index.mjs +62 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -56,9 +56,11 @@ declare const HOST_HTML_COMPONENT_TYPES: readonly ["aside", "audio", "b", "base"
|
|
|
56
56
|
* @internal
|
|
57
57
|
*/
|
|
58
58
|
declare const HOST_SVG_COMPONENT_TYPES: readonly ["a", "animate", "animateMotion", "animateTransform", "circle", "clipPath", "defs", "desc", "discard", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "foreignObject", "g", "hatch", "hatchpath", "image", "line", "linearGradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "script", "set", "stop", "style", "svg", "switch", "symbol", "text", "textPath", "title", "tspan", "use", "view"];
|
|
59
|
+
declare const REACT_BUILD_IN_HOOKS: readonly ["useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition"];
|
|
59
60
|
|
|
60
61
|
/**
|
|
61
62
|
* Get the ESLint rule creator for a plugin.
|
|
63
|
+
* @internal
|
|
62
64
|
* @param pluginName The name of the plugin.
|
|
63
65
|
* @returns The ESLint rule creator.
|
|
64
66
|
*/
|
|
@@ -1582,12 +1584,46 @@ declare const CustomComponentSchema: ObjectSchema<{
|
|
|
1582
1584
|
* @internal
|
|
1583
1585
|
*/
|
|
1584
1586
|
declare const ESLintReactSettingsSchema: ObjectSchema<{
|
|
1587
|
+
/**
|
|
1588
|
+
* The source where React is imported from.
|
|
1589
|
+
* @description This allows to specify a custom import location for React when not using the official distribution.
|
|
1590
|
+
* @default `"react"`
|
|
1591
|
+
* @example `"@pika/react"`
|
|
1592
|
+
*/
|
|
1585
1593
|
readonly importSource: OptionalSchema<StringSchema<undefined>, never>;
|
|
1594
|
+
/**
|
|
1595
|
+
* The identifier that’s used for JSX Element creation.
|
|
1596
|
+
* @default `"createElement"`
|
|
1597
|
+
*/
|
|
1586
1598
|
readonly jsxPragma: OptionalSchema<StringSchema<undefined>, never>;
|
|
1599
|
+
/**
|
|
1600
|
+
* The identifier that’s used for JSX fragment elements.
|
|
1601
|
+
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
1602
|
+
* @default `"Fragment"`
|
|
1603
|
+
*/
|
|
1587
1604
|
readonly jsxPragmaFrag: OptionalSchema<StringSchema<undefined>, never>;
|
|
1605
|
+
/**
|
|
1606
|
+
* The name of the prop that is used for polymorphic components.
|
|
1607
|
+
* @description This is used to determine the type of the component.
|
|
1608
|
+
* @example `"as"`
|
|
1609
|
+
*/
|
|
1588
1610
|
readonly polymorphicPropName: OptionalSchema<StringSchema<undefined>, never>;
|
|
1611
|
+
/**
|
|
1612
|
+
* @internal
|
|
1613
|
+
*/
|
|
1589
1614
|
readonly strict: OptionalSchema<BooleanSchema<undefined>, never>;
|
|
1615
|
+
/**
|
|
1616
|
+
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
1617
|
+
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
1618
|
+
* @example `"18.3.1"`
|
|
1619
|
+
* @default `"detect"`
|
|
1620
|
+
*/
|
|
1590
1621
|
readonly version: OptionalSchema<StringSchema<undefined>, never>;
|
|
1622
|
+
/**
|
|
1623
|
+
* An array of user-defined components
|
|
1624
|
+
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
1625
|
+
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
1626
|
+
*/
|
|
1591
1627
|
readonly additionalComponents: OptionalSchema<ArraySchema<ObjectSchema<{
|
|
1592
1628
|
/**
|
|
1593
1629
|
* The name of the user-defined component.
|
|
@@ -1639,6 +1675,11 @@ declare const ESLintReactSettingsSchema: ObjectSchema<{
|
|
|
1639
1675
|
readonly defaultValue: OptionalSchema<StringSchema<undefined>, never>;
|
|
1640
1676
|
}, undefined>, undefined>, readonly []>;
|
|
1641
1677
|
}, undefined>, undefined>, never>;
|
|
1678
|
+
/**
|
|
1679
|
+
* A object of aliases for React built-in hooks.
|
|
1680
|
+
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
1681
|
+
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
1682
|
+
*/
|
|
1642
1683
|
readonly additionalHooks: OptionalSchema<ObjectSchema<{
|
|
1643
1684
|
readonly use: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, never>;
|
|
1644
1685
|
readonly useActionState: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, never>;
|
|
@@ -1665,12 +1706,46 @@ declare const ESLintReactSettingsSchema: ObjectSchema<{
|
|
|
1665
1706
|
*/
|
|
1666
1707
|
declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
1667
1708
|
readonly "react-x": OptionalSchema<ObjectSchema<{
|
|
1709
|
+
/**
|
|
1710
|
+
* The source where React is imported from.
|
|
1711
|
+
* @description This allows to specify a custom import location for React when not using the official distribution.
|
|
1712
|
+
* @default `"react"`
|
|
1713
|
+
* @example `"@pika/react"`
|
|
1714
|
+
*/
|
|
1668
1715
|
readonly importSource: OptionalSchema<StringSchema<undefined>, never>;
|
|
1716
|
+
/**
|
|
1717
|
+
* The identifier that’s used for JSX Element creation.
|
|
1718
|
+
* @default `"createElement"`
|
|
1719
|
+
*/
|
|
1669
1720
|
readonly jsxPragma: OptionalSchema<StringSchema<undefined>, never>;
|
|
1721
|
+
/**
|
|
1722
|
+
* The identifier that’s used for JSX fragment elements.
|
|
1723
|
+
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
1724
|
+
* @default `"Fragment"`
|
|
1725
|
+
*/
|
|
1670
1726
|
readonly jsxPragmaFrag: OptionalSchema<StringSchema<undefined>, never>;
|
|
1727
|
+
/**
|
|
1728
|
+
* The name of the prop that is used for polymorphic components.
|
|
1729
|
+
* @description This is used to determine the type of the component.
|
|
1730
|
+
* @example `"as"`
|
|
1731
|
+
*/
|
|
1671
1732
|
readonly polymorphicPropName: OptionalSchema<StringSchema<undefined>, never>;
|
|
1733
|
+
/**
|
|
1734
|
+
* @internal
|
|
1735
|
+
*/
|
|
1672
1736
|
readonly strict: OptionalSchema<BooleanSchema<undefined>, never>;
|
|
1737
|
+
/**
|
|
1738
|
+
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
1739
|
+
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
1740
|
+
* @example `"18.3.1"`
|
|
1741
|
+
* @default `"detect"`
|
|
1742
|
+
*/
|
|
1673
1743
|
readonly version: OptionalSchema<StringSchema<undefined>, never>;
|
|
1744
|
+
/**
|
|
1745
|
+
* An array of user-defined components
|
|
1746
|
+
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
1747
|
+
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
1748
|
+
*/
|
|
1674
1749
|
readonly additionalComponents: OptionalSchema<ArraySchema<ObjectSchema<{
|
|
1675
1750
|
/**
|
|
1676
1751
|
* The name of the user-defined component.
|
|
@@ -1722,6 +1797,11 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1722
1797
|
readonly defaultValue: OptionalSchema<StringSchema<undefined>, never>;
|
|
1723
1798
|
}, undefined>, undefined>, readonly []>;
|
|
1724
1799
|
}, undefined>, undefined>, never>;
|
|
1800
|
+
/**
|
|
1801
|
+
* A object of aliases for React built-in hooks.
|
|
1802
|
+
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
1803
|
+
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
1804
|
+
*/
|
|
1725
1805
|
readonly additionalHooks: OptionalSchema<ObjectSchema<{
|
|
1726
1806
|
readonly use: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, never>;
|
|
1727
1807
|
readonly useActionState: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, never>;
|
|
@@ -1748,12 +1828,46 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1748
1828
|
* @deprecated
|
|
1749
1829
|
*/
|
|
1750
1830
|
readonly reactOptions: OptionalSchema<ObjectSchema<{
|
|
1831
|
+
/**
|
|
1832
|
+
* The source where React is imported from.
|
|
1833
|
+
* @description This allows to specify a custom import location for React when not using the official distribution.
|
|
1834
|
+
* @default `"react"`
|
|
1835
|
+
* @example `"@pika/react"`
|
|
1836
|
+
*/
|
|
1751
1837
|
readonly importSource: OptionalSchema<StringSchema<undefined>, never>;
|
|
1838
|
+
/**
|
|
1839
|
+
* The identifier that’s used for JSX Element creation.
|
|
1840
|
+
* @default `"createElement"`
|
|
1841
|
+
*/
|
|
1752
1842
|
readonly jsxPragma: OptionalSchema<StringSchema<undefined>, never>;
|
|
1843
|
+
/**
|
|
1844
|
+
* The identifier that’s used for JSX fragment elements.
|
|
1845
|
+
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
1846
|
+
* @default `"Fragment"`
|
|
1847
|
+
*/
|
|
1753
1848
|
readonly jsxPragmaFrag: OptionalSchema<StringSchema<undefined>, never>;
|
|
1849
|
+
/**
|
|
1850
|
+
* The name of the prop that is used for polymorphic components.
|
|
1851
|
+
* @description This is used to determine the type of the component.
|
|
1852
|
+
* @example `"as"`
|
|
1853
|
+
*/
|
|
1754
1854
|
readonly polymorphicPropName: OptionalSchema<StringSchema<undefined>, never>;
|
|
1855
|
+
/**
|
|
1856
|
+
* @internal
|
|
1857
|
+
*/
|
|
1755
1858
|
readonly strict: OptionalSchema<BooleanSchema<undefined>, never>;
|
|
1859
|
+
/**
|
|
1860
|
+
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
1861
|
+
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
1862
|
+
* @example `"18.3.1"`
|
|
1863
|
+
* @default `"detect"`
|
|
1864
|
+
*/
|
|
1756
1865
|
readonly version: OptionalSchema<StringSchema<undefined>, never>;
|
|
1866
|
+
/**
|
|
1867
|
+
* An array of user-defined components
|
|
1868
|
+
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
1869
|
+
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
1870
|
+
*/
|
|
1757
1871
|
readonly additionalComponents: OptionalSchema<ArraySchema<ObjectSchema<{
|
|
1758
1872
|
/**
|
|
1759
1873
|
* The name of the user-defined component.
|
|
@@ -1805,6 +1919,11 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1805
1919
|
readonly defaultValue: OptionalSchema<StringSchema<undefined>, never>;
|
|
1806
1920
|
}, undefined>, undefined>, readonly []>;
|
|
1807
1921
|
}, undefined>, undefined>, never>;
|
|
1922
|
+
/**
|
|
1923
|
+
* A object of aliases for React built-in hooks.
|
|
1924
|
+
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
1925
|
+
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
1926
|
+
*/
|
|
1808
1927
|
readonly additionalHooks: OptionalSchema<ObjectSchema<{
|
|
1809
1928
|
readonly use: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, never>;
|
|
1810
1929
|
readonly useActionState: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, never>;
|
|
@@ -1956,11 +2075,55 @@ interface ESLintReactSettingsExpanded extends ESLintReactSettings {
|
|
|
1956
2075
|
additionalComponents: CustomComponentExpanded[];
|
|
1957
2076
|
components: Map<string, string>;
|
|
1958
2077
|
}
|
|
2078
|
+
/**
|
|
2079
|
+
* Defines the "react-x" settings in a type-safe way.
|
|
2080
|
+
* @param settings The settings.
|
|
2081
|
+
* @returns The ESLint settings containing the "react-x" object.
|
|
2082
|
+
*/
|
|
2083
|
+
declare function defineSettings(settings: ESLintReactSettings): {
|
|
2084
|
+
importSource?: string | undefined;
|
|
2085
|
+
jsxPragma?: string | undefined;
|
|
2086
|
+
jsxPragmaFrag?: string | undefined;
|
|
2087
|
+
polymorphicPropName?: string | undefined;
|
|
2088
|
+
strict?: boolean | undefined;
|
|
2089
|
+
version?: string | undefined;
|
|
2090
|
+
additionalComponents?: {
|
|
2091
|
+
name: string;
|
|
2092
|
+
attributes: {
|
|
2093
|
+
name: string;
|
|
2094
|
+
as?: string | undefined;
|
|
2095
|
+
controlled?: boolean | undefined;
|
|
2096
|
+
defaultValue?: string | undefined;
|
|
2097
|
+
}[];
|
|
2098
|
+
as?: string | undefined;
|
|
2099
|
+
selector?: string | undefined;
|
|
2100
|
+
}[] | undefined;
|
|
2101
|
+
additionalHooks?: {
|
|
2102
|
+
use?: string[] | undefined;
|
|
2103
|
+
useActionState?: string[] | undefined;
|
|
2104
|
+
useCallback?: string[] | undefined;
|
|
2105
|
+
useContext?: string[] | undefined;
|
|
2106
|
+
useDebugValue?: string[] | undefined;
|
|
2107
|
+
useDeferredValue?: string[] | undefined;
|
|
2108
|
+
useEffect?: string[] | undefined;
|
|
2109
|
+
useId?: string[] | undefined;
|
|
2110
|
+
useImperativeHandle?: string[] | undefined;
|
|
2111
|
+
useInsertionEffect?: string[] | undefined;
|
|
2112
|
+
useLayoutEffect?: string[] | undefined;
|
|
2113
|
+
useMemo?: string[] | undefined;
|
|
2114
|
+
useOptimistic?: string[] | undefined;
|
|
2115
|
+
useReducer?: string[] | undefined;
|
|
2116
|
+
useRef?: string[] | undefined;
|
|
2117
|
+
useState?: string[] | undefined;
|
|
2118
|
+
useSyncExternalStore?: string[] | undefined;
|
|
2119
|
+
useTransition?: string[] | undefined;
|
|
2120
|
+
} | undefined;
|
|
2121
|
+
};
|
|
1959
2122
|
/**
|
|
1960
2123
|
* Decodes settings from a data object from `context.settings`.
|
|
2124
|
+
* @internal
|
|
1961
2125
|
* @param data The data object.
|
|
1962
2126
|
* @returns settings The settings.
|
|
1963
|
-
* @internal
|
|
1964
2127
|
*/
|
|
1965
2128
|
declare function decodeSettings(data: unknown): ESLintReactSettings;
|
|
1966
2129
|
/**
|
|
@@ -1975,4 +2138,4 @@ declare const expandSettings: Memoized<(settings: ESLintReactSettings) => ESLint
|
|
|
1975
2138
|
*/
|
|
1976
2139
|
declare const DEFAULT_ESLINT_REACT_SETTINGS: ESLintReactSettings;
|
|
1977
2140
|
|
|
1978
|
-
export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, type CustomComponentExpanded, CustomComponentSchema, type CustomHook, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, type ESLintReactSettings, type ESLintReactSettingsExpanded, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, expandSettings };
|
|
2141
|
+
export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, type CustomComponentExpanded, CustomComponentSchema, type CustomHook, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, type ESLintReactSettings, type ESLintReactSettingsExpanded, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, expandSettings };
|
package/dist/index.d.ts
CHANGED
|
@@ -56,9 +56,11 @@ declare const HOST_HTML_COMPONENT_TYPES: readonly ["aside", "audio", "b", "base"
|
|
|
56
56
|
* @internal
|
|
57
57
|
*/
|
|
58
58
|
declare const HOST_SVG_COMPONENT_TYPES: readonly ["a", "animate", "animateMotion", "animateTransform", "circle", "clipPath", "defs", "desc", "discard", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "foreignObject", "g", "hatch", "hatchpath", "image", "line", "linearGradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "script", "set", "stop", "style", "svg", "switch", "symbol", "text", "textPath", "title", "tspan", "use", "view"];
|
|
59
|
+
declare const REACT_BUILD_IN_HOOKS: readonly ["useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition"];
|
|
59
60
|
|
|
60
61
|
/**
|
|
61
62
|
* Get the ESLint rule creator for a plugin.
|
|
63
|
+
* @internal
|
|
62
64
|
* @param pluginName The name of the plugin.
|
|
63
65
|
* @returns The ESLint rule creator.
|
|
64
66
|
*/
|
|
@@ -1582,12 +1584,46 @@ declare const CustomComponentSchema: ObjectSchema<{
|
|
|
1582
1584
|
* @internal
|
|
1583
1585
|
*/
|
|
1584
1586
|
declare const ESLintReactSettingsSchema: ObjectSchema<{
|
|
1587
|
+
/**
|
|
1588
|
+
* The source where React is imported from.
|
|
1589
|
+
* @description This allows to specify a custom import location for React when not using the official distribution.
|
|
1590
|
+
* @default `"react"`
|
|
1591
|
+
* @example `"@pika/react"`
|
|
1592
|
+
*/
|
|
1585
1593
|
readonly importSource: OptionalSchema<StringSchema<undefined>, never>;
|
|
1594
|
+
/**
|
|
1595
|
+
* The identifier that’s used for JSX Element creation.
|
|
1596
|
+
* @default `"createElement"`
|
|
1597
|
+
*/
|
|
1586
1598
|
readonly jsxPragma: OptionalSchema<StringSchema<undefined>, never>;
|
|
1599
|
+
/**
|
|
1600
|
+
* The identifier that’s used for JSX fragment elements.
|
|
1601
|
+
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
1602
|
+
* @default `"Fragment"`
|
|
1603
|
+
*/
|
|
1587
1604
|
readonly jsxPragmaFrag: OptionalSchema<StringSchema<undefined>, never>;
|
|
1605
|
+
/**
|
|
1606
|
+
* The name of the prop that is used for polymorphic components.
|
|
1607
|
+
* @description This is used to determine the type of the component.
|
|
1608
|
+
* @example `"as"`
|
|
1609
|
+
*/
|
|
1588
1610
|
readonly polymorphicPropName: OptionalSchema<StringSchema<undefined>, never>;
|
|
1611
|
+
/**
|
|
1612
|
+
* @internal
|
|
1613
|
+
*/
|
|
1589
1614
|
readonly strict: OptionalSchema<BooleanSchema<undefined>, never>;
|
|
1615
|
+
/**
|
|
1616
|
+
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
1617
|
+
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
1618
|
+
* @example `"18.3.1"`
|
|
1619
|
+
* @default `"detect"`
|
|
1620
|
+
*/
|
|
1590
1621
|
readonly version: OptionalSchema<StringSchema<undefined>, never>;
|
|
1622
|
+
/**
|
|
1623
|
+
* An array of user-defined components
|
|
1624
|
+
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
1625
|
+
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
1626
|
+
*/
|
|
1591
1627
|
readonly additionalComponents: OptionalSchema<ArraySchema<ObjectSchema<{
|
|
1592
1628
|
/**
|
|
1593
1629
|
* The name of the user-defined component.
|
|
@@ -1639,6 +1675,11 @@ declare const ESLintReactSettingsSchema: ObjectSchema<{
|
|
|
1639
1675
|
readonly defaultValue: OptionalSchema<StringSchema<undefined>, never>;
|
|
1640
1676
|
}, undefined>, undefined>, readonly []>;
|
|
1641
1677
|
}, undefined>, undefined>, never>;
|
|
1678
|
+
/**
|
|
1679
|
+
* A object of aliases for React built-in hooks.
|
|
1680
|
+
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
1681
|
+
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
1682
|
+
*/
|
|
1642
1683
|
readonly additionalHooks: OptionalSchema<ObjectSchema<{
|
|
1643
1684
|
readonly use: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, never>;
|
|
1644
1685
|
readonly useActionState: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, never>;
|
|
@@ -1665,12 +1706,46 @@ declare const ESLintReactSettingsSchema: ObjectSchema<{
|
|
|
1665
1706
|
*/
|
|
1666
1707
|
declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
1667
1708
|
readonly "react-x": OptionalSchema<ObjectSchema<{
|
|
1709
|
+
/**
|
|
1710
|
+
* The source where React is imported from.
|
|
1711
|
+
* @description This allows to specify a custom import location for React when not using the official distribution.
|
|
1712
|
+
* @default `"react"`
|
|
1713
|
+
* @example `"@pika/react"`
|
|
1714
|
+
*/
|
|
1668
1715
|
readonly importSource: OptionalSchema<StringSchema<undefined>, never>;
|
|
1716
|
+
/**
|
|
1717
|
+
* The identifier that’s used for JSX Element creation.
|
|
1718
|
+
* @default `"createElement"`
|
|
1719
|
+
*/
|
|
1669
1720
|
readonly jsxPragma: OptionalSchema<StringSchema<undefined>, never>;
|
|
1721
|
+
/**
|
|
1722
|
+
* The identifier that’s used for JSX fragment elements.
|
|
1723
|
+
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
1724
|
+
* @default `"Fragment"`
|
|
1725
|
+
*/
|
|
1670
1726
|
readonly jsxPragmaFrag: OptionalSchema<StringSchema<undefined>, never>;
|
|
1727
|
+
/**
|
|
1728
|
+
* The name of the prop that is used for polymorphic components.
|
|
1729
|
+
* @description This is used to determine the type of the component.
|
|
1730
|
+
* @example `"as"`
|
|
1731
|
+
*/
|
|
1671
1732
|
readonly polymorphicPropName: OptionalSchema<StringSchema<undefined>, never>;
|
|
1733
|
+
/**
|
|
1734
|
+
* @internal
|
|
1735
|
+
*/
|
|
1672
1736
|
readonly strict: OptionalSchema<BooleanSchema<undefined>, never>;
|
|
1737
|
+
/**
|
|
1738
|
+
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
1739
|
+
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
1740
|
+
* @example `"18.3.1"`
|
|
1741
|
+
* @default `"detect"`
|
|
1742
|
+
*/
|
|
1673
1743
|
readonly version: OptionalSchema<StringSchema<undefined>, never>;
|
|
1744
|
+
/**
|
|
1745
|
+
* An array of user-defined components
|
|
1746
|
+
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
1747
|
+
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
1748
|
+
*/
|
|
1674
1749
|
readonly additionalComponents: OptionalSchema<ArraySchema<ObjectSchema<{
|
|
1675
1750
|
/**
|
|
1676
1751
|
* The name of the user-defined component.
|
|
@@ -1722,6 +1797,11 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1722
1797
|
readonly defaultValue: OptionalSchema<StringSchema<undefined>, never>;
|
|
1723
1798
|
}, undefined>, undefined>, readonly []>;
|
|
1724
1799
|
}, undefined>, undefined>, never>;
|
|
1800
|
+
/**
|
|
1801
|
+
* A object of aliases for React built-in hooks.
|
|
1802
|
+
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
1803
|
+
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
1804
|
+
*/
|
|
1725
1805
|
readonly additionalHooks: OptionalSchema<ObjectSchema<{
|
|
1726
1806
|
readonly use: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, never>;
|
|
1727
1807
|
readonly useActionState: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, never>;
|
|
@@ -1748,12 +1828,46 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1748
1828
|
* @deprecated
|
|
1749
1829
|
*/
|
|
1750
1830
|
readonly reactOptions: OptionalSchema<ObjectSchema<{
|
|
1831
|
+
/**
|
|
1832
|
+
* The source where React is imported from.
|
|
1833
|
+
* @description This allows to specify a custom import location for React when not using the official distribution.
|
|
1834
|
+
* @default `"react"`
|
|
1835
|
+
* @example `"@pika/react"`
|
|
1836
|
+
*/
|
|
1751
1837
|
readonly importSource: OptionalSchema<StringSchema<undefined>, never>;
|
|
1838
|
+
/**
|
|
1839
|
+
* The identifier that’s used for JSX Element creation.
|
|
1840
|
+
* @default `"createElement"`
|
|
1841
|
+
*/
|
|
1752
1842
|
readonly jsxPragma: OptionalSchema<StringSchema<undefined>, never>;
|
|
1843
|
+
/**
|
|
1844
|
+
* The identifier that’s used for JSX fragment elements.
|
|
1845
|
+
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
1846
|
+
* @default `"Fragment"`
|
|
1847
|
+
*/
|
|
1753
1848
|
readonly jsxPragmaFrag: OptionalSchema<StringSchema<undefined>, never>;
|
|
1849
|
+
/**
|
|
1850
|
+
* The name of the prop that is used for polymorphic components.
|
|
1851
|
+
* @description This is used to determine the type of the component.
|
|
1852
|
+
* @example `"as"`
|
|
1853
|
+
*/
|
|
1754
1854
|
readonly polymorphicPropName: OptionalSchema<StringSchema<undefined>, never>;
|
|
1855
|
+
/**
|
|
1856
|
+
* @internal
|
|
1857
|
+
*/
|
|
1755
1858
|
readonly strict: OptionalSchema<BooleanSchema<undefined>, never>;
|
|
1859
|
+
/**
|
|
1860
|
+
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
1861
|
+
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
1862
|
+
* @example `"18.3.1"`
|
|
1863
|
+
* @default `"detect"`
|
|
1864
|
+
*/
|
|
1756
1865
|
readonly version: OptionalSchema<StringSchema<undefined>, never>;
|
|
1866
|
+
/**
|
|
1867
|
+
* An array of user-defined components
|
|
1868
|
+
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
1869
|
+
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
1870
|
+
*/
|
|
1757
1871
|
readonly additionalComponents: OptionalSchema<ArraySchema<ObjectSchema<{
|
|
1758
1872
|
/**
|
|
1759
1873
|
* The name of the user-defined component.
|
|
@@ -1805,6 +1919,11 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
|
|
|
1805
1919
|
readonly defaultValue: OptionalSchema<StringSchema<undefined>, never>;
|
|
1806
1920
|
}, undefined>, undefined>, readonly []>;
|
|
1807
1921
|
}, undefined>, undefined>, never>;
|
|
1922
|
+
/**
|
|
1923
|
+
* A object of aliases for React built-in hooks.
|
|
1924
|
+
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
1925
|
+
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
1926
|
+
*/
|
|
1808
1927
|
readonly additionalHooks: OptionalSchema<ObjectSchema<{
|
|
1809
1928
|
readonly use: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, never>;
|
|
1810
1929
|
readonly useActionState: OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, never>;
|
|
@@ -1956,11 +2075,55 @@ interface ESLintReactSettingsExpanded extends ESLintReactSettings {
|
|
|
1956
2075
|
additionalComponents: CustomComponentExpanded[];
|
|
1957
2076
|
components: Map<string, string>;
|
|
1958
2077
|
}
|
|
2078
|
+
/**
|
|
2079
|
+
* Defines the "react-x" settings in a type-safe way.
|
|
2080
|
+
* @param settings The settings.
|
|
2081
|
+
* @returns The ESLint settings containing the "react-x" object.
|
|
2082
|
+
*/
|
|
2083
|
+
declare function defineSettings(settings: ESLintReactSettings): {
|
|
2084
|
+
importSource?: string | undefined;
|
|
2085
|
+
jsxPragma?: string | undefined;
|
|
2086
|
+
jsxPragmaFrag?: string | undefined;
|
|
2087
|
+
polymorphicPropName?: string | undefined;
|
|
2088
|
+
strict?: boolean | undefined;
|
|
2089
|
+
version?: string | undefined;
|
|
2090
|
+
additionalComponents?: {
|
|
2091
|
+
name: string;
|
|
2092
|
+
attributes: {
|
|
2093
|
+
name: string;
|
|
2094
|
+
as?: string | undefined;
|
|
2095
|
+
controlled?: boolean | undefined;
|
|
2096
|
+
defaultValue?: string | undefined;
|
|
2097
|
+
}[];
|
|
2098
|
+
as?: string | undefined;
|
|
2099
|
+
selector?: string | undefined;
|
|
2100
|
+
}[] | undefined;
|
|
2101
|
+
additionalHooks?: {
|
|
2102
|
+
use?: string[] | undefined;
|
|
2103
|
+
useActionState?: string[] | undefined;
|
|
2104
|
+
useCallback?: string[] | undefined;
|
|
2105
|
+
useContext?: string[] | undefined;
|
|
2106
|
+
useDebugValue?: string[] | undefined;
|
|
2107
|
+
useDeferredValue?: string[] | undefined;
|
|
2108
|
+
useEffect?: string[] | undefined;
|
|
2109
|
+
useId?: string[] | undefined;
|
|
2110
|
+
useImperativeHandle?: string[] | undefined;
|
|
2111
|
+
useInsertionEffect?: string[] | undefined;
|
|
2112
|
+
useLayoutEffect?: string[] | undefined;
|
|
2113
|
+
useMemo?: string[] | undefined;
|
|
2114
|
+
useOptimistic?: string[] | undefined;
|
|
2115
|
+
useReducer?: string[] | undefined;
|
|
2116
|
+
useRef?: string[] | undefined;
|
|
2117
|
+
useState?: string[] | undefined;
|
|
2118
|
+
useSyncExternalStore?: string[] | undefined;
|
|
2119
|
+
useTransition?: string[] | undefined;
|
|
2120
|
+
} | undefined;
|
|
2121
|
+
};
|
|
1959
2122
|
/**
|
|
1960
2123
|
* Decodes settings from a data object from `context.settings`.
|
|
2124
|
+
* @internal
|
|
1961
2125
|
* @param data The data object.
|
|
1962
2126
|
* @returns settings The settings.
|
|
1963
|
-
* @internal
|
|
1964
2127
|
*/
|
|
1965
2128
|
declare function decodeSettings(data: unknown): ESLintReactSettings;
|
|
1966
2129
|
/**
|
|
@@ -1975,4 +2138,4 @@ declare const expandSettings: Memoized<(settings: ESLintReactSettings) => ESLint
|
|
|
1975
2138
|
*/
|
|
1976
2139
|
declare const DEFAULT_ESLINT_REACT_SETTINGS: ESLintReactSettings;
|
|
1977
2140
|
|
|
1978
|
-
export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, type CustomComponentExpanded, CustomComponentSchema, type CustomHook, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, type ESLintReactSettings, type ESLintReactSettingsExpanded, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, expandSettings };
|
|
2141
|
+
export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, type CustomComponentExpanded, CustomComponentSchema, type CustomHook, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, type ESLintReactSettings, type ESLintReactSettingsExpanded, ESLintReactSettingsSchema, type ESLintSettings, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, expandSettings };
|
package/dist/index.js
CHANGED
|
@@ -188,6 +188,25 @@ var HOST_SVG_COMPONENT_TYPES = [
|
|
|
188
188
|
"use",
|
|
189
189
|
"view"
|
|
190
190
|
];
|
|
191
|
+
var REACT_BUILD_IN_HOOKS = [
|
|
192
|
+
"useActionState",
|
|
193
|
+
"useCallback",
|
|
194
|
+
"useContext",
|
|
195
|
+
"useDebugValue",
|
|
196
|
+
"useDeferredValue",
|
|
197
|
+
"useEffect",
|
|
198
|
+
"useId",
|
|
199
|
+
"useImperativeHandle",
|
|
200
|
+
"useInsertionEffect",
|
|
201
|
+
"useLayoutEffect",
|
|
202
|
+
"useMemo",
|
|
203
|
+
"useOptimistic",
|
|
204
|
+
"useReducer",
|
|
205
|
+
"useRef",
|
|
206
|
+
"useState",
|
|
207
|
+
"useSyncExternalStore",
|
|
208
|
+
"useTransition"
|
|
209
|
+
];
|
|
191
210
|
var getDocsUrl = (pluginName) => (ruleName) => {
|
|
192
211
|
if (pluginName === "x") return `${WEBSITE_URL}/docs/rules/${ruleName}`;
|
|
193
212
|
return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
|
|
@@ -531,13 +550,52 @@ var CustomComponentSchema = object({
|
|
|
531
550
|
attributes: optional(array(CustomAttributeSchema), [])
|
|
532
551
|
});
|
|
533
552
|
var ESLintReactSettingsSchema = object({
|
|
553
|
+
/**
|
|
554
|
+
* The source where React is imported from.
|
|
555
|
+
* @description This allows to specify a custom import location for React when not using the official distribution.
|
|
556
|
+
* @default `"react"`
|
|
557
|
+
* @example `"@pika/react"`
|
|
558
|
+
*/
|
|
534
559
|
importSource: optional(string()),
|
|
560
|
+
/**
|
|
561
|
+
* The identifier that’s used for JSX Element creation.
|
|
562
|
+
* @default `"createElement"`
|
|
563
|
+
*/
|
|
535
564
|
jsxPragma: optional(string()),
|
|
565
|
+
/**
|
|
566
|
+
* The identifier that’s used for JSX fragment elements.
|
|
567
|
+
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
568
|
+
* @default `"Fragment"`
|
|
569
|
+
*/
|
|
536
570
|
jsxPragmaFrag: optional(string()),
|
|
571
|
+
/**
|
|
572
|
+
* The name of the prop that is used for polymorphic components.
|
|
573
|
+
* @description This is used to determine the type of the component.
|
|
574
|
+
* @example `"as"`
|
|
575
|
+
*/
|
|
537
576
|
polymorphicPropName: optional(string()),
|
|
577
|
+
/**
|
|
578
|
+
* @internal
|
|
579
|
+
*/
|
|
538
580
|
strict: optional(boolean()),
|
|
581
|
+
/**
|
|
582
|
+
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
583
|
+
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
584
|
+
* @example `"18.3.1"`
|
|
585
|
+
* @default `"detect"`
|
|
586
|
+
*/
|
|
539
587
|
version: optional(string()),
|
|
588
|
+
/**
|
|
589
|
+
* An array of user-defined components
|
|
590
|
+
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
591
|
+
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
592
|
+
*/
|
|
540
593
|
additionalComponents: optional(array(CustomComponentSchema)),
|
|
594
|
+
/**
|
|
595
|
+
* A object of aliases for React built-in hooks.
|
|
596
|
+
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
597
|
+
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
598
|
+
*/
|
|
541
599
|
additionalHooks: optional(object({
|
|
542
600
|
use: optional(array(string())),
|
|
543
601
|
useActionState: optional(array(string())),
|
|
@@ -854,6 +912,9 @@ function createMemoizedFunction(fn, options) {
|
|
|
854
912
|
memoized.options = normalizedOptions;
|
|
855
913
|
return memoized;
|
|
856
914
|
}
|
|
915
|
+
function defineSettings(settings) {
|
|
916
|
+
return parse(ESLintSettingsSchema, settings)["react-x"] ?? {};
|
|
917
|
+
}
|
|
857
918
|
function decodeSettings(data) {
|
|
858
919
|
return parse(ESLintSettingsSchema, data)["react-x"] ?? {};
|
|
859
920
|
}
|
|
@@ -898,6 +959,7 @@ exports.GITHUB_URL = GITHUB_URL;
|
|
|
898
959
|
exports.HOST_HTML_COMPONENT_TYPES = HOST_HTML_COMPONENT_TYPES;
|
|
899
960
|
exports.HOST_SVG_COMPONENT_TYPES = HOST_SVG_COMPONENT_TYPES;
|
|
900
961
|
exports.NPM_SCOPE = NPM_SCOPE;
|
|
962
|
+
exports.REACT_BUILD_IN_HOOKS = REACT_BUILD_IN_HOOKS;
|
|
901
963
|
exports.RE_CAMEL_CASE = RE_CAMEL_CASE;
|
|
902
964
|
exports.RE_CONSTANT_CASE = RE_CONSTANT_CASE;
|
|
903
965
|
exports.RE_JAVASCRIPT_PROTOCOL = RE_JAVASCRIPT_PROTOCOL;
|
|
@@ -907,4 +969,5 @@ exports.RE_SNAKE_CASE = RE_SNAKE_CASE;
|
|
|
907
969
|
exports.WEBSITE_URL = WEBSITE_URL;
|
|
908
970
|
exports.createRuleForPlugin = createRuleForPlugin;
|
|
909
971
|
exports.decodeSettings = decodeSettings;
|
|
972
|
+
exports.defineSettings = defineSettings;
|
|
910
973
|
exports.expandSettings = expandSettings;
|
package/dist/index.mjs
CHANGED
|
@@ -182,6 +182,25 @@ var HOST_SVG_COMPONENT_TYPES = [
|
|
|
182
182
|
"use",
|
|
183
183
|
"view"
|
|
184
184
|
];
|
|
185
|
+
var REACT_BUILD_IN_HOOKS = [
|
|
186
|
+
"useActionState",
|
|
187
|
+
"useCallback",
|
|
188
|
+
"useContext",
|
|
189
|
+
"useDebugValue",
|
|
190
|
+
"useDeferredValue",
|
|
191
|
+
"useEffect",
|
|
192
|
+
"useId",
|
|
193
|
+
"useImperativeHandle",
|
|
194
|
+
"useInsertionEffect",
|
|
195
|
+
"useLayoutEffect",
|
|
196
|
+
"useMemo",
|
|
197
|
+
"useOptimistic",
|
|
198
|
+
"useReducer",
|
|
199
|
+
"useRef",
|
|
200
|
+
"useState",
|
|
201
|
+
"useSyncExternalStore",
|
|
202
|
+
"useTransition"
|
|
203
|
+
];
|
|
185
204
|
var getDocsUrl = (pluginName) => (ruleName) => {
|
|
186
205
|
if (pluginName === "x") return `${WEBSITE_URL}/docs/rules/${ruleName}`;
|
|
187
206
|
return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
|
|
@@ -525,13 +544,52 @@ var CustomComponentSchema = object({
|
|
|
525
544
|
attributes: optional(array(CustomAttributeSchema), [])
|
|
526
545
|
});
|
|
527
546
|
var ESLintReactSettingsSchema = object({
|
|
547
|
+
/**
|
|
548
|
+
* The source where React is imported from.
|
|
549
|
+
* @description This allows to specify a custom import location for React when not using the official distribution.
|
|
550
|
+
* @default `"react"`
|
|
551
|
+
* @example `"@pika/react"`
|
|
552
|
+
*/
|
|
528
553
|
importSource: optional(string()),
|
|
554
|
+
/**
|
|
555
|
+
* The identifier that’s used for JSX Element creation.
|
|
556
|
+
* @default `"createElement"`
|
|
557
|
+
*/
|
|
529
558
|
jsxPragma: optional(string()),
|
|
559
|
+
/**
|
|
560
|
+
* The identifier that’s used for JSX fragment elements.
|
|
561
|
+
* @description This should not be a member expression (i.e. use "Fragment" instead of "React.Fragment").
|
|
562
|
+
* @default `"Fragment"`
|
|
563
|
+
*/
|
|
530
564
|
jsxPragmaFrag: optional(string()),
|
|
565
|
+
/**
|
|
566
|
+
* The name of the prop that is used for polymorphic components.
|
|
567
|
+
* @description This is used to determine the type of the component.
|
|
568
|
+
* @example `"as"`
|
|
569
|
+
*/
|
|
531
570
|
polymorphicPropName: optional(string()),
|
|
571
|
+
/**
|
|
572
|
+
* @internal
|
|
573
|
+
*/
|
|
532
574
|
strict: optional(boolean()),
|
|
575
|
+
/**
|
|
576
|
+
* React version to use, "detect" means auto detect React version from the project’s dependencies.
|
|
577
|
+
* If `importSource` is specified, an equivalent version of React should be provided here.
|
|
578
|
+
* @example `"18.3.1"`
|
|
579
|
+
* @default `"detect"`
|
|
580
|
+
*/
|
|
533
581
|
version: optional(string()),
|
|
582
|
+
/**
|
|
583
|
+
* An array of user-defined components
|
|
584
|
+
* @description This is used to inform the ESLint React plugins how to treat these components during checks.
|
|
585
|
+
* @example `[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]`
|
|
586
|
+
*/
|
|
534
587
|
additionalComponents: optional(array(CustomComponentSchema)),
|
|
588
|
+
/**
|
|
589
|
+
* A object of aliases for React built-in hooks.
|
|
590
|
+
* @description ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules.
|
|
591
|
+
* @example `{ useLayoutEffect: ["useIsomorphicLayoutEffect"] }`
|
|
592
|
+
*/
|
|
535
593
|
additionalHooks: optional(object({
|
|
536
594
|
use: optional(array(string())),
|
|
537
595
|
useActionState: optional(array(string())),
|
|
@@ -848,6 +906,9 @@ function createMemoizedFunction(fn, options) {
|
|
|
848
906
|
memoized.options = normalizedOptions;
|
|
849
907
|
return memoized;
|
|
850
908
|
}
|
|
909
|
+
function defineSettings(settings) {
|
|
910
|
+
return parse(ESLintSettingsSchema, settings)["react-x"] ?? {};
|
|
911
|
+
}
|
|
851
912
|
function decodeSettings(data) {
|
|
852
913
|
return parse(ESLintSettingsSchema, data)["react-x"] ?? {};
|
|
853
914
|
}
|
|
@@ -882,4 +943,4 @@ var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
|
882
943
|
version: "detect"
|
|
883
944
|
};
|
|
884
945
|
|
|
885
|
-
export { CustomAttributeSchema, CustomComponentSchema, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, expandSettings };
|
|
946
|
+
export { CustomAttributeSchema, CustomComponentSchema, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, NPM_SCOPE, REACT_BUILD_IN_HOOKS, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, expandSettings };
|