@eslint-react/jsx 0.8.11-beta.1 → 0.8.11
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.cjs +6 -10
- package/dist/index.js +6 -10
- package/dist/index.mjs +6 -10
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -6589,9 +6589,9 @@ function isStringLiteral(node) {
|
|
|
6589
6589
|
*/ function traverseUp(node, predicate) {
|
|
6590
6590
|
const { parent } = node;
|
|
6591
6591
|
if (!parent || parent.type === NodeType.Program) {
|
|
6592
|
-
return
|
|
6592
|
+
return Option.none();
|
|
6593
6593
|
}
|
|
6594
|
-
return predicate(parent) ? parent : traverseUp(parent, predicate);
|
|
6594
|
+
return predicate(parent) ? Option.some(parent) : traverseUp(parent, predicate);
|
|
6595
6595
|
}
|
|
6596
6596
|
/**
|
|
6597
6597
|
* Traverses up the AST tree until the predicate returns `true` or the root node is reached
|
|
@@ -6602,9 +6602,9 @@ function isStringLiteral(node) {
|
|
|
6602
6602
|
*/ function traverseUpGuard(node, predicate) {
|
|
6603
6603
|
const { parent } = node;
|
|
6604
6604
|
if (!parent || parent.type === NodeType.Program) {
|
|
6605
|
-
return
|
|
6605
|
+
return Option.none();
|
|
6606
6606
|
}
|
|
6607
|
-
return predicate(parent) ? parent : traverseUpGuard(parent, predicate);
|
|
6607
|
+
return predicate(parent) ? Option.some(parent) : traverseUpGuard(parent, predicate);
|
|
6608
6608
|
}
|
|
6609
6609
|
/**
|
|
6610
6610
|
* Find a variable through a list of variables by name
|
|
@@ -7178,11 +7178,7 @@ function isPropertyOfPragma(name, context, pragma = getPragmaFromContext(context
|
|
|
7178
7178
|
* @param context The rule context
|
|
7179
7179
|
* @returns `true` if the node is inside createElement's props
|
|
7180
7180
|
*/ function isInsideCreateElementProps(node, context) {
|
|
7181
|
-
|
|
7182
|
-
if (parentCreateElement?.type !== NodeType.CallExpression) {
|
|
7183
|
-
return false;
|
|
7184
|
-
}
|
|
7185
|
-
return parentCreateElement.arguments.at(1) === traverseUp(node, is(NodeType.ObjectExpression));
|
|
7181
|
+
return Function$1.pipe(traverseUp(node, (n)=>isCreateElementCall(n, context)), Option.filter(is(NodeType.CallExpression)), Option.flatMapNullable((c)=>c.arguments.at(1)), Option.filter(is(NodeType.ObjectExpression)), Option.zipWith(traverseUp(node, is(NodeType.ObjectExpression)), (a, b)=>a === b), Option.getOrElse(Function$1.constFalse));
|
|
7186
7182
|
}
|
|
7187
7183
|
function isChildrenOfCreateElement(node, context) {
|
|
7188
7184
|
const maybeCallExpression = node.parent;
|
|
@@ -7729,7 +7725,7 @@ function getProp(props, propName, context) {
|
|
|
7729
7725
|
const matcher = (node)=>{
|
|
7730
7726
|
return node.type === NodeType.JSXAttribute && predicate(node);
|
|
7731
7727
|
};
|
|
7732
|
-
return
|
|
7728
|
+
return traverseUpGuard(node, matcher);
|
|
7733
7729
|
}
|
|
7734
7730
|
|
|
7735
7731
|
/**
|
package/dist/index.js
CHANGED
|
@@ -6589,9 +6589,9 @@ function isStringLiteral(node) {
|
|
|
6589
6589
|
*/ function traverseUp(node, predicate) {
|
|
6590
6590
|
const { parent } = node;
|
|
6591
6591
|
if (!parent || parent.type === NodeType.Program) {
|
|
6592
|
-
return
|
|
6592
|
+
return Option.none();
|
|
6593
6593
|
}
|
|
6594
|
-
return predicate(parent) ? parent : traverseUp(parent, predicate);
|
|
6594
|
+
return predicate(parent) ? Option.some(parent) : traverseUp(parent, predicate);
|
|
6595
6595
|
}
|
|
6596
6596
|
/**
|
|
6597
6597
|
* Traverses up the AST tree until the predicate returns `true` or the root node is reached
|
|
@@ -6602,9 +6602,9 @@ function isStringLiteral(node) {
|
|
|
6602
6602
|
*/ function traverseUpGuard(node, predicate) {
|
|
6603
6603
|
const { parent } = node;
|
|
6604
6604
|
if (!parent || parent.type === NodeType.Program) {
|
|
6605
|
-
return
|
|
6605
|
+
return Option.none();
|
|
6606
6606
|
}
|
|
6607
|
-
return predicate(parent) ? parent : traverseUpGuard(parent, predicate);
|
|
6607
|
+
return predicate(parent) ? Option.some(parent) : traverseUpGuard(parent, predicate);
|
|
6608
6608
|
}
|
|
6609
6609
|
/**
|
|
6610
6610
|
* Find a variable through a list of variables by name
|
|
@@ -7178,11 +7178,7 @@ function isPropertyOfPragma(name, context, pragma = getPragmaFromContext(context
|
|
|
7178
7178
|
* @param context The rule context
|
|
7179
7179
|
* @returns `true` if the node is inside createElement's props
|
|
7180
7180
|
*/ function isInsideCreateElementProps(node, context) {
|
|
7181
|
-
|
|
7182
|
-
if (parentCreateElement?.type !== NodeType.CallExpression) {
|
|
7183
|
-
return false;
|
|
7184
|
-
}
|
|
7185
|
-
return parentCreateElement.arguments.at(1) === traverseUp(node, is(NodeType.ObjectExpression));
|
|
7181
|
+
return Function$1.pipe(traverseUp(node, (n)=>isCreateElementCall(n, context)), Option.filter(is(NodeType.CallExpression)), Option.flatMapNullable((c)=>c.arguments.at(1)), Option.filter(is(NodeType.ObjectExpression)), Option.zipWith(traverseUp(node, is(NodeType.ObjectExpression)), (a, b)=>a === b), Option.getOrElse(Function$1.constFalse));
|
|
7186
7182
|
}
|
|
7187
7183
|
function isChildrenOfCreateElement(node, context) {
|
|
7188
7184
|
const maybeCallExpression = node.parent;
|
|
@@ -7729,7 +7725,7 @@ function getProp(props, propName, context) {
|
|
|
7729
7725
|
const matcher = (node)=>{
|
|
7730
7726
|
return node.type === NodeType.JSXAttribute && predicate(node);
|
|
7731
7727
|
};
|
|
7732
|
-
return
|
|
7728
|
+
return traverseUpGuard(node, matcher);
|
|
7733
7729
|
}
|
|
7734
7730
|
|
|
7735
7731
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -6587,9 +6587,9 @@ function isStringLiteral(node) {
|
|
|
6587
6587
|
*/ function traverseUp(node, predicate) {
|
|
6588
6588
|
const { parent } = node;
|
|
6589
6589
|
if (!parent || parent.type === NodeType.Program) {
|
|
6590
|
-
return
|
|
6590
|
+
return Option.none();
|
|
6591
6591
|
}
|
|
6592
|
-
return predicate(parent) ? parent : traverseUp(parent, predicate);
|
|
6592
|
+
return predicate(parent) ? Option.some(parent) : traverseUp(parent, predicate);
|
|
6593
6593
|
}
|
|
6594
6594
|
/**
|
|
6595
6595
|
* Traverses up the AST tree until the predicate returns `true` or the root node is reached
|
|
@@ -6600,9 +6600,9 @@ function isStringLiteral(node) {
|
|
|
6600
6600
|
*/ function traverseUpGuard(node, predicate) {
|
|
6601
6601
|
const { parent } = node;
|
|
6602
6602
|
if (!parent || parent.type === NodeType.Program) {
|
|
6603
|
-
return
|
|
6603
|
+
return Option.none();
|
|
6604
6604
|
}
|
|
6605
|
-
return predicate(parent) ? parent : traverseUpGuard(parent, predicate);
|
|
6605
|
+
return predicate(parent) ? Option.some(parent) : traverseUpGuard(parent, predicate);
|
|
6606
6606
|
}
|
|
6607
6607
|
/**
|
|
6608
6608
|
* Find a variable through a list of variables by name
|
|
@@ -7176,11 +7176,7 @@ function isPropertyOfPragma(name, context, pragma = getPragmaFromContext(context
|
|
|
7176
7176
|
* @param context The rule context
|
|
7177
7177
|
* @returns `true` if the node is inside createElement's props
|
|
7178
7178
|
*/ function isInsideCreateElementProps(node, context) {
|
|
7179
|
-
|
|
7180
|
-
if (parentCreateElement?.type !== NodeType.CallExpression) {
|
|
7181
|
-
return false;
|
|
7182
|
-
}
|
|
7183
|
-
return parentCreateElement.arguments.at(1) === traverseUp(node, is(NodeType.ObjectExpression));
|
|
7179
|
+
return Function$1.pipe(traverseUp(node, (n)=>isCreateElementCall(n, context)), Option.filter(is(NodeType.CallExpression)), Option.flatMapNullable((c)=>c.arguments.at(1)), Option.filter(is(NodeType.ObjectExpression)), Option.zipWith(traverseUp(node, is(NodeType.ObjectExpression)), (a, b)=>a === b), Option.getOrElse(Function$1.constFalse));
|
|
7184
7180
|
}
|
|
7185
7181
|
function isChildrenOfCreateElement(node, context) {
|
|
7186
7182
|
const maybeCallExpression = node.parent;
|
|
@@ -7727,7 +7723,7 @@ function getProp(props, propName, context) {
|
|
|
7727
7723
|
const matcher = (node)=>{
|
|
7728
7724
|
return node.type === NodeType.JSXAttribute && predicate(node);
|
|
7729
7725
|
};
|
|
7730
|
-
return
|
|
7726
|
+
return traverseUpGuard(node, matcher);
|
|
7731
7727
|
}
|
|
7732
7728
|
|
|
7733
7729
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/jsx",
|
|
3
|
-
"version": "0.8.11
|
|
3
|
+
"version": "0.8.11",
|
|
4
4
|
"description": "ESLint x React's TSESTree AST utility module for static analysis of JSX.",
|
|
5
5
|
"homepage": "https://github.com/rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"micro-memoize": "4.1.2",
|
|
43
|
-
"@eslint-react/ast": "0.8.11
|
|
44
|
-
"@eslint-react/
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/shared": "0.8.11
|
|
43
|
+
"@eslint-react/ast": "0.8.11",
|
|
44
|
+
"@eslint-react/types": "0.8.11",
|
|
45
|
+
"@eslint-react/tools": "0.8.11",
|
|
46
|
+
"@eslint-react/shared": "0.8.11"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "rollup -c rollup.config.ts --configPlugin swc3 && cp dist/index.d.ts dist/index.d.mts",
|