eslint-plugin-react-x 1.24.0-beta.5 → 1.24.0-beta.8
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 +10 -10
- package/dist/index.mjs +10 -10
- package/package.json +12 -12
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-beta.
|
|
45
|
+
var version = "1.24.0-beta.8";
|
|
46
46
|
var createRule = shared.createRuleForPlugin("x");
|
|
47
47
|
|
|
48
48
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -72,7 +72,7 @@ var avoid_shorthand_boolean_default = createRule({
|
|
|
72
72
|
messageId: "avoidShorthandBoolean",
|
|
73
73
|
node,
|
|
74
74
|
data: {
|
|
75
|
-
propName: JSX7__namespace.
|
|
75
|
+
propName: JSX7__namespace.getAttributeName(node)
|
|
76
76
|
},
|
|
77
77
|
fix: (fixer) => fixer.insertTextAfter(node.name, `={true}`)
|
|
78
78
|
});
|
|
@@ -610,15 +610,15 @@ var no_children_prop_default = createRule({
|
|
|
610
610
|
create(context) {
|
|
611
611
|
return {
|
|
612
612
|
JSXElement(node) {
|
|
613
|
-
const
|
|
613
|
+
const attribute = JSX7__namespace.getAttributeNode(
|
|
614
614
|
"children",
|
|
615
615
|
context.sourceCode.getScope(node),
|
|
616
616
|
node.openingElement.attributes
|
|
617
617
|
);
|
|
618
|
-
if (
|
|
618
|
+
if (attribute != null) {
|
|
619
619
|
context.report({
|
|
620
620
|
messageId: "noChildrenProp",
|
|
621
|
-
node:
|
|
621
|
+
node: attribute
|
|
622
622
|
});
|
|
623
623
|
}
|
|
624
624
|
}
|
|
@@ -1444,7 +1444,7 @@ var no_implicit_key_default = createRule({
|
|
|
1444
1444
|
return {
|
|
1445
1445
|
JSXOpeningElement(node) {
|
|
1446
1446
|
const initialScope = context.sourceCode.getScope(node);
|
|
1447
|
-
const keyPropFound = JSX7__namespace.
|
|
1447
|
+
const keyPropFound = JSX7__namespace.getAttributeNode("key", initialScope, node.attributes);
|
|
1448
1448
|
const keyPropOnElement = node.attributes.some(
|
|
1449
1449
|
(n) => n.type === types.AST_NODE_TYPES.JSXAttribute && n.name.type === types.AST_NODE_TYPES.JSXIdentifier && n.name.name === "key"
|
|
1450
1450
|
);
|
|
@@ -1708,7 +1708,7 @@ var no_missing_key_default = createRule({
|
|
|
1708
1708
|
switch (node.type) {
|
|
1709
1709
|
case types.AST_NODE_TYPES.JSXElement: {
|
|
1710
1710
|
const initialScope = context.sourceCode.getScope(node);
|
|
1711
|
-
if (!JSX7__namespace.
|
|
1711
|
+
if (!JSX7__namespace.hasAttribute("key", initialScope, node.openingElement.attributes)) {
|
|
1712
1712
|
return {
|
|
1713
1713
|
messageId: "noMissingKey",
|
|
1714
1714
|
node
|
|
@@ -1769,7 +1769,7 @@ var no_missing_key_default = createRule({
|
|
|
1769
1769
|
}
|
|
1770
1770
|
const initialScope = context.sourceCode.getScope(node);
|
|
1771
1771
|
for (const element of elements) {
|
|
1772
|
-
if (!JSX7__namespace.
|
|
1772
|
+
if (!JSX7__namespace.hasAttribute("key", initialScope, element.openingElement.attributes)) {
|
|
1773
1773
|
context.report({
|
|
1774
1774
|
messageId: "noMissingKey",
|
|
1775
1775
|
node: element
|
|
@@ -1871,7 +1871,7 @@ var no_nested_components_default = createRule({
|
|
|
1871
1871
|
continue;
|
|
1872
1872
|
}
|
|
1873
1873
|
const isInsideProperty = component.parent.type === types.AST_NODE_TYPES.Property;
|
|
1874
|
-
const isInsideJSXPropValue = component.parent.type === types.AST_NODE_TYPES.JSXAttribute || JSX7__namespace.
|
|
1874
|
+
const isInsideJSXPropValue = component.parent.type === types.AST_NODE_TYPES.JSXAttribute || JSX7__namespace.findParentAttributeNode(node, (n) => n.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer) != null;
|
|
1875
1875
|
if (isInsideJSXPropValue) {
|
|
1876
1876
|
if (!core.isDeclaredInRenderPropLoose(component)) {
|
|
1877
1877
|
context.report({
|
|
@@ -3128,7 +3128,7 @@ var prefer_shorthand_boolean_default = createRule({
|
|
|
3128
3128
|
return {
|
|
3129
3129
|
JSXAttribute(node) {
|
|
3130
3130
|
const { value } = node;
|
|
3131
|
-
const propName = JSX7__namespace.
|
|
3131
|
+
const propName = JSX7__namespace.getAttributeName(node);
|
|
3132
3132
|
const hasValueTrue = value?.type === types.AST_NODE_TYPES.JSXExpressionContainer && value.expression.type === types.AST_NODE_TYPES.Literal && value.expression.value === true;
|
|
3133
3133
|
if (!hasValueTrue) {
|
|
3134
3134
|
return;
|
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-beta.
|
|
18
|
+
var version = "1.24.0-beta.8";
|
|
19
19
|
var createRule = createRuleForPlugin("x");
|
|
20
20
|
|
|
21
21
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -45,7 +45,7 @@ var avoid_shorthand_boolean_default = createRule({
|
|
|
45
45
|
messageId: "avoidShorthandBoolean",
|
|
46
46
|
node,
|
|
47
47
|
data: {
|
|
48
|
-
propName: JSX7.
|
|
48
|
+
propName: JSX7.getAttributeName(node)
|
|
49
49
|
},
|
|
50
50
|
fix: (fixer) => fixer.insertTextAfter(node.name, `={true}`)
|
|
51
51
|
});
|
|
@@ -583,15 +583,15 @@ var no_children_prop_default = createRule({
|
|
|
583
583
|
create(context) {
|
|
584
584
|
return {
|
|
585
585
|
JSXElement(node) {
|
|
586
|
-
const
|
|
586
|
+
const attribute = JSX7.getAttributeNode(
|
|
587
587
|
"children",
|
|
588
588
|
context.sourceCode.getScope(node),
|
|
589
589
|
node.openingElement.attributes
|
|
590
590
|
);
|
|
591
|
-
if (
|
|
591
|
+
if (attribute != null) {
|
|
592
592
|
context.report({
|
|
593
593
|
messageId: "noChildrenProp",
|
|
594
|
-
node:
|
|
594
|
+
node: attribute
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
597
|
}
|
|
@@ -1417,7 +1417,7 @@ var no_implicit_key_default = createRule({
|
|
|
1417
1417
|
return {
|
|
1418
1418
|
JSXOpeningElement(node) {
|
|
1419
1419
|
const initialScope = context.sourceCode.getScope(node);
|
|
1420
|
-
const keyPropFound = JSX7.
|
|
1420
|
+
const keyPropFound = JSX7.getAttributeNode("key", initialScope, node.attributes);
|
|
1421
1421
|
const keyPropOnElement = node.attributes.some(
|
|
1422
1422
|
(n) => n.type === AST_NODE_TYPES.JSXAttribute && n.name.type === AST_NODE_TYPES.JSXIdentifier && n.name.name === "key"
|
|
1423
1423
|
);
|
|
@@ -1681,7 +1681,7 @@ var no_missing_key_default = createRule({
|
|
|
1681
1681
|
switch (node.type) {
|
|
1682
1682
|
case AST_NODE_TYPES.JSXElement: {
|
|
1683
1683
|
const initialScope = context.sourceCode.getScope(node);
|
|
1684
|
-
if (!JSX7.
|
|
1684
|
+
if (!JSX7.hasAttribute("key", initialScope, node.openingElement.attributes)) {
|
|
1685
1685
|
return {
|
|
1686
1686
|
messageId: "noMissingKey",
|
|
1687
1687
|
node
|
|
@@ -1742,7 +1742,7 @@ var no_missing_key_default = createRule({
|
|
|
1742
1742
|
}
|
|
1743
1743
|
const initialScope = context.sourceCode.getScope(node);
|
|
1744
1744
|
for (const element of elements) {
|
|
1745
|
-
if (!JSX7.
|
|
1745
|
+
if (!JSX7.hasAttribute("key", initialScope, element.openingElement.attributes)) {
|
|
1746
1746
|
context.report({
|
|
1747
1747
|
messageId: "noMissingKey",
|
|
1748
1748
|
node: element
|
|
@@ -1844,7 +1844,7 @@ var no_nested_components_default = createRule({
|
|
|
1844
1844
|
continue;
|
|
1845
1845
|
}
|
|
1846
1846
|
const isInsideProperty = component.parent.type === AST_NODE_TYPES.Property;
|
|
1847
|
-
const isInsideJSXPropValue = component.parent.type === AST_NODE_TYPES.JSXAttribute || JSX7.
|
|
1847
|
+
const isInsideJSXPropValue = component.parent.type === AST_NODE_TYPES.JSXAttribute || JSX7.findParentAttributeNode(node, (n) => n.value?.type === AST_NODE_TYPES.JSXExpressionContainer) != null;
|
|
1848
1848
|
if (isInsideJSXPropValue) {
|
|
1849
1849
|
if (!isDeclaredInRenderPropLoose(component)) {
|
|
1850
1850
|
context.report({
|
|
@@ -3101,7 +3101,7 @@ var prefer_shorthand_boolean_default = createRule({
|
|
|
3101
3101
|
return {
|
|
3102
3102
|
JSXAttribute(node) {
|
|
3103
3103
|
const { value } = node;
|
|
3104
|
-
const propName = JSX7.
|
|
3104
|
+
const propName = JSX7.getAttributeName(node);
|
|
3105
3105
|
const hasValueTrue = value?.type === AST_NODE_TYPES.JSXExpressionContainer && value.expression.type === AST_NODE_TYPES.Literal && value.expression.value === true;
|
|
3106
3106
|
if (!hasValueTrue) {
|
|
3107
3107
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.24.0-beta.
|
|
3
|
+
"version": "1.24.0-beta.8",
|
|
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",
|
|
@@ -40,23 +40,23 @@
|
|
|
40
40
|
"./package.json"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
44
|
-
"@typescript-eslint/type-utils": "^8.
|
|
45
|
-
"@typescript-eslint/types": "^8.
|
|
46
|
-
"@typescript-eslint/utils": "^8.
|
|
43
|
+
"@typescript-eslint/scope-manager": "^8.20.0",
|
|
44
|
+
"@typescript-eslint/type-utils": "^8.20.0",
|
|
45
|
+
"@typescript-eslint/types": "^8.20.0",
|
|
46
|
+
"@typescript-eslint/utils": "^8.20.0",
|
|
47
47
|
"compare-versions": "^6.1.1",
|
|
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/
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/eff": "1.24.0-beta.
|
|
54
|
-
"@eslint-react/shared": "1.24.0-beta.
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
51
|
+
"@eslint-react/ast": "1.24.0-beta.8",
|
|
52
|
+
"@eslint-react/core": "1.24.0-beta.8",
|
|
53
|
+
"@eslint-react/eff": "1.24.0-beta.8",
|
|
54
|
+
"@eslint-react/shared": "1.24.0-beta.8",
|
|
55
|
+
"@eslint-react/jsx": "1.24.0-beta.8",
|
|
56
|
+
"@eslint-react/var": "1.24.0-beta.8"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/react": "^19.0.
|
|
59
|
+
"@types/react": "^19.0.7",
|
|
60
60
|
"@types/react-dom": "^19.0.3",
|
|
61
61
|
"ts-api-utils": "^2.0.0",
|
|
62
62
|
"tsup": "^8.3.5",
|