eslint-plugin-react-jsx 5.18.4 → 5.18.6
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 +6 -24
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DEFAULT_ESLINT_REACT_SETTINGS } from "@eslint-react/shared";
|
|
2
2
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
3
|
-
import { Check, Extract } from "@eslint-react/ast";
|
|
4
3
|
import * as core from "@eslint-react/core";
|
|
5
|
-
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
6
4
|
import "@eslint-react/eslint";
|
|
7
5
|
import { collapseMultilineText, findAttribute, getChildren, getElementFullType, hasAnyAttribute, hasChildren, isAttribute, isEmptyStringExpression, isFragmentElement, isHostElement, isWhitespaceText } from "@eslint-react/jsx";
|
|
6
|
+
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
7
|
+
import { Check } from "@eslint-react/ast";
|
|
8
8
|
import ts from "typescript";
|
|
9
9
|
|
|
10
10
|
//#region \0rolldown/runtime.js
|
|
@@ -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.18.
|
|
29
|
+
var version = "5.18.6";
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/utils/create-rule.ts
|
|
@@ -35,24 +35,6 @@ function getDocsUrl(ruleName) {
|
|
|
35
35
|
}
|
|
36
36
|
const createRule = ESLintUtils.RuleCreator(getDocsUrl);
|
|
37
37
|
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/utils/find-create-element-children-prop.ts
|
|
40
|
-
/**
|
|
41
|
-
* Finds the statically named `children` property in the props object of a `createElement` call.
|
|
42
|
-
* @param context The rule context
|
|
43
|
-
* @param node The `CallExpression` node to inspect
|
|
44
|
-
* @returns The `children` property node, or `null` when the call has no static `children` prop
|
|
45
|
-
*/
|
|
46
|
-
function findCreateElementChildrenProp(context, node) {
|
|
47
|
-
if (!core.isCreateElementCall(context, node)) return null;
|
|
48
|
-
const propsArg = node.arguments[1];
|
|
49
|
-
if (propsArg == null) return null;
|
|
50
|
-
const propsObject = Extract.unwrap(propsArg);
|
|
51
|
-
if (propsObject.type !== AST_NODE_TYPES.ObjectExpression) return null;
|
|
52
|
-
for (const prop of propsObject.properties) if (prop.type === AST_NODE_TYPES.Property && Extract.getPropertyName(prop, "max") === "children") return prop;
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
38
|
//#endregion
|
|
57
39
|
//#region src/utils/remove-jsx-attribute.ts
|
|
58
40
|
/**
|
|
@@ -91,9 +73,9 @@ var no_children_prop_with_children_default = createRule({
|
|
|
91
73
|
function create$7(context) {
|
|
92
74
|
return {
|
|
93
75
|
CallExpression(node) {
|
|
94
|
-
const childrenProp =
|
|
76
|
+
const childrenProp = core.getCreateElementProp(context, node, "children");
|
|
95
77
|
if (childrenProp == null) return;
|
|
96
|
-
if (node.
|
|
78
|
+
if (core.getCreateElementChildrenArguments(context, node).length === 0) return;
|
|
97
79
|
context.report({
|
|
98
80
|
messageId: "default",
|
|
99
81
|
node: childrenProp
|
|
@@ -151,7 +133,7 @@ var no_children_prop_default = createRule({
|
|
|
151
133
|
function create$6(context) {
|
|
152
134
|
return {
|
|
153
135
|
CallExpression(node) {
|
|
154
|
-
const childrenProp =
|
|
136
|
+
const childrenProp = core.getCreateElementProp(context, node, "children");
|
|
155
137
|
if (childrenProp == null) return;
|
|
156
138
|
context.report({
|
|
157
139
|
messageId: "default",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-jsx",
|
|
3
|
-
"version": "5.18.
|
|
3
|
+
"version": "5.18.6",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React Flavored JSX rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@typescript-eslint/types": "^8.
|
|
41
|
-
"@typescript-eslint/utils": "^8.
|
|
42
|
-
"@eslint-react/
|
|
43
|
-
"@eslint-react/
|
|
44
|
-
"@eslint-react/
|
|
45
|
-
"@eslint-react/eslint": "5.18.
|
|
46
|
-
"@eslint-react/shared": "5.18.
|
|
40
|
+
"@typescript-eslint/types": "^8.67.0",
|
|
41
|
+
"@typescript-eslint/utils": "^8.67.0",
|
|
42
|
+
"@eslint-react/core": "5.18.6",
|
|
43
|
+
"@eslint-react/jsx": "5.18.6",
|
|
44
|
+
"@eslint-react/ast": "5.18.6",
|
|
45
|
+
"@eslint-react/eslint": "5.18.6",
|
|
46
|
+
"@eslint-react/shared": "5.18.6"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/react": "^19.2.18",
|