@eslint-react/shared 1.23.2 → 1.23.3-beta.5

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
@@ -1,5 +1,57 @@
1
1
  import { ESLintUtils } from '@typescript-eslint/utils';
2
- import { E } from '@eslint-react/eff';
2
+
3
+ /**
4
+ * The NPM scope for this project.
5
+ */
6
+ declare const NPM_SCOPE = "@eslint-react";
7
+ /**
8
+ * The GitHub repository for this project.
9
+ */
10
+ declare const GITHUB_URL = "https://github.com/rEl1cx/eslint-react";
11
+ /**
12
+ * The URL to the project's website.
13
+ */
14
+ declare const WEBSITE_URL = "https://eslint-react.xyz";
15
+ /**
16
+ * Regular expression for matching a PascalCase string.
17
+ */
18
+ declare const RE_PASCAL_CASE: RegExp;
19
+ /**
20
+ * Regular expression for matching a camelCase string.
21
+ */
22
+ declare const RE_CAMEL_CASE: RegExp;
23
+ /**
24
+ * Regular expression for matching a kebab-case string.
25
+ */
26
+ declare const RE_KEBAB_CASE: RegExp;
27
+ /**
28
+ * Regular expression for matching a snake_case string.
29
+ */
30
+ declare const RE_SNAKE_CASE: RegExp;
31
+ /**
32
+ * Regular expression for matching a CONSTANT_CASE string.
33
+ */
34
+ declare const RE_CONSTANT_CASE: RegExp;
35
+ declare const RE_JAVASCRIPT_PROTOCOL: RegExp;
36
+ /**
37
+ * @internal
38
+ */
39
+ declare const DOM_HTML_COMPONENT_TYPES: readonly ["aside", "audio", "b", "base", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "menu", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "slot", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr"];
40
+ /**
41
+ * @internal
42
+ */
43
+ declare const DOM_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"];
44
+ declare const REACT_BUILD_IN_HOOKS: readonly ["use", "useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useFormStatus", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition"];
45
+
46
+ /**
47
+ * Get the ESLint rule creator for a plugin.
48
+ * @internal
49
+ * @param pluginName The name of the plugin.
50
+ * @returns The ESLint rule creator.
51
+ */
52
+ declare const createRuleForPlugin: (pluginName: string) => <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
53
+
54
+ declare function getReactVersion(fallback?: string): string;
3
55
 
4
56
  /**
5
57
  * Schema with pipe type.
@@ -1869,101 +1921,6 @@ interface ESLintReactSettingsNormalized extends ESLintReactSettings {
1869
1921
  version: string;
1870
1922
  }
1871
1923
 
1872
- declare const normalizedSettingsCache: WeakMap<{
1873
- importSource?: string;
1874
- jsxPragma?: string;
1875
- jsxPragmaFrag?: string;
1876
- polymorphicPropName?: string;
1877
- strict?: boolean;
1878
- strictImportCheck?: boolean;
1879
- version?: string;
1880
- additionalComponents?: {
1881
- name: string;
1882
- as?: string;
1883
- selector?: string;
1884
- attributes?: {
1885
- name: string;
1886
- as?: string;
1887
- controlled?: boolean;
1888
- defaultValue?: string;
1889
- }[];
1890
- }[];
1891
- additionalHooks?: {
1892
- use?: string[];
1893
- useActionState?: string[];
1894
- useCallback?: string[];
1895
- useContext?: string[];
1896
- useDebugValue?: string[];
1897
- useDeferredValue?: string[];
1898
- useEffect?: string[];
1899
- useFormStatus?: string[];
1900
- useId?: string[];
1901
- useImperativeHandle?: string[];
1902
- useInsertionEffect?: string[];
1903
- useLayoutEffect?: string[];
1904
- useMemo?: string[];
1905
- useOptimistic?: string[];
1906
- useReducer?: string[];
1907
- useRef?: string[];
1908
- useState?: string[];
1909
- useSyncExternalStore?: string[];
1910
- useTransition?: string[];
1911
- };
1912
- }, ESLintReactSettingsNormalized>;
1913
-
1914
- /**
1915
- * The NPM scope for this project.
1916
- */
1917
- declare const NPM_SCOPE = "@eslint-react";
1918
- /**
1919
- * The GitHub repository for this project.
1920
- */
1921
- declare const GITHUB_URL = "https://github.com/rEl1cx/eslint-react";
1922
- /**
1923
- * The URL to the project's website.
1924
- */
1925
- declare const WEBSITE_URL = "https://eslint-react.xyz";
1926
- /**
1927
- * Regular expression for matching a PascalCase string.
1928
- */
1929
- declare const RE_PASCAL_CASE: RegExp;
1930
- /**
1931
- * Regular expression for matching a camelCase string.
1932
- */
1933
- declare const RE_CAMEL_CASE: RegExp;
1934
- /**
1935
- * Regular expression for matching a kebab-case string.
1936
- */
1937
- declare const RE_KEBAB_CASE: RegExp;
1938
- /**
1939
- * Regular expression for matching a snake_case string.
1940
- */
1941
- declare const RE_SNAKE_CASE: RegExp;
1942
- /**
1943
- * Regular expression for matching a CONSTANT_CASE string.
1944
- */
1945
- declare const RE_CONSTANT_CASE: RegExp;
1946
- declare const RE_JAVASCRIPT_PROTOCOL: RegExp;
1947
- /**
1948
- * @internal
1949
- */
1950
- declare const DOM_HTML_COMPONENT_TYPES: readonly ["aside", "audio", "b", "base", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "menu", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "slot", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr"];
1951
- /**
1952
- * @internal
1953
- */
1954
- declare const DOM_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"];
1955
- declare const REACT_BUILD_IN_HOOKS: readonly ["use", "useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useFormStatus", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition"];
1956
-
1957
- /**
1958
- * Get the ESLint rule creator for a plugin.
1959
- * @internal
1960
- * @param pluginName The name of the plugin.
1961
- * @returns The ESLint rule creator.
1962
- */
1963
- declare const createRuleForPlugin: (pluginName: string) => <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
1964
-
1965
- declare function getReactVersion(at?: string): E.Either<string, unknown>;
1966
-
1967
1924
  interface Dictionary<Type> {
1968
1925
  [key: string]: Type;
1969
1926
  [index: number]: Type;
@@ -2249,6 +2206,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
2249
2206
  }
2250
2207
  }
2251
2208
 
2252
- declare function tryRequire(id: string, at?: string): E.Either<unknown, Error>;
2253
-
2254
- export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, type CustomComponentNormalized, CustomComponentNormalizedSchema, CustomComponentSchema, type CustomHook, CustomHookSchema, 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, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, getReactVersion, getSettingsFromContext, normalizeSettings, normalizedSettingsCache, tryRequire, unsafeDecodeSettings };
2209
+ export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, type CustomComponentNormalized, CustomComponentNormalizedSchema, CustomComponentSchema, type CustomHook, CustomHookSchema, 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, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, getReactVersion, getSettingsFromContext, normalizeSettings, unsafeDecodeSettings };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,57 @@
1
1
  import { ESLintUtils } from '@typescript-eslint/utils';
2
- import { E } from '@eslint-react/eff';
2
+
3
+ /**
4
+ * The NPM scope for this project.
5
+ */
6
+ declare const NPM_SCOPE = "@eslint-react";
7
+ /**
8
+ * The GitHub repository for this project.
9
+ */
10
+ declare const GITHUB_URL = "https://github.com/rEl1cx/eslint-react";
11
+ /**
12
+ * The URL to the project's website.
13
+ */
14
+ declare const WEBSITE_URL = "https://eslint-react.xyz";
15
+ /**
16
+ * Regular expression for matching a PascalCase string.
17
+ */
18
+ declare const RE_PASCAL_CASE: RegExp;
19
+ /**
20
+ * Regular expression for matching a camelCase string.
21
+ */
22
+ declare const RE_CAMEL_CASE: RegExp;
23
+ /**
24
+ * Regular expression for matching a kebab-case string.
25
+ */
26
+ declare const RE_KEBAB_CASE: RegExp;
27
+ /**
28
+ * Regular expression for matching a snake_case string.
29
+ */
30
+ declare const RE_SNAKE_CASE: RegExp;
31
+ /**
32
+ * Regular expression for matching a CONSTANT_CASE string.
33
+ */
34
+ declare const RE_CONSTANT_CASE: RegExp;
35
+ declare const RE_JAVASCRIPT_PROTOCOL: RegExp;
36
+ /**
37
+ * @internal
38
+ */
39
+ declare const DOM_HTML_COMPONENT_TYPES: readonly ["aside", "audio", "b", "base", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "menu", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "slot", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr"];
40
+ /**
41
+ * @internal
42
+ */
43
+ declare const DOM_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"];
44
+ declare const REACT_BUILD_IN_HOOKS: readonly ["use", "useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useFormStatus", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition"];
45
+
46
+ /**
47
+ * Get the ESLint rule creator for a plugin.
48
+ * @internal
49
+ * @param pluginName The name of the plugin.
50
+ * @returns The ESLint rule creator.
51
+ */
52
+ declare const createRuleForPlugin: (pluginName: string) => <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
53
+
54
+ declare function getReactVersion(fallback?: string): string;
3
55
 
4
56
  /**
5
57
  * Schema with pipe type.
@@ -1869,101 +1921,6 @@ interface ESLintReactSettingsNormalized extends ESLintReactSettings {
1869
1921
  version: string;
1870
1922
  }
1871
1923
 
1872
- declare const normalizedSettingsCache: WeakMap<{
1873
- importSource?: string;
1874
- jsxPragma?: string;
1875
- jsxPragmaFrag?: string;
1876
- polymorphicPropName?: string;
1877
- strict?: boolean;
1878
- strictImportCheck?: boolean;
1879
- version?: string;
1880
- additionalComponents?: {
1881
- name: string;
1882
- as?: string;
1883
- selector?: string;
1884
- attributes?: {
1885
- name: string;
1886
- as?: string;
1887
- controlled?: boolean;
1888
- defaultValue?: string;
1889
- }[];
1890
- }[];
1891
- additionalHooks?: {
1892
- use?: string[];
1893
- useActionState?: string[];
1894
- useCallback?: string[];
1895
- useContext?: string[];
1896
- useDebugValue?: string[];
1897
- useDeferredValue?: string[];
1898
- useEffect?: string[];
1899
- useFormStatus?: string[];
1900
- useId?: string[];
1901
- useImperativeHandle?: string[];
1902
- useInsertionEffect?: string[];
1903
- useLayoutEffect?: string[];
1904
- useMemo?: string[];
1905
- useOptimistic?: string[];
1906
- useReducer?: string[];
1907
- useRef?: string[];
1908
- useState?: string[];
1909
- useSyncExternalStore?: string[];
1910
- useTransition?: string[];
1911
- };
1912
- }, ESLintReactSettingsNormalized>;
1913
-
1914
- /**
1915
- * The NPM scope for this project.
1916
- */
1917
- declare const NPM_SCOPE = "@eslint-react";
1918
- /**
1919
- * The GitHub repository for this project.
1920
- */
1921
- declare const GITHUB_URL = "https://github.com/rEl1cx/eslint-react";
1922
- /**
1923
- * The URL to the project's website.
1924
- */
1925
- declare const WEBSITE_URL = "https://eslint-react.xyz";
1926
- /**
1927
- * Regular expression for matching a PascalCase string.
1928
- */
1929
- declare const RE_PASCAL_CASE: RegExp;
1930
- /**
1931
- * Regular expression for matching a camelCase string.
1932
- */
1933
- declare const RE_CAMEL_CASE: RegExp;
1934
- /**
1935
- * Regular expression for matching a kebab-case string.
1936
- */
1937
- declare const RE_KEBAB_CASE: RegExp;
1938
- /**
1939
- * Regular expression for matching a snake_case string.
1940
- */
1941
- declare const RE_SNAKE_CASE: RegExp;
1942
- /**
1943
- * Regular expression for matching a CONSTANT_CASE string.
1944
- */
1945
- declare const RE_CONSTANT_CASE: RegExp;
1946
- declare const RE_JAVASCRIPT_PROTOCOL: RegExp;
1947
- /**
1948
- * @internal
1949
- */
1950
- declare const DOM_HTML_COMPONENT_TYPES: readonly ["aside", "audio", "b", "base", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "menu", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "slot", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr"];
1951
- /**
1952
- * @internal
1953
- */
1954
- declare const DOM_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"];
1955
- declare const REACT_BUILD_IN_HOOKS: readonly ["use", "useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useFormStatus", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition"];
1956
-
1957
- /**
1958
- * Get the ESLint rule creator for a plugin.
1959
- * @internal
1960
- * @param pluginName The name of the plugin.
1961
- * @returns The ESLint rule creator.
1962
- */
1963
- declare const createRuleForPlugin: (pluginName: string) => <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
1964
-
1965
- declare function getReactVersion(at?: string): E.Either<string, unknown>;
1966
-
1967
1924
  interface Dictionary<Type> {
1968
1925
  [key: string]: Type;
1969
1926
  [index: number]: Type;
@@ -2249,6 +2206,4 @@ declare module "@typescript-eslint/utils/ts-eslint" {
2249
2206
  }
2250
2207
  }
2251
2208
 
2252
- declare function tryRequire(id: string, at?: string): E.Either<unknown, Error>;
2253
-
2254
- export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, type CustomComponentNormalized, CustomComponentNormalizedSchema, CustomComponentSchema, type CustomHook, CustomHookSchema, 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, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, getReactVersion, getSettingsFromContext, normalizeSettings, normalizedSettingsCache, tryRequire, unsafeDecodeSettings };
2209
+ export { type CustomAttribute, CustomAttributeSchema, type CustomComponent, type CustomComponentNormalized, CustomComponentNormalizedSchema, CustomComponentSchema, type CustomHook, CustomHookSchema, 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, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, getReactVersion, getSettingsFromContext, normalizeSettings, unsafeDecodeSettings };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var utils = require('@typescript-eslint/utils');
4
+ var module$1 = require('module');
4
5
  var eff = require('@eslint-react/eff');
5
6
  var tsPattern = require('ts-pattern');
6
- var module$1 = require('module');
7
7
  var pm = require('picomatch');
8
8
 
9
9
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
@@ -12,9 +12,6 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
12
  var module__default = /*#__PURE__*/_interopDefault(module$1);
13
13
  var pm__default = /*#__PURE__*/_interopDefault(pm);
14
14
 
15
- // src/cache.ts
16
- var normalizedSettingsCache = /* @__PURE__ */ new WeakMap();
17
-
18
15
  // src/constants.ts
19
16
  var NPM_SCOPE = "@eslint-react";
20
17
  var GITHUB_URL = "https://github.com/rEl1cx/eslint-react";
@@ -218,29 +215,22 @@ var REACT_BUILD_IN_HOOKS = [
218
215
  "useTransition"
219
216
  ];
220
217
  var getDocsUrl = (pluginName) => (ruleName) => {
221
- if (pluginName === "x") return `${WEBSITE_URL}/docs/rules/${ruleName}`;
218
+ if (pluginName === "x") {
219
+ return `${WEBSITE_URL}/docs/rules/${ruleName}`;
220
+ }
222
221
  return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
223
222
  };
224
223
  var createRuleForPlugin = (pluginName) => utils.ESLintUtils.RuleCreator(getDocsUrl(pluginName));
225
- function tryRequire(id, at = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))) {
226
- const _require = module__default.default.createRequire(at);
224
+ var _require = module__default.default.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
225
+ function getReactVersion(fallback = "19.0.0") {
227
226
  try {
228
- return eff.E.right(_require(id));
227
+ return tsPattern.match(_require("react")).with({ version: tsPattern.P.select(tsPattern.P.string) }, eff.F.identity).otherwise(eff.F.constant(fallback));
229
228
  } catch {
230
- return eff.E.left(new Error(`Module '${id}' not found`));
229
+ return fallback;
231
230
  }
232
231
  }
233
232
 
234
- // src/get-react-version.ts
235
- function getReactVersion(at = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))) {
236
- return eff.F.pipe(
237
- tryRequire("react", at),
238
- eff.E.filterOrLeft(tsPattern.isMatching({ version: tsPattern.P.string }), eff.F.identity),
239
- eff.E.map((mod) => mod.version)
240
- );
241
- }
242
-
243
- // ../../node_modules/.pnpm/valibot@1.0.0-beta.10_typescript@5.7.2/node_modules/valibot/dist/index.js
233
+ // ../../node_modules/.pnpm/valibot@1.0.0-beta.11_typescript@5.7.3/node_modules/valibot/dist/index.js
244
234
  var store;
245
235
  // @__NO_SIDE_EFFECTS__
246
236
  function getGlobalConfig(config2) {
@@ -251,6 +241,70 @@ function getGlobalConfig(config2) {
251
241
  abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
252
242
  };
253
243
  }
244
+ var store2;
245
+ // @__NO_SIDE_EFFECTS__
246
+ function getGlobalMessage(lang) {
247
+ return store2?.get(lang);
248
+ }
249
+ var store3;
250
+ // @__NO_SIDE_EFFECTS__
251
+ function getSchemaMessage(lang) {
252
+ return store3?.get(lang);
253
+ }
254
+ var store4;
255
+ // @__NO_SIDE_EFFECTS__
256
+ function getSpecificMessage(reference, lang) {
257
+ return store4?.get(reference)?.get(lang);
258
+ }
259
+ // @__NO_SIDE_EFFECTS__
260
+ function _stringify(input) {
261
+ const type = typeof input;
262
+ if (type === "string") {
263
+ return `"${input}"`;
264
+ }
265
+ if (type === "number" || type === "bigint" || type === "boolean") {
266
+ return `${input}`;
267
+ }
268
+ if (type === "object" || type === "function") {
269
+ return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
270
+ }
271
+ return type;
272
+ }
273
+ function _addIssue(context, label, dataset, config2, other) {
274
+ const input = dataset.value;
275
+ const expected = context.expects ?? null;
276
+ const received = /* @__PURE__ */ _stringify(input);
277
+ const issue = {
278
+ kind: context.kind,
279
+ type: context.type,
280
+ input,
281
+ expected,
282
+ received,
283
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
284
+ requirement: context.requirement,
285
+ path: other?.path,
286
+ issues: other?.issues,
287
+ lang: config2.lang,
288
+ abortEarly: config2.abortEarly,
289
+ abortPipeEarly: config2.abortPipeEarly
290
+ };
291
+ const isSchema = context.kind === "schema";
292
+ const message = context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
293
+ if (message) {
294
+ issue.message = typeof message === "function" ? (
295
+ // @ts-expect-error
296
+ message(issue)
297
+ ) : message;
298
+ }
299
+ if (isSchema) {
300
+ dataset.typed = false;
301
+ }
302
+ if (dataset.issues) {
303
+ dataset.issues.push(issue);
304
+ } else {
305
+ dataset.issues = [issue];
306
+ }
307
+ }
254
308
  // @__NO_SIDE_EFFECTS__
255
309
  function _getStandardProps(context) {
256
310
  return {
@@ -333,6 +387,8 @@ function array(item, message) {
333
387
  }
334
388
  dataset.value.push(itemDataset.value);
335
389
  }
390
+ } else {
391
+ _addIssue(this, "type", dataset, config2);
336
392
  }
337
393
  return dataset;
338
394
  }
@@ -353,6 +409,8 @@ function boolean(message) {
353
409
  "~run"(dataset, config2) {
354
410
  if (typeof dataset.value === "boolean") {
355
411
  dataset.typed = true;
412
+ } else {
413
+ _addIssue(this, "type", dataset, config2);
356
414
  }
357
415
  return dataset;
358
416
  }
@@ -374,6 +432,8 @@ function instance(class_, message) {
374
432
  "~run"(dataset, config2) {
375
433
  if (dataset.value instanceof this.class) {
376
434
  dataset.typed = true;
435
+ } else {
436
+ _addIssue(this, "type", dataset, config2);
377
437
  }
378
438
  return dataset;
379
439
  }
@@ -431,6 +491,8 @@ function object(entries, message) {
431
491
  dataset.value[key] = valueDataset.value;
432
492
  }
433
493
  }
494
+ } else {
495
+ _addIssue(this, "type", dataset, config2);
434
496
  }
435
497
  return dataset;
436
498
  }
@@ -478,6 +540,8 @@ function string(message) {
478
540
  "~run"(dataset, config2) {
479
541
  if (typeof dataset.value === "string") {
480
542
  dataset.typed = true;
543
+ } else {
544
+ _addIssue(this, "type", dataset, config2);
481
545
  }
482
546
  return dataset;
483
547
  }
@@ -639,7 +703,7 @@ var ESLintSettingsSchema = optional(
639
703
  {}
640
704
  );
641
705
 
642
- // ../../node_modules/.pnpm/fast-equals@5.2.0/node_modules/fast-equals/dist/esm/index.mjs
706
+ // ../../node_modules/.pnpm/fast-equals@5.2.2/node_modules/fast-equals/dist/esm/index.mjs
643
707
  var getOwnPropertyNames = Object.getOwnPropertyNames;
644
708
  var getOwnPropertySymbols = Object.getOwnPropertySymbols;
645
709
  var hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -1363,11 +1427,15 @@ var normalizeSettings = createMemoizedFunction((settings) => {
1363
1427
  })),
1364
1428
  components: additionalComponents.reduce((acc, component) => {
1365
1429
  const { name, as, attributes = [], selector } = component;
1366
- if (!name || !as || selector || attributes.length > 0) return acc;
1367
- if (!/^[\w-]+$/u.test(name)) return acc;
1430
+ if (!name || !as || selector || attributes.length > 0) {
1431
+ return acc;
1432
+ }
1433
+ if (!/^[\w-]+$/u.test(name)) {
1434
+ return acc;
1435
+ }
1368
1436
  return acc.set(name, as);
1369
1437
  }, /* @__PURE__ */ new Map()),
1370
- version: tsPattern.match(settings.version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () => eff.E.getOrElse(getReactVersion(), eff.F.constant("19.0.0"))).otherwise(eff.F.identity)
1438
+ version: tsPattern.match(settings.version).with(tsPattern.P.union(tsPattern.P.nullish, "", "detect"), () => getReactVersion("19.0.0")).otherwise(eff.F.identity)
1371
1439
  };
1372
1440
  }, { isEqual: shallowEqual });
1373
1441
  function getSettingsFromContext(context) {
@@ -1400,6 +1468,4 @@ exports.defineSettings = defineSettings;
1400
1468
  exports.getReactVersion = getReactVersion;
1401
1469
  exports.getSettingsFromContext = getSettingsFromContext;
1402
1470
  exports.normalizeSettings = normalizeSettings;
1403
- exports.normalizedSettingsCache = normalizedSettingsCache;
1404
- exports.tryRequire = tryRequire;
1405
1471
  exports.unsafeDecodeSettings = unsafeDecodeSettings;
package/dist/index.mjs CHANGED
@@ -1,12 +1,9 @@
1
1
  import { ESLintUtils } from '@typescript-eslint/utils';
2
- import { F, E } from '@eslint-react/eff';
3
- import { isMatching, P, match } from 'ts-pattern';
4
2
  import module from 'node:module';
3
+ import { F } from '@eslint-react/eff';
4
+ import { match, P } from 'ts-pattern';
5
5
  import pm from 'picomatch';
6
6
 
7
- // src/cache.ts
8
- var normalizedSettingsCache = /* @__PURE__ */ new WeakMap();
9
-
10
7
  // src/constants.ts
11
8
  var NPM_SCOPE = "@eslint-react";
12
9
  var GITHUB_URL = "https://github.com/rEl1cx/eslint-react";
@@ -210,29 +207,22 @@ var REACT_BUILD_IN_HOOKS = [
210
207
  "useTransition"
211
208
  ];
212
209
  var getDocsUrl = (pluginName) => (ruleName) => {
213
- if (pluginName === "x") return `${WEBSITE_URL}/docs/rules/${ruleName}`;
210
+ if (pluginName === "x") {
211
+ return `${WEBSITE_URL}/docs/rules/${ruleName}`;
212
+ }
214
213
  return `${WEBSITE_URL}/docs/rules/${pluginName}-${ruleName}`;
215
214
  };
216
215
  var createRuleForPlugin = (pluginName) => ESLintUtils.RuleCreator(getDocsUrl(pluginName));
217
- function tryRequire(id, at = import.meta.url) {
218
- const _require = module.createRequire(at);
216
+ var _require = module.createRequire(import.meta.url);
217
+ function getReactVersion(fallback = "19.0.0") {
219
218
  try {
220
- return E.right(_require(id));
219
+ return match(_require("react")).with({ version: P.select(P.string) }, F.identity).otherwise(F.constant(fallback));
221
220
  } catch {
222
- return E.left(new Error(`Module '${id}' not found`));
221
+ return fallback;
223
222
  }
224
223
  }
225
224
 
226
- // src/get-react-version.ts
227
- function getReactVersion(at = import.meta.url) {
228
- return F.pipe(
229
- tryRequire("react", at),
230
- E.filterOrLeft(isMatching({ version: P.string }), F.identity),
231
- E.map((mod) => mod.version)
232
- );
233
- }
234
-
235
- // ../../node_modules/.pnpm/valibot@1.0.0-beta.10_typescript@5.7.2/node_modules/valibot/dist/index.js
225
+ // ../../node_modules/.pnpm/valibot@1.0.0-beta.11_typescript@5.7.3/node_modules/valibot/dist/index.js
236
226
  var store;
237
227
  // @__NO_SIDE_EFFECTS__
238
228
  function getGlobalConfig(config2) {
@@ -243,6 +233,70 @@ function getGlobalConfig(config2) {
243
233
  abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
244
234
  };
245
235
  }
236
+ var store2;
237
+ // @__NO_SIDE_EFFECTS__
238
+ function getGlobalMessage(lang) {
239
+ return store2?.get(lang);
240
+ }
241
+ var store3;
242
+ // @__NO_SIDE_EFFECTS__
243
+ function getSchemaMessage(lang) {
244
+ return store3?.get(lang);
245
+ }
246
+ var store4;
247
+ // @__NO_SIDE_EFFECTS__
248
+ function getSpecificMessage(reference, lang) {
249
+ return store4?.get(reference)?.get(lang);
250
+ }
251
+ // @__NO_SIDE_EFFECTS__
252
+ function _stringify(input) {
253
+ const type = typeof input;
254
+ if (type === "string") {
255
+ return `"${input}"`;
256
+ }
257
+ if (type === "number" || type === "bigint" || type === "boolean") {
258
+ return `${input}`;
259
+ }
260
+ if (type === "object" || type === "function") {
261
+ return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
262
+ }
263
+ return type;
264
+ }
265
+ function _addIssue(context, label, dataset, config2, other) {
266
+ const input = dataset.value;
267
+ const expected = context.expects ?? null;
268
+ const received = /* @__PURE__ */ _stringify(input);
269
+ const issue = {
270
+ kind: context.kind,
271
+ type: context.type,
272
+ input,
273
+ expected,
274
+ received,
275
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
276
+ requirement: context.requirement,
277
+ path: other?.path,
278
+ issues: other?.issues,
279
+ lang: config2.lang,
280
+ abortEarly: config2.abortEarly,
281
+ abortPipeEarly: config2.abortPipeEarly
282
+ };
283
+ const isSchema = context.kind === "schema";
284
+ const message = context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
285
+ if (message) {
286
+ issue.message = typeof message === "function" ? (
287
+ // @ts-expect-error
288
+ message(issue)
289
+ ) : message;
290
+ }
291
+ if (isSchema) {
292
+ dataset.typed = false;
293
+ }
294
+ if (dataset.issues) {
295
+ dataset.issues.push(issue);
296
+ } else {
297
+ dataset.issues = [issue];
298
+ }
299
+ }
246
300
  // @__NO_SIDE_EFFECTS__
247
301
  function _getStandardProps(context) {
248
302
  return {
@@ -325,6 +379,8 @@ function array(item, message) {
325
379
  }
326
380
  dataset.value.push(itemDataset.value);
327
381
  }
382
+ } else {
383
+ _addIssue(this, "type", dataset, config2);
328
384
  }
329
385
  return dataset;
330
386
  }
@@ -345,6 +401,8 @@ function boolean(message) {
345
401
  "~run"(dataset, config2) {
346
402
  if (typeof dataset.value === "boolean") {
347
403
  dataset.typed = true;
404
+ } else {
405
+ _addIssue(this, "type", dataset, config2);
348
406
  }
349
407
  return dataset;
350
408
  }
@@ -366,6 +424,8 @@ function instance(class_, message) {
366
424
  "~run"(dataset, config2) {
367
425
  if (dataset.value instanceof this.class) {
368
426
  dataset.typed = true;
427
+ } else {
428
+ _addIssue(this, "type", dataset, config2);
369
429
  }
370
430
  return dataset;
371
431
  }
@@ -423,6 +483,8 @@ function object(entries, message) {
423
483
  dataset.value[key] = valueDataset.value;
424
484
  }
425
485
  }
486
+ } else {
487
+ _addIssue(this, "type", dataset, config2);
426
488
  }
427
489
  return dataset;
428
490
  }
@@ -470,6 +532,8 @@ function string(message) {
470
532
  "~run"(dataset, config2) {
471
533
  if (typeof dataset.value === "string") {
472
534
  dataset.typed = true;
535
+ } else {
536
+ _addIssue(this, "type", dataset, config2);
473
537
  }
474
538
  return dataset;
475
539
  }
@@ -631,7 +695,7 @@ var ESLintSettingsSchema = optional(
631
695
  {}
632
696
  );
633
697
 
634
- // ../../node_modules/.pnpm/fast-equals@5.2.0/node_modules/fast-equals/dist/esm/index.mjs
698
+ // ../../node_modules/.pnpm/fast-equals@5.2.2/node_modules/fast-equals/dist/esm/index.mjs
635
699
  var getOwnPropertyNames = Object.getOwnPropertyNames;
636
700
  var getOwnPropertySymbols = Object.getOwnPropertySymbols;
637
701
  var hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -1355,11 +1419,15 @@ var normalizeSettings = createMemoizedFunction((settings) => {
1355
1419
  })),
1356
1420
  components: additionalComponents.reduce((acc, component) => {
1357
1421
  const { name, as, attributes = [], selector } = component;
1358
- if (!name || !as || selector || attributes.length > 0) return acc;
1359
- if (!/^[\w-]+$/u.test(name)) return acc;
1422
+ if (!name || !as || selector || attributes.length > 0) {
1423
+ return acc;
1424
+ }
1425
+ if (!/^[\w-]+$/u.test(name)) {
1426
+ return acc;
1427
+ }
1360
1428
  return acc.set(name, as);
1361
1429
  }, /* @__PURE__ */ new Map()),
1362
- version: match(settings.version).with(P.union(P.nullish, "", "detect"), () => E.getOrElse(getReactVersion(), F.constant("19.0.0"))).otherwise(F.identity)
1430
+ version: match(settings.version).with(P.union(P.nullish, "", "detect"), () => getReactVersion("19.0.0")).otherwise(F.identity)
1363
1431
  };
1364
1432
  }, { isEqual: shallowEqual });
1365
1433
  function getSettingsFromContext(context) {
@@ -1367,4 +1435,4 @@ function getSettingsFromContext(context) {
1367
1435
  }
1368
1436
  var defineSettings = F.identity;
1369
1437
 
1370
- export { CustomAttributeSchema, CustomComponentNormalizedSchema, CustomComponentSchema, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, DOM_HTML_COMPONENT_TYPES, DOM_SVG_COMPONENT_TYPES, ESLintReactSettingsSchema, 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, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, getReactVersion, getSettingsFromContext, normalizeSettings, normalizedSettingsCache, tryRequire, unsafeDecodeSettings };
1438
+ export { CustomAttributeSchema, CustomComponentNormalizedSchema, CustomComponentSchema, CustomHookSchema, DEFAULT_ESLINT_REACT_SETTINGS, DOM_HTML_COMPONENT_TYPES, DOM_SVG_COMPONENT_TYPES, ESLintReactSettingsSchema, 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, WEBSITE_URL, createRuleForPlugin, decodeSettings, defineSettings, getReactVersion, getSettingsFromContext, normalizeSettings, unsafeDecodeSettings };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/shared",
3
- "version": "1.23.2",
3
+ "version": "1.23.3-beta.5",
4
4
  "description": "ESLint React's Shared constants and functions.",
5
5
  "homepage": "https://github.com/rEl1cx/eslint-react",
6
6
  "bugs": {
@@ -36,15 +36,15 @@
36
36
  "@typescript-eslint/utils": "^8.19.1",
37
37
  "picomatch": "^4.0.2",
38
38
  "ts-pattern": "^5.6.0",
39
- "@eslint-react/eff": "1.23.2"
39
+ "@eslint-react/eff": "1.23.3-beta.5"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/picomatch": "^3.0.1",
43
- "fast-equals": "^5.2.0",
43
+ "fast-equals": "^5.2.2",
44
44
  "micro-memoize": "^4.1.3",
45
45
  "tsup": "^8.3.5",
46
46
  "type-fest": "^4.31.0",
47
- "valibot": "^1.0.0-beta.10",
47
+ "valibot": "^1.0.0-beta.11",
48
48
  "@workspace/configs": "0.0.0"
49
49
  },
50
50
  "engines": {