eslint-plugin-react-x 2.0.0-next.43 → 2.0.0-next.45
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/README.md +1 -1
- package/dist/index.js +13 -13
- package/package.json +8 -8
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as VAR6 from '@eslint-react/var';
|
|
|
6
6
|
import { match, isMatching, P } from 'ts-pattern';
|
|
7
7
|
import * as ER26 from '@eslint-react/core';
|
|
8
8
|
import { JsxConfig, Reporter, Selector, LanguagePreference } from '@eslint-react/kit';
|
|
9
|
-
import { flow, identity, getOrElseUpdate, constTrue, constFalse,
|
|
9
|
+
import { flow, identity, getOrElseUpdate, constTrue, constFalse, unit, constVoid, not } from '@eslint-react/eff';
|
|
10
10
|
import { compare } from 'compare-versions';
|
|
11
11
|
import { getConstrainedTypeAtLocation, isTypeReadonly } from '@typescript-eslint/type-utils';
|
|
12
12
|
import { unionTypeParts, isTypeFlagSet, isTrueLiteralType, isFalseLiteralType } from 'ts-api-utils';
|
|
@@ -125,7 +125,7 @@ var settings3 = {
|
|
|
125
125
|
|
|
126
126
|
// package.json
|
|
127
127
|
var name4 = "eslint-plugin-react-x";
|
|
128
|
-
var version = "2.0.0-next.
|
|
128
|
+
var version = "2.0.0-next.45";
|
|
129
129
|
var createRule = ESLintUtils.RuleCreator(getDocsUrl("x"));
|
|
130
130
|
|
|
131
131
|
// src/rules/jsx-key-before-spread.ts
|
|
@@ -705,29 +705,29 @@ function isUsingReactChildren(context, node) {
|
|
|
705
705
|
function getMapIndexParamName(context, node) {
|
|
706
706
|
const { callee } = node;
|
|
707
707
|
if (callee.type !== AST_NODE_TYPES.MemberExpression) {
|
|
708
|
-
return
|
|
708
|
+
return unit;
|
|
709
709
|
}
|
|
710
710
|
if (callee.property.type !== AST_NODE_TYPES.Identifier) {
|
|
711
|
-
return
|
|
711
|
+
return unit;
|
|
712
712
|
}
|
|
713
713
|
const { name: name5 } = callee.property;
|
|
714
714
|
const indexPosition = AST21.getArrayMethodCallbackIndexParamPosition(name5);
|
|
715
715
|
if (indexPosition === -1) {
|
|
716
|
-
return
|
|
716
|
+
return unit;
|
|
717
717
|
}
|
|
718
718
|
const callbackArg = node.arguments[isUsingReactChildren(context, node) ? 1 : 0];
|
|
719
719
|
if (callbackArg == null) {
|
|
720
|
-
return
|
|
720
|
+
return unit;
|
|
721
721
|
}
|
|
722
722
|
if (!AST21.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(callbackArg)) {
|
|
723
|
-
return
|
|
723
|
+
return unit;
|
|
724
724
|
}
|
|
725
725
|
const { params } = callbackArg;
|
|
726
726
|
if (params.length < indexPosition + 1) {
|
|
727
|
-
return
|
|
727
|
+
return unit;
|
|
728
728
|
}
|
|
729
729
|
const param = params.at(indexPosition);
|
|
730
|
-
return param != null && "name" in param ? param.name :
|
|
730
|
+
return param != null && "name" in param ? param.name : unit;
|
|
731
731
|
}
|
|
732
732
|
function getIdentifiersFromBinaryExpression(side) {
|
|
733
733
|
if (side.type === AST_NODE_TYPES.Identifier) {
|
|
@@ -1761,9 +1761,9 @@ function create30(context) {
|
|
|
1761
1761
|
];
|
|
1762
1762
|
const services = ESLintUtils.getParserServices(context, false);
|
|
1763
1763
|
function getReportDescriptor(node) {
|
|
1764
|
-
if (node == null) return
|
|
1764
|
+
if (node == null) return unit;
|
|
1765
1765
|
if (AST21.is(AST_NODE_TYPES.JSXExpressionContainer)(node)) return getReportDescriptor(node.expression);
|
|
1766
|
-
if (AST21.isJSX(node)) return
|
|
1766
|
+
if (AST21.isJSX(node)) return unit;
|
|
1767
1767
|
if (AST21.isTypeExpression(node)) return getReportDescriptor(node.expression);
|
|
1768
1768
|
return match(node).with({ type: AST_NODE_TYPES.LogicalExpression, operator: "&&" }, ({ left, right }) => {
|
|
1769
1769
|
const isLeftUnaryNot = left.type === AST_NODE_TYPES.UnaryExpression && left.operator === "!";
|
|
@@ -1795,8 +1795,8 @@ function create30(context) {
|
|
|
1795
1795
|
}).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
|
|
1796
1796
|
const variable = VAR6.findVariable(n.name, context.sourceCode.getScope(n));
|
|
1797
1797
|
const variableDefNode = variable?.defs.at(0)?.node;
|
|
1798
|
-
return match(variableDefNode).with({ init: P.select({ type: P.not(AST_NODE_TYPES.VariableDeclaration) }) }, getReportDescriptor).otherwise(() =>
|
|
1799
|
-
}).otherwise(() =>
|
|
1798
|
+
return match(variableDefNode).with({ init: P.select({ type: P.not(AST_NODE_TYPES.VariableDeclaration) }) }, getReportDescriptor).otherwise(() => unit);
|
|
1799
|
+
}).otherwise(() => unit);
|
|
1800
1800
|
}
|
|
1801
1801
|
return {
|
|
1802
1802
|
JSXExpressionContainer: flow(getReportDescriptor, Reporter.make(context).send)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.45",
|
|
4
4
|
"description": "A set of composable ESLint rules for for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"is-immutable-type": "^5.0.1",
|
|
43
43
|
"string-ts": "^2.2.1",
|
|
44
44
|
"ts-pattern": "^5.7.1",
|
|
45
|
-
"@eslint-react/ast": "2.0.0-next.
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
45
|
+
"@eslint-react/ast": "2.0.0-next.45",
|
|
46
|
+
"@eslint-react/core": "2.0.0-next.45",
|
|
47
|
+
"@eslint-react/eff": "2.0.0-next.45",
|
|
48
|
+
"@eslint-react/kit": "2.0.0-next.45",
|
|
49
|
+
"@eslint-react/shared": "2.0.0-next.45",
|
|
50
|
+
"@eslint-react/var": "2.0.0-next.45"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/react": "^19.1.8",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@local/configs": "0.0.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"eslint": "^9.
|
|
60
|
+
"eslint": "^9.29.0",
|
|
61
61
|
"ts-api-utils": "^2.1.0",
|
|
62
62
|
"typescript": "^4.9.5 || ^5.4.5"
|
|
63
63
|
},
|