eslint-plugin-react-x 1.24.0 → 1.24.1-beta.1
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 +4 -15
- package/dist/index.mjs +6 -17
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ var ts__default = /*#__PURE__*/_interopDefault(ts);
|
|
|
42
42
|
|
|
43
43
|
// package.json
|
|
44
44
|
var name = "eslint-plugin-react-x";
|
|
45
|
-
var version = "1.24.
|
|
45
|
+
var version = "1.24.1-beta.1";
|
|
46
46
|
var createRule = shared.createRuleForPlugin("x");
|
|
47
47
|
|
|
48
48
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1532,17 +1532,6 @@ function inspectVariantTypes(types) {
|
|
|
1532
1532
|
}
|
|
1533
1533
|
return variantTypes;
|
|
1534
1534
|
}
|
|
1535
|
-
function isInitExpression(node) {
|
|
1536
|
-
if (node == null) return false;
|
|
1537
|
-
return node.type !== types.AST_NODE_TYPES.VariableDeclaration;
|
|
1538
|
-
}
|
|
1539
|
-
function getVariableInitExpression(variable, at) {
|
|
1540
|
-
const def = variable?.defs[at];
|
|
1541
|
-
if (def?.node == null || !("init" in def.node)) {
|
|
1542
|
-
return eff._;
|
|
1543
|
-
}
|
|
1544
|
-
return isInitExpression(def.node.init) ? def.node.init : eff._;
|
|
1545
|
-
}
|
|
1546
1535
|
var no_leaked_conditional_rendering_default = createRule({
|
|
1547
1536
|
meta: {
|
|
1548
1537
|
type: "problem",
|
|
@@ -1605,7 +1594,7 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1605
1594
|
return getReportDescriptor(consequent) ?? getReportDescriptor(alternate);
|
|
1606
1595
|
}).with({ type: types.AST_NODE_TYPES.Identifier }, (n) => {
|
|
1607
1596
|
const variable = VAR__namespace.findVariable(n.name, context.sourceCode.getScope(n));
|
|
1608
|
-
const initExpression =
|
|
1597
|
+
const initExpression = tsPattern.match(variable?.defs.at(0)?.node).with({ init: tsPattern.P.select({ type: tsPattern.P.not(types.AST_NODE_TYPES.VariableDeclaration) }) }, eff.identity).otherwise(() => eff._);
|
|
1609
1598
|
return getReportDescriptor(initExpression);
|
|
1610
1599
|
}).otherwise(() => eff._);
|
|
1611
1600
|
}
|
|
@@ -1658,7 +1647,7 @@ var no_missing_component_display_name_default = createRule({
|
|
|
1658
1647
|
"Program:exit"(node) {
|
|
1659
1648
|
const components = ctx.getAllComponents(node);
|
|
1660
1649
|
for (const { node: node2, displayName, flag } of components.values()) {
|
|
1661
|
-
const isMemoOrForwardRef = (flag & (core.
|
|
1650
|
+
const isMemoOrForwardRef = (flag & (core.ERComponentFlag.ForwardRef | core.ERComponentFlag.Memo)) > 0n;
|
|
1662
1651
|
if (AST11__namespace.getFunctionIdentifier(node2) != null) {
|
|
1663
1652
|
continue;
|
|
1664
1653
|
}
|
|
@@ -2011,7 +2000,7 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
2011
2000
|
"Program:exit"(node) {
|
|
2012
2001
|
const components = ctx.getAllComponents(node);
|
|
2013
2002
|
for (const { name: name2 = "PureComponent", node: component, flag } of components.values()) {
|
|
2014
|
-
if ((flag & core.
|
|
2003
|
+
if ((flag & core.ERComponentFlag.PureComponent) === 0n) {
|
|
2015
2004
|
continue;
|
|
2016
2005
|
}
|
|
2017
2006
|
const { body } = component.body;
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as JSX7 from '@eslint-react/jsx';
|
|
2
2
|
import { createRuleForPlugin, getSettingsFromContext, unsafeDecodeSettings } from '@eslint-react/shared';
|
|
3
3
|
import * as AST11 from '@eslint-react/ast';
|
|
4
|
-
import { isForwardRefCall, isThisSetState, isClassComponent, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, useComponentCollectorLegacy, isComponentDidCatch, isGetDerivedStateFromError, isCloneElementCall, isCreateRefCall, isComponentName, useComponentCollector, DEFAULT_COMPONENT_HINT,
|
|
5
|
-
import { _, getOrUpdate } from '@eslint-react/eff';
|
|
4
|
+
import { isForwardRefCall, isThisSetState, isClassComponent, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, useComponentCollectorLegacy, isComponentDidCatch, isGetDerivedStateFromError, isCloneElementCall, isCreateRefCall, isComponentName, useComponentCollector, DEFAULT_COMPONENT_HINT, ERComponentFlag, isChildrenToArrayCall, ERComponentHint, isDirectValueOfRenderPropertyLoose, isDeclaredInRenderPropLoose, isInsideCreateElementProps, isInsideRenderMethod, isReactHookCall, isCreateElementCall, isGetDerivedStateFromProps, isInitializedFromReact } from '@eslint-react/core';
|
|
5
|
+
import { _, getOrUpdate, identity } from '@eslint-react/eff';
|
|
6
6
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
7
7
|
import { isMatching, match, P } from 'ts-pattern';
|
|
8
8
|
import { compare } from 'compare-versions';
|
|
@@ -15,7 +15,7 @@ import { getTypeImmutability, isUnknown, isImmutable, isReadonlyShallow, isReado
|
|
|
15
15
|
|
|
16
16
|
// package.json
|
|
17
17
|
var name = "eslint-plugin-react-x";
|
|
18
|
-
var version = "1.24.
|
|
18
|
+
var version = "1.24.1-beta.1";
|
|
19
19
|
var createRule = createRuleForPlugin("x");
|
|
20
20
|
|
|
21
21
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1505,17 +1505,6 @@ function inspectVariantTypes(types) {
|
|
|
1505
1505
|
}
|
|
1506
1506
|
return variantTypes;
|
|
1507
1507
|
}
|
|
1508
|
-
function isInitExpression(node) {
|
|
1509
|
-
if (node == null) return false;
|
|
1510
|
-
return node.type !== AST_NODE_TYPES.VariableDeclaration;
|
|
1511
|
-
}
|
|
1512
|
-
function getVariableInitExpression(variable, at) {
|
|
1513
|
-
const def = variable?.defs[at];
|
|
1514
|
-
if (def?.node == null || !("init" in def.node)) {
|
|
1515
|
-
return _;
|
|
1516
|
-
}
|
|
1517
|
-
return isInitExpression(def.node.init) ? def.node.init : _;
|
|
1518
|
-
}
|
|
1519
1508
|
var no_leaked_conditional_rendering_default = createRule({
|
|
1520
1509
|
meta: {
|
|
1521
1510
|
type: "problem",
|
|
@@ -1578,7 +1567,7 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1578
1567
|
return getReportDescriptor(consequent) ?? getReportDescriptor(alternate);
|
|
1579
1568
|
}).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
|
|
1580
1569
|
const variable = VAR.findVariable(n.name, context.sourceCode.getScope(n));
|
|
1581
|
-
const initExpression =
|
|
1570
|
+
const initExpression = match(variable?.defs.at(0)?.node).with({ init: P.select({ type: P.not(AST_NODE_TYPES.VariableDeclaration) }) }, identity).otherwise(() => _);
|
|
1582
1571
|
return getReportDescriptor(initExpression);
|
|
1583
1572
|
}).otherwise(() => _);
|
|
1584
1573
|
}
|
|
@@ -1631,7 +1620,7 @@ var no_missing_component_display_name_default = createRule({
|
|
|
1631
1620
|
"Program:exit"(node) {
|
|
1632
1621
|
const components = ctx.getAllComponents(node);
|
|
1633
1622
|
for (const { node: node2, displayName, flag } of components.values()) {
|
|
1634
|
-
const isMemoOrForwardRef = (flag & (
|
|
1623
|
+
const isMemoOrForwardRef = (flag & (ERComponentFlag.ForwardRef | ERComponentFlag.Memo)) > 0n;
|
|
1635
1624
|
if (AST11.getFunctionIdentifier(node2) != null) {
|
|
1636
1625
|
continue;
|
|
1637
1626
|
}
|
|
@@ -1984,7 +1973,7 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
1984
1973
|
"Program:exit"(node) {
|
|
1985
1974
|
const components = ctx.getAllComponents(node);
|
|
1986
1975
|
for (const { name: name2 = "PureComponent", node: component, flag } of components.values()) {
|
|
1987
|
-
if ((flag &
|
|
1976
|
+
if ((flag & ERComponentFlag.PureComponent) === 0n) {
|
|
1988
1977
|
continue;
|
|
1989
1978
|
}
|
|
1990
1979
|
const { body } = component.body;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.1-beta.1",
|
|
4
4
|
"description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -40,20 +40,20 @@
|
|
|
40
40
|
"./package.json"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
44
|
-
"@typescript-eslint/type-utils": "^8.
|
|
45
|
-
"@typescript-eslint/types": "^8.
|
|
46
|
-
"@typescript-eslint/utils": "^8.
|
|
43
|
+
"@typescript-eslint/scope-manager": "^8.21.0",
|
|
44
|
+
"@typescript-eslint/type-utils": "^8.21.0",
|
|
45
|
+
"@typescript-eslint/types": "^8.21.0",
|
|
46
|
+
"@typescript-eslint/utils": "^8.21.0",
|
|
47
47
|
"compare-versions": "^6.1.1",
|
|
48
48
|
"is-immutable-type": "^5.0.1",
|
|
49
49
|
"string-ts": "^2.2.0",
|
|
50
|
-
"ts-pattern": "^5.6.
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
50
|
+
"ts-pattern": "^5.6.2",
|
|
51
|
+
"@eslint-react/ast": "1.24.1-beta.1",
|
|
52
|
+
"@eslint-react/core": "1.24.1-beta.1",
|
|
53
|
+
"@eslint-react/eff": "1.24.1-beta.1",
|
|
54
|
+
"@eslint-react/jsx": "1.24.1-beta.1",
|
|
55
|
+
"@eslint-react/shared": "1.24.1-beta.1",
|
|
56
|
+
"@eslint-react/var": "1.24.1-beta.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/react": "^19.0.7",
|