@eslint-react/shared 1.8.3-beta.2 → 1.8.3-beta.6

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 CHANGED
@@ -1612,6 +1612,10 @@ declare const ESLintReactSettingsSchema: ObjectSchema<{
1612
1612
  * @internal
1613
1613
  */
1614
1614
  readonly strict: OptionalSchema<BooleanSchema<undefined>, never>;
1615
+ /**
1616
+ * @internal
1617
+ */
1618
+ readonly skipImportCheck: OptionalSchema<BooleanSchema<undefined>, true>;
1615
1619
  /**
1616
1620
  * React version to use, "detect" means auto detect React version from the project’s dependencies.
1617
1621
  * If `importSource` is specified, an equivalent version of React should be provided here.
@@ -1734,6 +1738,10 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
1734
1738
  * @internal
1735
1739
  */
1736
1740
  readonly strict: OptionalSchema<BooleanSchema<undefined>, never>;
1741
+ /**
1742
+ * @internal
1743
+ */
1744
+ readonly skipImportCheck: OptionalSchema<BooleanSchema<undefined>, true>;
1737
1745
  /**
1738
1746
  * React version to use, "detect" means auto detect React version from the project’s dependencies.
1739
1747
  * If `importSource` is specified, an equivalent version of React should be provided here.
@@ -1856,6 +1864,10 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
1856
1864
  * @internal
1857
1865
  */
1858
1866
  readonly strict: OptionalSchema<BooleanSchema<undefined>, never>;
1867
+ /**
1868
+ * @internal
1869
+ */
1870
+ readonly skipImportCheck: OptionalSchema<BooleanSchema<undefined>, true>;
1859
1871
  /**
1860
1872
  * React version to use, "detect" means auto detect React version from the project’s dependencies.
1861
1873
  * If `importSource` is specified, an equivalent version of React should be provided here.
@@ -2056,6 +2068,14 @@ type Memoized<Fn extends AnyFn> = Fn &
2056
2068
  options: NormalizedOptions<Fn>;
2057
2069
  };
2058
2070
 
2071
+ /**
2072
+ * The initial settings for "react-x".
2073
+ */
2074
+ declare const INITIAL_ESLINT_REACT_SETTINGS: ESLintReactSettings;
2075
+ /**
2076
+ * The default ESLint settings for "react-x".
2077
+ */
2078
+ declare const DEFAULT_ESLINT_REACT_SETTINGS: ESLintReactSettings;
2059
2079
  /**
2060
2080
  * This is an expanded version of `CustomComponent` with all shorthand properties expanded.
2061
2081
  * @internal
@@ -2080,45 +2100,7 @@ interface ESLintReactSettingsExpanded extends ESLintReactSettings {
2080
2100
  * @param settings The settings.
2081
2101
  * @returns The ESLint settings containing the "react-x" object.
2082
2102
  */
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
- };
2103
+ declare function defineSettings(settings: ESLintReactSettings): {};
2122
2104
  /**
2123
2105
  * Decodes settings from a data object from `context.settings`.
2124
2106
  * @internal
@@ -2126,6 +2108,13 @@ declare function defineSettings(settings: ESLintReactSettings): {
2126
2108
  * @returns settings The settings.
2127
2109
  */
2128
2110
  declare function decodeSettings(data: unknown): ESLintReactSettings;
2111
+ /**
2112
+ * Unsafely casts settings from a data object from `context.settings`.
2113
+ * @internal
2114
+ * @param data The data object.
2115
+ * @returns settings The settings.
2116
+ */
2117
+ declare function unsafeCastSettings(data: unknown): ESLintReactSettings;
2129
2118
  /**
2130
2119
  * Expands the settings by converting all shorthand properties to their full form.
2131
2120
  * @param settings The settings.
@@ -2133,9 +2122,5 @@ declare function decodeSettings(data: unknown): ESLintReactSettings;
2133
2122
  * @internal
2134
2123
  */
2135
2124
  declare const expandSettings: Memoized<(settings: ESLintReactSettings) => ESLintReactSettingsExpanded>;
2136
- /**
2137
- * The default ESLint settings for "react-x".
2138
- */
2139
- declare const DEFAULT_ESLINT_REACT_SETTINGS: ESLintReactSettings;
2140
2125
 
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 };
2126
+ 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, INITIAL_ESLINT_REACT_SETTINGS, 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, unsafeCastSettings };
package/dist/index.d.ts CHANGED
@@ -1612,6 +1612,10 @@ declare const ESLintReactSettingsSchema: ObjectSchema<{
1612
1612
  * @internal
1613
1613
  */
1614
1614
  readonly strict: OptionalSchema<BooleanSchema<undefined>, never>;
1615
+ /**
1616
+ * @internal
1617
+ */
1618
+ readonly skipImportCheck: OptionalSchema<BooleanSchema<undefined>, true>;
1615
1619
  /**
1616
1620
  * React version to use, "detect" means auto detect React version from the project’s dependencies.
1617
1621
  * If `importSource` is specified, an equivalent version of React should be provided here.
@@ -1734,6 +1738,10 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
1734
1738
  * @internal
1735
1739
  */
1736
1740
  readonly strict: OptionalSchema<BooleanSchema<undefined>, never>;
1741
+ /**
1742
+ * @internal
1743
+ */
1744
+ readonly skipImportCheck: OptionalSchema<BooleanSchema<undefined>, true>;
1737
1745
  /**
1738
1746
  * React version to use, "detect" means auto detect React version from the project’s dependencies.
1739
1747
  * If `importSource` is specified, an equivalent version of React should be provided here.
@@ -1856,6 +1864,10 @@ declare const ESLintSettingsSchema: OptionalSchema<ObjectSchema<{
1856
1864
  * @internal
1857
1865
  */
1858
1866
  readonly strict: OptionalSchema<BooleanSchema<undefined>, never>;
1867
+ /**
1868
+ * @internal
1869
+ */
1870
+ readonly skipImportCheck: OptionalSchema<BooleanSchema<undefined>, true>;
1859
1871
  /**
1860
1872
  * React version to use, "detect" means auto detect React version from the project’s dependencies.
1861
1873
  * If `importSource` is specified, an equivalent version of React should be provided here.
@@ -2056,6 +2068,14 @@ type Memoized<Fn extends AnyFn> = Fn &
2056
2068
  options: NormalizedOptions<Fn>;
2057
2069
  };
2058
2070
 
2071
+ /**
2072
+ * The initial settings for "react-x".
2073
+ */
2074
+ declare const INITIAL_ESLINT_REACT_SETTINGS: ESLintReactSettings;
2075
+ /**
2076
+ * The default ESLint settings for "react-x".
2077
+ */
2078
+ declare const DEFAULT_ESLINT_REACT_SETTINGS: ESLintReactSettings;
2059
2079
  /**
2060
2080
  * This is an expanded version of `CustomComponent` with all shorthand properties expanded.
2061
2081
  * @internal
@@ -2080,45 +2100,7 @@ interface ESLintReactSettingsExpanded extends ESLintReactSettings {
2080
2100
  * @param settings The settings.
2081
2101
  * @returns The ESLint settings containing the "react-x" object.
2082
2102
  */
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
- };
2103
+ declare function defineSettings(settings: ESLintReactSettings): {};
2122
2104
  /**
2123
2105
  * Decodes settings from a data object from `context.settings`.
2124
2106
  * @internal
@@ -2126,6 +2108,13 @@ declare function defineSettings(settings: ESLintReactSettings): {
2126
2108
  * @returns settings The settings.
2127
2109
  */
2128
2110
  declare function decodeSettings(data: unknown): ESLintReactSettings;
2111
+ /**
2112
+ * Unsafely casts settings from a data object from `context.settings`.
2113
+ * @internal
2114
+ * @param data The data object.
2115
+ * @returns settings The settings.
2116
+ */
2117
+ declare function unsafeCastSettings(data: unknown): ESLintReactSettings;
2129
2118
  /**
2130
2119
  * Expands the settings by converting all shorthand properties to their full form.
2131
2120
  * @param settings The settings.
@@ -2133,9 +2122,5 @@ declare function decodeSettings(data: unknown): ESLintReactSettings;
2133
2122
  * @internal
2134
2123
  */
2135
2124
  declare const expandSettings: Memoized<(settings: ESLintReactSettings) => ESLintReactSettingsExpanded>;
2136
- /**
2137
- * The default ESLint settings for "react-x".
2138
- */
2139
- declare const DEFAULT_ESLINT_REACT_SETTINGS: ESLintReactSettings;
2140
2125
 
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 };
2126
+ 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, INITIAL_ESLINT_REACT_SETTINGS, 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, unsafeCastSettings };
package/dist/index.js CHANGED
@@ -578,6 +578,10 @@ var ESLintReactSettingsSchema = object({
578
578
  * @internal
579
579
  */
580
580
  strict: optional(boolean()),
581
+ /**
582
+ * @internal
583
+ */
584
+ skipImportCheck: optional(boolean(), true),
581
585
  /**
582
586
  * React version to use, "detect" means auto detect React version from the project’s dependencies.
583
587
  * If `importSource` is specified, an equivalent version of React should be provided here.
@@ -912,11 +916,31 @@ function createMemoizedFunction(fn, options) {
912
916
  memoized.options = normalizedOptions;
913
917
  return memoized;
914
918
  }
919
+ var INITIAL_ESLINT_REACT_SETTINGS = {
920
+ skipImportCheck: true
921
+ };
922
+ var DEFAULT_ESLINT_REACT_SETTINGS = {
923
+ additionalHooks: {
924
+ useLayoutEffect: ["useIsomorphicLayoutEffect"]
925
+ },
926
+ polymorphicPropName: "as",
927
+ skipImportCheck: true,
928
+ version: "detect"
929
+ };
915
930
  function defineSettings(settings) {
916
931
  return parse(ESLintSettingsSchema, settings)["react-x"] ?? {};
917
932
  }
918
933
  function decodeSettings(data) {
919
- return parse(ESLintSettingsSchema, data)["react-x"] ?? {};
934
+ return {
935
+ ...INITIAL_ESLINT_REACT_SETTINGS,
936
+ ...parse(ESLintSettingsSchema, data)["react-x"] ?? {}
937
+ };
938
+ }
939
+ function unsafeCastSettings(data) {
940
+ return {
941
+ ...INITIAL_ESLINT_REACT_SETTINGS,
942
+ ...data["react-x"] ?? {}
943
+ };
920
944
  }
921
945
  var expandSettings = createMemoizedFunction(
922
946
  (settings) => {
@@ -925,12 +949,12 @@ var expandSettings = createMemoizedFunction(
925
949
  ...settings,
926
950
  additionalComponents: additionalComponents.map((component) => ({
927
951
  ...component,
928
- attributes: component.attributes?.map((attr) => ({
952
+ attributes: component.attributes.map((attr) => ({
929
953
  ...attr,
930
954
  as: attr.as ?? attr.name
931
- })) ?? [],
955
+ })),
932
956
  re: pm__default.default.makeRe(component.name, { fastpaths: true })
933
- })) ?? [],
957
+ })),
934
958
  components: additionalComponents.reduce((acc, component) => {
935
959
  const { name, as, attributes, selector } = component;
936
960
  if (!name || !as || selector || attributes.length > 0) return acc;
@@ -941,13 +965,6 @@ var expandSettings = createMemoizedFunction(
941
965
  },
942
966
  { isDeepEqual: false }
943
967
  );
944
- var DEFAULT_ESLINT_REACT_SETTINGS = {
945
- additionalHooks: {
946
- useLayoutEffect: ["useIsomorphicLayoutEffect"]
947
- },
948
- polymorphicPropName: "as",
949
- version: "detect"
950
- };
951
968
 
952
969
  exports.CustomAttributeSchema = CustomAttributeSchema;
953
970
  exports.CustomComponentSchema = CustomComponentSchema;
@@ -958,6 +975,7 @@ exports.ESLintSettingsSchema = ESLintSettingsSchema;
958
975
  exports.GITHUB_URL = GITHUB_URL;
959
976
  exports.HOST_HTML_COMPONENT_TYPES = HOST_HTML_COMPONENT_TYPES;
960
977
  exports.HOST_SVG_COMPONENT_TYPES = HOST_SVG_COMPONENT_TYPES;
978
+ exports.INITIAL_ESLINT_REACT_SETTINGS = INITIAL_ESLINT_REACT_SETTINGS;
961
979
  exports.NPM_SCOPE = NPM_SCOPE;
962
980
  exports.REACT_BUILD_IN_HOOKS = REACT_BUILD_IN_HOOKS;
963
981
  exports.RE_CAMEL_CASE = RE_CAMEL_CASE;
@@ -971,3 +989,4 @@ exports.createRuleForPlugin = createRuleForPlugin;
971
989
  exports.decodeSettings = decodeSettings;
972
990
  exports.defineSettings = defineSettings;
973
991
  exports.expandSettings = expandSettings;
992
+ exports.unsafeCastSettings = unsafeCastSettings;
package/dist/index.mjs CHANGED
@@ -572,6 +572,10 @@ var ESLintReactSettingsSchema = object({
572
572
  * @internal
573
573
  */
574
574
  strict: optional(boolean()),
575
+ /**
576
+ * @internal
577
+ */
578
+ skipImportCheck: optional(boolean(), true),
575
579
  /**
576
580
  * React version to use, "detect" means auto detect React version from the project’s dependencies.
577
581
  * If `importSource` is specified, an equivalent version of React should be provided here.
@@ -906,11 +910,31 @@ function createMemoizedFunction(fn, options) {
906
910
  memoized.options = normalizedOptions;
907
911
  return memoized;
908
912
  }
913
+ var INITIAL_ESLINT_REACT_SETTINGS = {
914
+ skipImportCheck: true
915
+ };
916
+ var DEFAULT_ESLINT_REACT_SETTINGS = {
917
+ additionalHooks: {
918
+ useLayoutEffect: ["useIsomorphicLayoutEffect"]
919
+ },
920
+ polymorphicPropName: "as",
921
+ skipImportCheck: true,
922
+ version: "detect"
923
+ };
909
924
  function defineSettings(settings) {
910
925
  return parse(ESLintSettingsSchema, settings)["react-x"] ?? {};
911
926
  }
912
927
  function decodeSettings(data) {
913
- return parse(ESLintSettingsSchema, data)["react-x"] ?? {};
928
+ return {
929
+ ...INITIAL_ESLINT_REACT_SETTINGS,
930
+ ...parse(ESLintSettingsSchema, data)["react-x"] ?? {}
931
+ };
932
+ }
933
+ function unsafeCastSettings(data) {
934
+ return {
935
+ ...INITIAL_ESLINT_REACT_SETTINGS,
936
+ ...data["react-x"] ?? {}
937
+ };
914
938
  }
915
939
  var expandSettings = createMemoizedFunction(
916
940
  (settings) => {
@@ -919,12 +943,12 @@ var expandSettings = createMemoizedFunction(
919
943
  ...settings,
920
944
  additionalComponents: additionalComponents.map((component) => ({
921
945
  ...component,
922
- attributes: component.attributes?.map((attr) => ({
946
+ attributes: component.attributes.map((attr) => ({
923
947
  ...attr,
924
948
  as: attr.as ?? attr.name
925
- })) ?? [],
949
+ })),
926
950
  re: pm.makeRe(component.name, { fastpaths: true })
927
- })) ?? [],
951
+ })),
928
952
  components: additionalComponents.reduce((acc, component) => {
929
953
  const { name, as, attributes, selector } = component;
930
954
  if (!name || !as || selector || attributes.length > 0) return acc;
@@ -935,12 +959,5 @@ var expandSettings = createMemoizedFunction(
935
959
  },
936
960
  { isDeepEqual: false }
937
961
  );
938
- var DEFAULT_ESLINT_REACT_SETTINGS = {
939
- additionalHooks: {
940
- useLayoutEffect: ["useIsomorphicLayoutEffect"]
941
- },
942
- polymorphicPropName: "as",
943
- version: "detect"
944
- };
945
962
 
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 };
963
+ export { CustomAttributeSchema, CustomComponentSchema, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, ESLintReactSettingsSchema, ESLintSettingsSchema, GITHUB_URL, HOST_HTML_COMPONENT_TYPES, HOST_SVG_COMPONENT_TYPES, INITIAL_ESLINT_REACT_SETTINGS, 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, unsafeCastSettings };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/shared",
3
- "version": "1.8.3-beta.2",
3
+ "version": "1.8.3-beta.6",
4
4
  "description": "ESLint React's Shared constants and functions.",
5
5
  "homepage": "https://github.com/rel1cx/eslint-react",
6
6
  "bugs": {