@eslint-react/jsx 1.40.3-next.1 → 1.40.4-beta.0
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 +8 -29
- package/dist/index.d.ts +8 -29
- package/dist/index.js +14 -16
- package/dist/index.mjs +9 -11
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -79,45 +79,24 @@ declare function isJSXLike(node: TSESTree$1.Node | _ | null, jsxCtx: {
|
|
|
79
79
|
getScope: (node: TSESTree$1.Node) => Scope;
|
|
80
80
|
}, hint?: JSXDetectionHint): boolean;
|
|
81
81
|
|
|
82
|
+
declare function isJsxFragmentElement(node: TSESTree.Node): boolean;
|
|
83
|
+
declare function isJsxKeyedElement(node: TSESTree.Node, initialScope?: Scope): boolean;
|
|
84
|
+
declare function isJsxBuiltInElement(node: TSESTree.Node): boolean;
|
|
85
|
+
declare function isJsxUserDefinedElement(node: TSESTree.Node): boolean;
|
|
86
|
+
|
|
82
87
|
/**
|
|
83
88
|
* Check if a node is a `JSXFragment` or a `Fragment` element
|
|
84
89
|
* @param node The AST node to check
|
|
85
90
|
* @returns `true` if the node is a `JSXFragment` or a `Fragment` element
|
|
86
91
|
*/
|
|
87
|
-
declare function
|
|
92
|
+
declare function isJsxFragment(node: TSESTree.Node | null | _): boolean;
|
|
88
93
|
|
|
89
94
|
/**
|
|
90
95
|
* Check if a node is a `JSXText` or a `Literal` node
|
|
91
96
|
* @param node The AST node to check
|
|
92
97
|
* @returns `true` if the node is a `JSXText` or a `Literal` node
|
|
93
98
|
*/
|
|
94
|
-
declare function
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Check if a node is a Fragment element
|
|
98
|
-
* @param node The AST node to check
|
|
99
|
-
* @returns `true` if the node is a `JSXElement` of `Fragment` type
|
|
100
|
-
*/
|
|
101
|
-
declare function isFragmentElement(node: TSESTree.Node): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Check if a node has a `key` prop
|
|
104
|
-
* @param node The AST node to check
|
|
105
|
-
* @param initialScope The initial scope to start searching for the `key` attribute
|
|
106
|
-
* @returns `true` if the node is a `JSXElement` of `Keyed Component` type
|
|
107
|
-
*/
|
|
108
|
-
declare function isKeyedElement(node: TSESTree.Node, initialScope?: Scope): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Check if a node is a `JSXElement` of built-in component
|
|
111
|
-
* @param node The AST node to check
|
|
112
|
-
* @returns `true` if the node is a `JSXFragment` of `Built-in Component` type
|
|
113
|
-
*/
|
|
114
|
-
declare function isBuiltInElement(node: TSESTree.Node): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Check if a node is a `JSXElement` of user-defined component
|
|
117
|
-
* @param node The AST node to check
|
|
118
|
-
* @returns `true` if the node is a `JSXElement` of `User-Defined Component` type
|
|
119
|
-
*/
|
|
120
|
-
declare function isUserDefinedElement(node: TSESTree.Node): boolean;
|
|
99
|
+
declare function isJsxText(node: TSESTree.Node | null | _): node is TSESTree.JSXText | TSESTree.Literal;
|
|
121
100
|
|
|
122
101
|
/**
|
|
123
102
|
* Get the stringified representation of a JSX node
|
|
@@ -126,4 +105,4 @@ declare function isUserDefinedElement(node: TSESTree.Node): boolean;
|
|
|
126
105
|
*/
|
|
127
106
|
declare function toString(node: TSESTree$1.JSXIdentifier | TSESTree$1.JSXMemberExpression | TSESTree$1.JSXNamespacedName | TSESTree$1.JSXOpeningElement | TSESTree$1.JSXClosingElement | TSESTree$1.JSXOpeningFragment | TSESTree$1.JSXClosingFragment | TSESTree$1.JSXText): string;
|
|
128
107
|
|
|
129
|
-
export { DEFAULT_JSX_DETECTION_HINT, JSXDetectionHint, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getElementType, hasAnyAttribute, hasAttribute, hasEveryAttribute,
|
|
108
|
+
export { DEFAULT_JSX_DETECTION_HINT, JSXDetectionHint, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getElementType, hasAnyAttribute, hasAttribute, hasEveryAttribute, isJSXLike, isJsxBuiltInElement, isJsxFragment, isJsxFragmentElement, isJsxKeyedElement, isJsxText, isJsxUserDefinedElement, toString };
|
package/dist/index.d.ts
CHANGED
|
@@ -79,45 +79,24 @@ declare function isJSXLike(node: TSESTree$1.Node | _ | null, jsxCtx: {
|
|
|
79
79
|
getScope: (node: TSESTree$1.Node) => Scope;
|
|
80
80
|
}, hint?: JSXDetectionHint): boolean;
|
|
81
81
|
|
|
82
|
+
declare function isJsxFragmentElement(node: TSESTree.Node): boolean;
|
|
83
|
+
declare function isJsxKeyedElement(node: TSESTree.Node, initialScope?: Scope): boolean;
|
|
84
|
+
declare function isJsxBuiltInElement(node: TSESTree.Node): boolean;
|
|
85
|
+
declare function isJsxUserDefinedElement(node: TSESTree.Node): boolean;
|
|
86
|
+
|
|
82
87
|
/**
|
|
83
88
|
* Check if a node is a `JSXFragment` or a `Fragment` element
|
|
84
89
|
* @param node The AST node to check
|
|
85
90
|
* @returns `true` if the node is a `JSXFragment` or a `Fragment` element
|
|
86
91
|
*/
|
|
87
|
-
declare function
|
|
92
|
+
declare function isJsxFragment(node: TSESTree.Node | null | _): boolean;
|
|
88
93
|
|
|
89
94
|
/**
|
|
90
95
|
* Check if a node is a `JSXText` or a `Literal` node
|
|
91
96
|
* @param node The AST node to check
|
|
92
97
|
* @returns `true` if the node is a `JSXText` or a `Literal` node
|
|
93
98
|
*/
|
|
94
|
-
declare function
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Check if a node is a Fragment element
|
|
98
|
-
* @param node The AST node to check
|
|
99
|
-
* @returns `true` if the node is a `JSXElement` of `Fragment` type
|
|
100
|
-
*/
|
|
101
|
-
declare function isFragmentElement(node: TSESTree.Node): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Check if a node has a `key` prop
|
|
104
|
-
* @param node The AST node to check
|
|
105
|
-
* @param initialScope The initial scope to start searching for the `key` attribute
|
|
106
|
-
* @returns `true` if the node is a `JSXElement` of `Keyed Component` type
|
|
107
|
-
*/
|
|
108
|
-
declare function isKeyedElement(node: TSESTree.Node, initialScope?: Scope): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Check if a node is a `JSXElement` of built-in component
|
|
111
|
-
* @param node The AST node to check
|
|
112
|
-
* @returns `true` if the node is a `JSXFragment` of `Built-in Component` type
|
|
113
|
-
*/
|
|
114
|
-
declare function isBuiltInElement(node: TSESTree.Node): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Check if a node is a `JSXElement` of user-defined component
|
|
117
|
-
* @param node The AST node to check
|
|
118
|
-
* @returns `true` if the node is a `JSXElement` of `User-Defined Component` type
|
|
119
|
-
*/
|
|
120
|
-
declare function isUserDefinedElement(node: TSESTree.Node): boolean;
|
|
99
|
+
declare function isJsxText(node: TSESTree.Node | null | _): node is TSESTree.JSXText | TSESTree.Literal;
|
|
121
100
|
|
|
122
101
|
/**
|
|
123
102
|
* Get the stringified representation of a JSX node
|
|
@@ -126,4 +105,4 @@ declare function isUserDefinedElement(node: TSESTree.Node): boolean;
|
|
|
126
105
|
*/
|
|
127
106
|
declare function toString(node: TSESTree$1.JSXIdentifier | TSESTree$1.JSXMemberExpression | TSESTree$1.JSXNamespacedName | TSESTree$1.JSXOpeningElement | TSESTree$1.JSXClosingElement | TSESTree$1.JSXOpeningFragment | TSESTree$1.JSXClosingFragment | TSESTree$1.JSXText): string;
|
|
128
107
|
|
|
129
|
-
export { DEFAULT_JSX_DETECTION_HINT, JSXDetectionHint, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getElementType, hasAnyAttribute, hasAttribute, hasEveryAttribute,
|
|
108
|
+
export { DEFAULT_JSX_DETECTION_HINT, JSXDetectionHint, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getElementType, hasAnyAttribute, hasAttribute, hasEveryAttribute, isJSXLike, isJsxBuiltInElement, isJsxFragment, isJsxFragmentElement, isJsxKeyedElement, isJsxText, isJsxUserDefinedElement, toString };
|
package/dist/index.js
CHANGED
|
@@ -258,26 +258,24 @@ function isJSXLike(node, jsxCtx, hint = DEFAULT_JSX_DETECTION_HINT) {
|
|
|
258
258
|
}
|
|
259
259
|
return false;
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function isJsxFragmentElement(node) {
|
|
262
262
|
if (node.type !== types.AST_NODE_TYPES.JSXElement) return false;
|
|
263
263
|
return getElementType(node).split(".").at(-1) === "Fragment";
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function isJsxKeyedElement(node, initialScope) {
|
|
266
266
|
return node.type === types.AST_NODE_TYPES.JSXElement && hasAttribute("key", node.openingElement.attributes, initialScope);
|
|
267
267
|
}
|
|
268
|
-
function
|
|
269
|
-
return node.type === types.AST_NODE_TYPES.JSXElement && node.openingElement.name.type === types.AST_NODE_TYPES.JSXIdentifier &&
|
|
268
|
+
function isJsxBuiltInElement(node) {
|
|
269
|
+
return node.type === types.AST_NODE_TYPES.JSXElement && node.openingElement.name.type === types.AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(node.openingElement.name.name);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function isJsxUserDefinedElement(node) {
|
|
272
272
|
return node.type === types.AST_NODE_TYPES.JSXElement && node.openingElement.name.type === types.AST_NODE_TYPES.JSXIdentifier && /^[A-Z]/u.test(node.openingElement.name.name);
|
|
273
273
|
}
|
|
274
|
-
|
|
275
|
-
// src/is-jsx-fragment.ts
|
|
276
|
-
function isJSXFragmentLike(node) {
|
|
274
|
+
function isJsxFragment(node) {
|
|
277
275
|
if (node == null) return false;
|
|
278
|
-
return node.type === types.AST_NODE_TYPES.JSXFragment ||
|
|
276
|
+
return node.type === types.AST_NODE_TYPES.JSXFragment || isJsxFragmentElement(node);
|
|
279
277
|
}
|
|
280
|
-
function
|
|
278
|
+
function isJsxText(node) {
|
|
281
279
|
if (node == null) return false;
|
|
282
280
|
return node.type === types.AST_NODE_TYPES.JSXText || node.type === types.AST_NODE_TYPES.Literal;
|
|
283
281
|
}
|
|
@@ -292,11 +290,11 @@ exports.getElementType = getElementType;
|
|
|
292
290
|
exports.hasAnyAttribute = hasAnyAttribute;
|
|
293
291
|
exports.hasAttribute = hasAttribute;
|
|
294
292
|
exports.hasEveryAttribute = hasEveryAttribute;
|
|
295
|
-
exports.isBuiltInElement = isBuiltInElement;
|
|
296
|
-
exports.isFragmentElement = isFragmentElement;
|
|
297
|
-
exports.isJSXFragmentLike = isJSXFragmentLike;
|
|
298
293
|
exports.isJSXLike = isJSXLike;
|
|
299
|
-
exports.
|
|
300
|
-
exports.
|
|
301
|
-
exports.
|
|
294
|
+
exports.isJsxBuiltInElement = isJsxBuiltInElement;
|
|
295
|
+
exports.isJsxFragment = isJsxFragment;
|
|
296
|
+
exports.isJsxFragmentElement = isJsxFragmentElement;
|
|
297
|
+
exports.isJsxKeyedElement = isJsxKeyedElement;
|
|
298
|
+
exports.isJsxText = isJsxText;
|
|
299
|
+
exports.isJsxUserDefinedElement = isJsxUserDefinedElement;
|
|
302
300
|
exports.toString = toString;
|
package/dist/index.mjs
CHANGED
|
@@ -235,28 +235,26 @@ function isJSXLike(node, jsxCtx, hint = DEFAULT_JSX_DETECTION_HINT) {
|
|
|
235
235
|
}
|
|
236
236
|
return false;
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function isJsxFragmentElement(node) {
|
|
239
239
|
if (node.type !== AST_NODE_TYPES.JSXElement) return false;
|
|
240
240
|
return getElementType(node).split(".").at(-1) === "Fragment";
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function isJsxKeyedElement(node, initialScope) {
|
|
243
243
|
return node.type === AST_NODE_TYPES.JSXElement && hasAttribute("key", node.openingElement.attributes, initialScope);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
return node.type === AST_NODE_TYPES.JSXElement && node.openingElement.name.type === AST_NODE_TYPES.JSXIdentifier &&
|
|
245
|
+
function isJsxBuiltInElement(node) {
|
|
246
|
+
return node.type === AST_NODE_TYPES.JSXElement && node.openingElement.name.type === AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(node.openingElement.name.name);
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function isJsxUserDefinedElement(node) {
|
|
249
249
|
return node.type === AST_NODE_TYPES.JSXElement && node.openingElement.name.type === AST_NODE_TYPES.JSXIdentifier && /^[A-Z]/u.test(node.openingElement.name.name);
|
|
250
250
|
}
|
|
251
|
-
|
|
252
|
-
// src/is-jsx-fragment.ts
|
|
253
|
-
function isJSXFragmentLike(node) {
|
|
251
|
+
function isJsxFragment(node) {
|
|
254
252
|
if (node == null) return false;
|
|
255
|
-
return node.type === AST_NODE_TYPES.JSXFragment ||
|
|
253
|
+
return node.type === AST_NODE_TYPES.JSXFragment || isJsxFragmentElement(node);
|
|
256
254
|
}
|
|
257
|
-
function
|
|
255
|
+
function isJsxText(node) {
|
|
258
256
|
if (node == null) return false;
|
|
259
257
|
return node.type === AST_NODE_TYPES.JSXText || node.type === AST_NODE_TYPES.Literal;
|
|
260
258
|
}
|
|
261
259
|
|
|
262
|
-
export { DEFAULT_JSX_DETECTION_HINT, JSXDetectionHint, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getElementType, hasAnyAttribute, hasAttribute, hasEveryAttribute,
|
|
260
|
+
export { DEFAULT_JSX_DETECTION_HINT, JSXDetectionHint, findParentAttribute, getAttribute, getAttributeName, getAttributeValue, getElementType, hasAnyAttribute, hasAttribute, hasEveryAttribute, isJSXLike, isJsxBuiltInElement, isJsxFragment, isJsxFragmentElement, isJsxKeyedElement, isJsxText, isJsxUserDefinedElement, toString };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/jsx",
|
|
3
|
-
"version": "1.40.
|
|
3
|
+
"version": "1.40.4-beta.0",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module for static analysis of JSX.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"@typescript-eslint/types": "^8.29.0",
|
|
40
40
|
"@typescript-eslint/utils": "^8.29.0",
|
|
41
41
|
"ts-pattern": "^5.7.0",
|
|
42
|
-
"@eslint-react/ast": "1.40.
|
|
43
|
-
"@eslint-react/eff": "1.40.
|
|
44
|
-
"@eslint-react/var": "1.40.
|
|
42
|
+
"@eslint-react/ast": "1.40.4-beta.0",
|
|
43
|
+
"@eslint-react/eff": "1.40.4-beta.0",
|
|
44
|
+
"@eslint-react/var": "1.40.4-beta.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"tsup": "^8.4.0",
|