@eslint-react/core 2.5.6-next.4 → 2.5.6-next.5
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.ts +6 -6
- package/dist/index.js +10 -9
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -572,7 +572,7 @@ declare function resolveJsxAttributeValue(context: RuleContext, attribute: AST.T
|
|
|
572
572
|
readonly toStatic: () => string | number | bigint | boolean | RegExp | null;
|
|
573
573
|
} | {
|
|
574
574
|
readonly kind: "expression";
|
|
575
|
-
readonly node: TSESTree.
|
|
575
|
+
readonly node: TSESTree.Expression | TSESTree.JSXEmptyExpression;
|
|
576
576
|
readonly toStatic: () => unknown;
|
|
577
577
|
} | {
|
|
578
578
|
readonly kind: "element";
|
|
@@ -580,7 +580,7 @@ declare function resolveJsxAttributeValue(context: RuleContext, attribute: AST.T
|
|
|
580
580
|
readonly toStatic: () => undefined;
|
|
581
581
|
} | {
|
|
582
582
|
readonly kind: "spreadChild";
|
|
583
|
-
readonly node: TSESTree.
|
|
583
|
+
readonly node: TSESTree.Expression | TSESTree.JSXEmptyExpression;
|
|
584
584
|
readonly toStatic: () => undefined;
|
|
585
585
|
} | {
|
|
586
586
|
readonly kind: "spreadProps";
|
|
@@ -681,9 +681,10 @@ declare function isJsxHostElement(context: RuleContext, node: TSESTree.Node): bo
|
|
|
681
681
|
*
|
|
682
682
|
* @param context ESLint rule context
|
|
683
683
|
* @param node AST node to check
|
|
684
|
-
* @
|
|
684
|
+
* @param jsxConfig Optional JSX configuration
|
|
685
|
+
* @returns boolean indicating if the element is a Fragment
|
|
685
686
|
*/
|
|
686
|
-
declare function isJsxFragmentElement(context: RuleContext, node: TSESTree.Node):
|
|
687
|
+
declare function isJsxFragmentElement(context: RuleContext, node: TSESTree.Node, jsxConfig?: JsxConfig): boolean;
|
|
687
688
|
//#endregion
|
|
688
689
|
//#region src/jsx/jsx-element-type.d.ts
|
|
689
690
|
/**
|
|
@@ -722,10 +723,9 @@ declare function stringifyJsx(node: TSESTree$1.JSXIdentifier | TSESTree$1.JSXNam
|
|
|
722
723
|
* Gets the identifier node of an instance based on AST node relationships.
|
|
723
724
|
* Used for tracking where hooks or components are being assigned in the code.
|
|
724
725
|
* @param node The current AST node to evaluate
|
|
725
|
-
* @param prev The previous AST node in the traversal (used for context)
|
|
726
726
|
* @internal
|
|
727
727
|
*/
|
|
728
|
-
declare function getInstanceId(node: TSESTree.Node
|
|
728
|
+
declare function getInstanceId(node: TSESTree.Node): TSESTree.JSXElement | TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.TemplateLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.YieldExpression | TSESTree.PrivateIdentifier | undefined;
|
|
729
729
|
//#endregion
|
|
730
730
|
//#region src/utils/is-from-react.d.ts
|
|
731
731
|
/**
|
package/dist/index.js
CHANGED
|
@@ -540,11 +540,13 @@ function isJsxHostElement(context, node) {
|
|
|
540
540
|
*
|
|
541
541
|
* @param context ESLint rule context
|
|
542
542
|
* @param node AST node to check
|
|
543
|
-
* @
|
|
543
|
+
* @param jsxConfig Optional JSX configuration
|
|
544
|
+
* @returns boolean indicating if the element is a Fragment
|
|
544
545
|
*/
|
|
545
|
-
function isJsxFragmentElement(context, node) {
|
|
546
|
+
function isJsxFragmentElement(context, node, jsxConfig) {
|
|
546
547
|
if (node.type !== AST_NODE_TYPES.JSXElement) return false;
|
|
547
|
-
|
|
548
|
+
const fragment = jsxConfig?.jsxFragmentFactory?.split(".").at(-1) ?? "Fragment";
|
|
549
|
+
return getJsxElementType(context, node).split(".").at(-1) === fragment;
|
|
548
550
|
}
|
|
549
551
|
|
|
550
552
|
//#endregion
|
|
@@ -571,16 +573,15 @@ function findParentJsxAttribute(node, test = constTrue) {
|
|
|
571
573
|
* Gets the identifier node of an instance based on AST node relationships.
|
|
572
574
|
* Used for tracking where hooks or components are being assigned in the code.
|
|
573
575
|
* @param node The current AST node to evaluate
|
|
574
|
-
* @param prev The previous AST node in the traversal (used for context)
|
|
575
576
|
* @internal
|
|
576
577
|
*/
|
|
577
|
-
function getInstanceId(node
|
|
578
|
+
function getInstanceId(node) {
|
|
578
579
|
switch (true) {
|
|
579
|
-
case node.type === AST_NODE_TYPES.VariableDeclarator
|
|
580
|
-
case node.type === AST_NODE_TYPES.AssignmentExpression
|
|
581
|
-
case node.type === AST_NODE_TYPES.PropertyDefinition
|
|
580
|
+
case node.type === AST_NODE_TYPES.VariableDeclarator: return node.id;
|
|
581
|
+
case node.type === AST_NODE_TYPES.AssignmentExpression: return node.left;
|
|
582
|
+
case node.type === AST_NODE_TYPES.PropertyDefinition: return node.key;
|
|
582
583
|
case node.type === AST_NODE_TYPES.BlockStatement || node.type === AST_NODE_TYPES.Program || node.parent === node: return unit;
|
|
583
|
-
default: return getInstanceId(node.parent
|
|
584
|
+
default: return getInstanceId(node.parent);
|
|
584
585
|
}
|
|
585
586
|
}
|
|
586
587
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "2.5.6-next.
|
|
3
|
+
"version": "2.5.6-next.5",
|
|
4
4
|
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"@typescript-eslint/utils": "^8.53.0",
|
|
36
36
|
"birecord": "^0.1.1",
|
|
37
37
|
"ts-pattern": "^5.9.0",
|
|
38
|
-
"@eslint-react/ast": "2.5.6-next.
|
|
39
|
-
"@eslint-react/eff": "2.5.6-next.
|
|
40
|
-
"@eslint-react/shared": "2.5.6-next.
|
|
41
|
-
"@eslint-react/var": "2.5.6-next.
|
|
38
|
+
"@eslint-react/ast": "2.5.6-next.5",
|
|
39
|
+
"@eslint-react/eff": "2.5.6-next.5",
|
|
40
|
+
"@eslint-react/shared": "2.5.6-next.5",
|
|
41
|
+
"@eslint-react/var": "2.5.6-next.5"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"tsdown": "^0.20.0-beta.1",
|