@eslint-react/shared 1.8.1-next.0 → 1.8.1-next.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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +23 -15
- package/dist/index.mjs +23 -15
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1954,6 +1954,7 @@ interface CustomComponentExpanded extends CustomComponent {
|
|
|
1954
1954
|
*/
|
|
1955
1955
|
interface ESLintReactSettingsExpanded extends ESLintReactSettings {
|
|
1956
1956
|
additionalComponents: CustomComponentExpanded[];
|
|
1957
|
+
components: Map<string, string>;
|
|
1957
1958
|
}
|
|
1958
1959
|
/**
|
|
1959
1960
|
* Decodes settings from a data object from `context.settings`.
|
package/dist/index.d.ts
CHANGED
|
@@ -1954,6 +1954,7 @@ interface CustomComponentExpanded extends CustomComponent {
|
|
|
1954
1954
|
*/
|
|
1955
1955
|
interface ESLintReactSettingsExpanded extends ESLintReactSettings {
|
|
1956
1956
|
additionalComponents: CustomComponentExpanded[];
|
|
1957
|
+
components: Map<string, string>;
|
|
1957
1958
|
}
|
|
1958
1959
|
/**
|
|
1959
1960
|
* Decodes settings from a data object from `context.settings`.
|
package/dist/index.js
CHANGED
|
@@ -857,24 +857,32 @@ function createMemoizedFunction(fn, options) {
|
|
|
857
857
|
function decodeSettings(data) {
|
|
858
858
|
return parse(ESLintSettingsSchema, data)["react-x"] ?? {};
|
|
859
859
|
}
|
|
860
|
-
var expandSettings = createMemoizedFunction(
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
...
|
|
865
|
-
|
|
866
|
-
...
|
|
867
|
-
|
|
860
|
+
var expandSettings = createMemoizedFunction(
|
|
861
|
+
(settings) => {
|
|
862
|
+
const additionalComponents = settings.additionalComponents ?? [];
|
|
863
|
+
return {
|
|
864
|
+
...settings,
|
|
865
|
+
additionalComponents: additionalComponents.map((component) => ({
|
|
866
|
+
...component,
|
|
867
|
+
attributes: component.attributes?.map((attr) => ({
|
|
868
|
+
...attr,
|
|
869
|
+
as: attr.as ?? attr.name
|
|
870
|
+
})) ?? [],
|
|
871
|
+
re: pm__default.default.makeRe(component.name, { fastpaths: true })
|
|
868
872
|
})) ?? [],
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
+
components: additionalComponents.reduce((acc, component) => {
|
|
874
|
+
const { name, as, attributes, selector } = component;
|
|
875
|
+
if (!name || !as || selector || attributes.length > 0) return acc;
|
|
876
|
+
if (!/^[\w-]+$/u.test(name)) return acc;
|
|
877
|
+
return acc.set(name, as);
|
|
878
|
+
}, /* @__PURE__ */ new Map())
|
|
879
|
+
};
|
|
880
|
+
},
|
|
881
|
+
{ isDeepEqual: false }
|
|
882
|
+
);
|
|
873
883
|
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
874
884
|
additionalHooks: {
|
|
875
|
-
useLayoutEffect: [
|
|
876
|
-
"useIsomorphicLayoutEffect"
|
|
877
|
-
]
|
|
885
|
+
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
878
886
|
},
|
|
879
887
|
polymorphicPropName: "as",
|
|
880
888
|
version: "detect"
|
package/dist/index.mjs
CHANGED
|
@@ -851,24 +851,32 @@ function createMemoizedFunction(fn, options) {
|
|
|
851
851
|
function decodeSettings(data) {
|
|
852
852
|
return parse(ESLintSettingsSchema, data)["react-x"] ?? {};
|
|
853
853
|
}
|
|
854
|
-
var expandSettings = createMemoizedFunction(
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
...
|
|
859
|
-
|
|
860
|
-
...
|
|
861
|
-
|
|
854
|
+
var expandSettings = createMemoizedFunction(
|
|
855
|
+
(settings) => {
|
|
856
|
+
const additionalComponents = settings.additionalComponents ?? [];
|
|
857
|
+
return {
|
|
858
|
+
...settings,
|
|
859
|
+
additionalComponents: additionalComponents.map((component) => ({
|
|
860
|
+
...component,
|
|
861
|
+
attributes: component.attributes?.map((attr) => ({
|
|
862
|
+
...attr,
|
|
863
|
+
as: attr.as ?? attr.name
|
|
864
|
+
})) ?? [],
|
|
865
|
+
re: pm.makeRe(component.name, { fastpaths: true })
|
|
862
866
|
})) ?? [],
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
+
components: additionalComponents.reduce((acc, component) => {
|
|
868
|
+
const { name, as, attributes, selector } = component;
|
|
869
|
+
if (!name || !as || selector || attributes.length > 0) return acc;
|
|
870
|
+
if (!/^[\w-]+$/u.test(name)) return acc;
|
|
871
|
+
return acc.set(name, as);
|
|
872
|
+
}, /* @__PURE__ */ new Map())
|
|
873
|
+
};
|
|
874
|
+
},
|
|
875
|
+
{ isDeepEqual: false }
|
|
876
|
+
);
|
|
867
877
|
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
868
878
|
additionalHooks: {
|
|
869
|
-
useLayoutEffect: [
|
|
870
|
-
"useIsomorphicLayoutEffect"
|
|
871
|
-
]
|
|
879
|
+
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
872
880
|
},
|
|
873
881
|
polymorphicPropName: "as",
|
|
874
882
|
version: "detect"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "1.8.1-next.
|
|
3
|
+
"version": "1.8.1-next.2",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/picomatch": "^3.0.0",
|
|
43
43
|
"micro-memoize": "4.1.2",
|
|
44
|
-
"tsup": "8.2.
|
|
44
|
+
"tsup": "8.2.4",
|
|
45
45
|
"type-fest": "4.23.0",
|
|
46
46
|
"valibot": "0.37.0"
|
|
47
47
|
},
|