eslint-plugin-react-x 1.24.0-next.11 → 1.24.0-next.13
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.js +8 -8
- package/dist/index.mjs +8 -8
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ var ts__default = /*#__PURE__*/_interopDefault(ts);
|
|
|
42
42
|
|
|
43
43
|
// package.json
|
|
44
44
|
var name = "eslint-plugin-react-x";
|
|
45
|
-
var version = "1.24.0-next.
|
|
45
|
+
var version = "1.24.0-next.13";
|
|
46
46
|
var createRule = shared.createRuleForPlugin("x");
|
|
47
47
|
|
|
48
48
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -610,7 +610,7 @@ var no_children_prop_default = createRule({
|
|
|
610
610
|
create(context) {
|
|
611
611
|
return {
|
|
612
612
|
JSXElement(node) {
|
|
613
|
-
const attribute = JSX7__namespace.
|
|
613
|
+
const attribute = JSX7__namespace.getAttribute(
|
|
614
614
|
"children",
|
|
615
615
|
context.sourceCode.getScope(node),
|
|
616
616
|
node.openingElement.attributes
|
|
@@ -1012,7 +1012,7 @@ var no_context_provider_default = createRule({
|
|
|
1012
1012
|
}
|
|
1013
1013
|
return {
|
|
1014
1014
|
JSXElement(node) {
|
|
1015
|
-
const elementName = JSX7__namespace.getElementName(node
|
|
1015
|
+
const elementName = JSX7__namespace.getElementName(node);
|
|
1016
1016
|
if (!elementName.endsWith(".Provider")) {
|
|
1017
1017
|
return;
|
|
1018
1018
|
}
|
|
@@ -1438,7 +1438,7 @@ var no_implicit_key_default = createRule({
|
|
|
1438
1438
|
return {
|
|
1439
1439
|
JSXOpeningElement(node) {
|
|
1440
1440
|
const initialScope = context.sourceCode.getScope(node);
|
|
1441
|
-
const keyPropFound = JSX7__namespace.
|
|
1441
|
+
const keyPropFound = JSX7__namespace.getAttribute("key", initialScope, node.attributes);
|
|
1442
1442
|
const keyPropOnElement = node.attributes.some(
|
|
1443
1443
|
(n) => n.type === types.AST_NODE_TYPES.JSXAttribute && n.name.type === types.AST_NODE_TYPES.JSXIdentifier && n.name.name === "key"
|
|
1444
1444
|
);
|
|
@@ -1583,7 +1583,7 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1583
1583
|
return getReportDescriptor(right);
|
|
1584
1584
|
}
|
|
1585
1585
|
const initialScope = context.sourceCode.getScope(left);
|
|
1586
|
-
const isLeftNan = left.type === types.AST_NODE_TYPES.Identifier && left.name === "NaN" || VAR__namespace.
|
|
1586
|
+
const isLeftNan = left.type === types.AST_NODE_TYPES.Identifier && left.name === "NaN" || VAR__namespace.toStaticValue({ kind: "lazy", node: left, initialScope }).value === "NaN";
|
|
1587
1587
|
if (isLeftNan) {
|
|
1588
1588
|
return {
|
|
1589
1589
|
messageId: "noLeakedConditionalRendering",
|
|
@@ -1865,7 +1865,7 @@ var no_nested_components_default = createRule({
|
|
|
1865
1865
|
continue;
|
|
1866
1866
|
}
|
|
1867
1867
|
const isInsideProperty = component.parent.type === types.AST_NODE_TYPES.Property;
|
|
1868
|
-
const isInsideJSXPropValue = component.parent.type === types.AST_NODE_TYPES.JSXAttribute || JSX7__namespace.
|
|
1868
|
+
const isInsideJSXPropValue = component.parent.type === types.AST_NODE_TYPES.JSXAttribute || JSX7__namespace.findParentAttribute(node, (n) => n.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer) != null;
|
|
1869
1869
|
if (isInsideJSXPropValue) {
|
|
1870
1870
|
if (!core.isDeclaredInRenderPropLoose(component)) {
|
|
1871
1871
|
context.report({
|
|
@@ -2893,7 +2893,7 @@ var no_useless_fragment_default = createRule({
|
|
|
2893
2893
|
const { allowExpressions = true } = option;
|
|
2894
2894
|
return {
|
|
2895
2895
|
JSXElement(node) {
|
|
2896
|
-
if (JSX7__namespace.getElementName(node
|
|
2896
|
+
if (JSX7__namespace.getElementName(node).split(".").at(-1) !== "Fragment") {
|
|
2897
2897
|
return;
|
|
2898
2898
|
}
|
|
2899
2899
|
checkAndReport(node, context, allowExpressions);
|
|
@@ -3153,7 +3153,7 @@ var prefer_shorthand_fragment_default = createRule({
|
|
|
3153
3153
|
create(context) {
|
|
3154
3154
|
return {
|
|
3155
3155
|
JSXElement(node) {
|
|
3156
|
-
if (JSX7__namespace.getElementName(node
|
|
3156
|
+
if (JSX7__namespace.getElementName(node).split(".").at(-1) !== "Fragment") {
|
|
3157
3157
|
return;
|
|
3158
3158
|
}
|
|
3159
3159
|
const hasAttributes = node.openingElement.attributes.length > 0;
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import { getTypeImmutability, isUnknown, isImmutable, isReadonlyShallow, isReado
|
|
|
15
15
|
|
|
16
16
|
// package.json
|
|
17
17
|
var name = "eslint-plugin-react-x";
|
|
18
|
-
var version = "1.24.0-next.
|
|
18
|
+
var version = "1.24.0-next.13";
|
|
19
19
|
var createRule = createRuleForPlugin("x");
|
|
20
20
|
|
|
21
21
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -583,7 +583,7 @@ var no_children_prop_default = createRule({
|
|
|
583
583
|
create(context) {
|
|
584
584
|
return {
|
|
585
585
|
JSXElement(node) {
|
|
586
|
-
const attribute = JSX7.
|
|
586
|
+
const attribute = JSX7.getAttribute(
|
|
587
587
|
"children",
|
|
588
588
|
context.sourceCode.getScope(node),
|
|
589
589
|
node.openingElement.attributes
|
|
@@ -985,7 +985,7 @@ var no_context_provider_default = createRule({
|
|
|
985
985
|
}
|
|
986
986
|
return {
|
|
987
987
|
JSXElement(node) {
|
|
988
|
-
const elementName = JSX7.getElementName(node
|
|
988
|
+
const elementName = JSX7.getElementName(node);
|
|
989
989
|
if (!elementName.endsWith(".Provider")) {
|
|
990
990
|
return;
|
|
991
991
|
}
|
|
@@ -1411,7 +1411,7 @@ var no_implicit_key_default = createRule({
|
|
|
1411
1411
|
return {
|
|
1412
1412
|
JSXOpeningElement(node) {
|
|
1413
1413
|
const initialScope = context.sourceCode.getScope(node);
|
|
1414
|
-
const keyPropFound = JSX7.
|
|
1414
|
+
const keyPropFound = JSX7.getAttribute("key", initialScope, node.attributes);
|
|
1415
1415
|
const keyPropOnElement = node.attributes.some(
|
|
1416
1416
|
(n) => n.type === AST_NODE_TYPES.JSXAttribute && n.name.type === AST_NODE_TYPES.JSXIdentifier && n.name.name === "key"
|
|
1417
1417
|
);
|
|
@@ -1556,7 +1556,7 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1556
1556
|
return getReportDescriptor(right);
|
|
1557
1557
|
}
|
|
1558
1558
|
const initialScope = context.sourceCode.getScope(left);
|
|
1559
|
-
const isLeftNan = left.type === AST_NODE_TYPES.Identifier && left.name === "NaN" || VAR.
|
|
1559
|
+
const isLeftNan = left.type === AST_NODE_TYPES.Identifier && left.name === "NaN" || VAR.toStaticValue({ kind: "lazy", node: left, initialScope }).value === "NaN";
|
|
1560
1560
|
if (isLeftNan) {
|
|
1561
1561
|
return {
|
|
1562
1562
|
messageId: "noLeakedConditionalRendering",
|
|
@@ -1838,7 +1838,7 @@ var no_nested_components_default = createRule({
|
|
|
1838
1838
|
continue;
|
|
1839
1839
|
}
|
|
1840
1840
|
const isInsideProperty = component.parent.type === AST_NODE_TYPES.Property;
|
|
1841
|
-
const isInsideJSXPropValue = component.parent.type === AST_NODE_TYPES.JSXAttribute || JSX7.
|
|
1841
|
+
const isInsideJSXPropValue = component.parent.type === AST_NODE_TYPES.JSXAttribute || JSX7.findParentAttribute(node, (n) => n.value?.type === AST_NODE_TYPES.JSXExpressionContainer) != null;
|
|
1842
1842
|
if (isInsideJSXPropValue) {
|
|
1843
1843
|
if (!isDeclaredInRenderPropLoose(component)) {
|
|
1844
1844
|
context.report({
|
|
@@ -2866,7 +2866,7 @@ var no_useless_fragment_default = createRule({
|
|
|
2866
2866
|
const { allowExpressions = true } = option;
|
|
2867
2867
|
return {
|
|
2868
2868
|
JSXElement(node) {
|
|
2869
|
-
if (JSX7.getElementName(node
|
|
2869
|
+
if (JSX7.getElementName(node).split(".").at(-1) !== "Fragment") {
|
|
2870
2870
|
return;
|
|
2871
2871
|
}
|
|
2872
2872
|
checkAndReport(node, context, allowExpressions);
|
|
@@ -3126,7 +3126,7 @@ var prefer_shorthand_fragment_default = createRule({
|
|
|
3126
3126
|
create(context) {
|
|
3127
3127
|
return {
|
|
3128
3128
|
JSXElement(node) {
|
|
3129
|
-
if (JSX7.getElementName(node
|
|
3129
|
+
if (JSX7.getElementName(node).split(".").at(-1) !== "Fragment") {
|
|
3130
3130
|
return;
|
|
3131
3131
|
}
|
|
3132
3132
|
const hasAttributes = node.openingElement.attributes.length > 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.24.0-next.
|
|
3
|
+
"version": "1.24.0-next.13",
|
|
4
4
|
"description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"is-immutable-type": "^5.0.1",
|
|
49
49
|
"string-ts": "^2.2.0",
|
|
50
50
|
"ts-pattern": "^5.6.0",
|
|
51
|
-
"@eslint-react/ast": "1.24.0-next.
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/shared": "1.24.0-next.
|
|
56
|
-
"@eslint-react/var": "1.24.0-next.
|
|
51
|
+
"@eslint-react/ast": "1.24.0-next.13",
|
|
52
|
+
"@eslint-react/core": "1.24.0-next.13",
|
|
53
|
+
"@eslint-react/eff": "1.24.0-next.13",
|
|
54
|
+
"@eslint-react/jsx": "1.24.0-next.13",
|
|
55
|
+
"@eslint-react/shared": "1.24.0-next.13",
|
|
56
|
+
"@eslint-react/var": "1.24.0-next.13"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/react": "^19.0.7",
|