eslint-plugin-react-jsx 5.20.2 → 5.20.4
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 +31 -31
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region package.json
|
|
28
28
|
var name$2 = "eslint-plugin-react-jsx";
|
|
29
|
-
var version = "5.20.
|
|
29
|
+
var version = "5.20.4";
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/utils/create-rule.ts
|
|
@@ -73,29 +73,31 @@ var no_children_prop_with_children_default = createRule({
|
|
|
73
73
|
function create$7(context) {
|
|
74
74
|
return {
|
|
75
75
|
CallExpression(node) {
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
76
|
+
const prop = core.getCreateElementProp(context, node, "children");
|
|
77
|
+
if (prop == null) return;
|
|
78
78
|
if (core.getCreateElementChildrenArguments(context, node).length === 0) return;
|
|
79
79
|
context.report({
|
|
80
80
|
messageId: "default",
|
|
81
|
-
node:
|
|
81
|
+
node: prop
|
|
82
82
|
});
|
|
83
83
|
},
|
|
84
84
|
JSXElement(node) {
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
if (
|
|
85
|
+
const prop = findAttribute(context, node, "children");
|
|
86
|
+
if (prop == null || !hasChildren(node)) return;
|
|
87
|
+
if (prop.type !== AST_NODE_TYPES.JSXAttribute) {
|
|
88
88
|
context.report({
|
|
89
89
|
messageId: "default",
|
|
90
|
-
node:
|
|
90
|
+
node: prop
|
|
91
91
|
});
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
context.report({
|
|
95
95
|
messageId: "default",
|
|
96
|
-
node:
|
|
96
|
+
node: prop,
|
|
97
97
|
suggest: [{
|
|
98
|
-
fix
|
|
98
|
+
fix(fixer) {
|
|
99
|
+
return removeJsxAttribute(context, fixer, prop);
|
|
100
|
+
},
|
|
99
101
|
messageId: "removeChildrenProp"
|
|
100
102
|
}, {
|
|
101
103
|
fix(fixer) {
|
|
@@ -133,36 +135,36 @@ var no_children_prop_default = createRule({
|
|
|
133
135
|
function create$6(context) {
|
|
134
136
|
return {
|
|
135
137
|
CallExpression(node) {
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
+
const prop = core.getCreateElementProp(context, node, "children");
|
|
139
|
+
if (prop == null) return;
|
|
138
140
|
context.report({
|
|
139
141
|
messageId: "default",
|
|
140
|
-
node:
|
|
142
|
+
node: prop
|
|
141
143
|
});
|
|
142
144
|
},
|
|
143
145
|
JSXElement(node) {
|
|
144
|
-
const
|
|
145
|
-
if (
|
|
146
|
-
if (
|
|
146
|
+
const prop = findAttribute(context, node, "children");
|
|
147
|
+
if (prop == null) return;
|
|
148
|
+
if (prop.type !== AST_NODE_TYPES.JSXAttribute) {
|
|
147
149
|
context.report({
|
|
148
150
|
messageId: "default",
|
|
149
|
-
node:
|
|
151
|
+
node: prop
|
|
150
152
|
});
|
|
151
153
|
return;
|
|
152
154
|
}
|
|
153
|
-
const childrenText = getChildrenText(context,
|
|
155
|
+
const childrenText = getChildrenText(context, prop);
|
|
154
156
|
if (childrenText == null) {
|
|
155
157
|
context.report({
|
|
156
158
|
messageId: "default",
|
|
157
|
-
node:
|
|
159
|
+
node: prop
|
|
158
160
|
});
|
|
159
161
|
return;
|
|
160
162
|
}
|
|
161
163
|
context.report({
|
|
162
164
|
messageId: "default",
|
|
163
|
-
node:
|
|
165
|
+
node: prop,
|
|
164
166
|
suggest: [{
|
|
165
|
-
fix: buildFix$1(context, node,
|
|
167
|
+
fix: buildFix$1(context, node, prop, childrenText),
|
|
166
168
|
messageId: "moveChildrenToContent"
|
|
167
169
|
}]
|
|
168
170
|
});
|
|
@@ -232,15 +234,14 @@ var no_comment_textnodes_default = createRule({
|
|
|
232
234
|
defaultOptions: []
|
|
233
235
|
});
|
|
234
236
|
function create$5(context) {
|
|
235
|
-
|
|
237
|
+
return { JSXText(node) {
|
|
236
238
|
if (!Check.isJSXElementOrFragment(node.parent)) return;
|
|
237
239
|
if (!/^\s*\/(?:\/|\*)/mu.test(context.sourceCode.getText(node))) return;
|
|
238
240
|
context.report({
|
|
239
241
|
messageId: "default",
|
|
240
242
|
node
|
|
241
243
|
});
|
|
242
|
-
}
|
|
243
|
-
return { JSXText: visit };
|
|
244
|
+
} };
|
|
244
245
|
}
|
|
245
246
|
|
|
246
247
|
//#endregion
|
|
@@ -827,7 +828,7 @@ var no_leaked_semicolon_default = createRule({
|
|
|
827
828
|
defaultOptions: []
|
|
828
829
|
});
|
|
829
830
|
function create$2(context) {
|
|
830
|
-
|
|
831
|
+
return { JSXText(node) {
|
|
831
832
|
if (!Check.isJSXElementOrFragment(node.parent)) return;
|
|
832
833
|
if (!/^;+[ \t]*(?:\r\n|\r|\n)/u.test(context.sourceCode.getText(node))) return;
|
|
833
834
|
context.report({
|
|
@@ -840,8 +841,7 @@ function create$2(context) {
|
|
|
840
841
|
messageId: "removeSemicolon"
|
|
841
842
|
}]
|
|
842
843
|
});
|
|
843
|
-
}
|
|
844
|
-
return { JSXText: visit };
|
|
844
|
+
} };
|
|
845
845
|
}
|
|
846
846
|
|
|
847
847
|
//#endregion
|
|
@@ -851,7 +851,7 @@ var no_namespace_default = createRule({
|
|
|
851
851
|
meta: {
|
|
852
852
|
type: "problem",
|
|
853
853
|
docs: { description: "Disallow JSX namespace syntax, as React does not support them." },
|
|
854
|
-
messages: {
|
|
854
|
+
messages: { default: "A React component '{{name}}' must not be in a namespace, as React does not support them." },
|
|
855
855
|
schema: []
|
|
856
856
|
},
|
|
857
857
|
name: RULE_NAME$1,
|
|
@@ -864,7 +864,7 @@ function create$1(context) {
|
|
|
864
864
|
if (!name.includes(":")) return;
|
|
865
865
|
context.report({
|
|
866
866
|
data: { name },
|
|
867
|
-
messageId: "
|
|
867
|
+
messageId: "default",
|
|
868
868
|
node: node.openingElement.name
|
|
869
869
|
});
|
|
870
870
|
} };
|
|
@@ -908,10 +908,10 @@ function create(context, [option]) {
|
|
|
908
908
|
allowEmptyFragment: option.allowEmptyFragment ?? false,
|
|
909
909
|
allowExpressions: option.allowExpressions ?? true
|
|
910
910
|
};
|
|
911
|
-
const
|
|
911
|
+
const { jsxFragmentFactory } = core.getJsxConfig(context);
|
|
912
912
|
return {
|
|
913
913
|
JSXElement(node) {
|
|
914
|
-
if (!isFragmentElement(node,
|
|
914
|
+
if (!isFragmentElement(node, jsxFragmentFactory)) return;
|
|
915
915
|
if (hasAnyAttribute(context, node, ["key", "ref"])) return;
|
|
916
916
|
visitFragment(context, node, options);
|
|
917
917
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-jsx",
|
|
3
|
-
"version": "5.20.
|
|
3
|
+
"version": "5.20.4",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React Flavored JSX rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@eslint-react/ast": "5.20.
|
|
41
|
-
"@eslint-react/core": "5.20.
|
|
42
|
-
"@eslint-react/eslint": "5.20.
|
|
43
|
-
"@eslint-react/jsx": "5.20.
|
|
44
|
-
"@eslint-react/shared": "5.20.
|
|
40
|
+
"@eslint-react/ast": "5.20.4",
|
|
41
|
+
"@eslint-react/core": "5.20.4",
|
|
42
|
+
"@eslint-react/eslint": "5.20.4",
|
|
43
|
+
"@eslint-react/jsx": "5.20.4",
|
|
44
|
+
"@eslint-react/shared": "5.20.4",
|
|
45
45
|
"@typescript-eslint/types": "^8.70.0",
|
|
46
46
|
"@typescript-eslint/utils": "^8.70.0"
|
|
47
47
|
},
|