eslint-plugin-react-x 1.23.3-next.0 → 1.23.3-next.2
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 +8 -18
- package/dist/index.mjs +9 -19
- package/package.json +8 -8
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.23.3-next.
|
|
45
|
+
var version = "1.23.3-next.2";
|
|
46
46
|
var createRule = shared.createRuleForPlugin("x");
|
|
47
47
|
|
|
48
48
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -650,22 +650,12 @@ var RULE_NAME12 = "no-class-component";
|
|
|
650
650
|
var RULE_FEATURES12 = [
|
|
651
651
|
"CHK"
|
|
652
652
|
];
|
|
653
|
-
|
|
654
|
-
key
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
static: false
|
|
660
|
-
});
|
|
661
|
-
var isGetDerivedStateFromError = tsPattern.isMatching({
|
|
662
|
-
key: {
|
|
663
|
-
type: types.AST_NODE_TYPES.Identifier,
|
|
664
|
-
name: "getDerivedStateFromError"
|
|
665
|
-
},
|
|
666
|
-
type: tsPattern.P.union(types.AST_NODE_TYPES.MethodDefinition, types.AST_NODE_TYPES.PropertyDefinition),
|
|
667
|
-
static: true
|
|
668
|
-
});
|
|
653
|
+
function isComponentDidCatch(node) {
|
|
654
|
+
return (node.type === types.AST_NODE_TYPES.MethodDefinition || node.type === types.AST_NODE_TYPES.PropertyDefinition) && !node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentDidCatch";
|
|
655
|
+
}
|
|
656
|
+
function isGetDerivedStateFromError(node) {
|
|
657
|
+
return (node.type === types.AST_NODE_TYPES.MethodDefinition || node.type === types.AST_NODE_TYPES.PropertyDefinition) && node.static && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "getDerivedStateFromError";
|
|
658
|
+
}
|
|
669
659
|
var no_class_component_default = createRule({
|
|
670
660
|
meta: {
|
|
671
661
|
type: "problem",
|
|
@@ -1851,7 +1841,7 @@ var no_nested_components_default = createRule({
|
|
|
1851
1841
|
},
|
|
1852
1842
|
name: RULE_NAME30,
|
|
1853
1843
|
create(context) {
|
|
1854
|
-
const hint = core.ERComponentHint.SkipMapCallback | core.ERComponentHint.SkipNullLiteral | core.ERComponentHint.
|
|
1844
|
+
const hint = core.ERComponentHint.SkipMapCallback | core.ERComponentHint.SkipNullLiteral | core.ERComponentHint.SkipUndefined | core.ERComponentHint.SkipBooleanLiteral | core.ERComponentHint.SkipStringLiteral | core.ERComponentHint.SkipNumberLiteral | core.ERComponentHint.StrictLogical | core.ERComponentHint.StrictConditional;
|
|
1855
1845
|
const collector = core.useComponentCollector(context, hint);
|
|
1856
1846
|
const collectorLegacy = core.useComponentCollectorLegacy();
|
|
1857
1847
|
return {
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { createRuleForPlugin, getSettingsFromContext, unsafeDecodeSettings } fro
|
|
|
4
4
|
import * as AST11 from '@eslint-react/ast';
|
|
5
5
|
import { isForwardRefCall, isThisSetState, isClassComponent, isCreateElementCall, isCloneElementCall, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, useComponentCollectorLegacy, isCreateRefCall, isComponentName, useComponentCollector, ERFunctionComponentFlag, isChildrenToArrayCall, ERComponentHint, isDirectValueOfRenderPropertyLoose, isDeclaredInRenderPropLoose, isInsideCreateElementProps, isInsideRenderMethod, ERClassComponentFlag, isReactHookCall, isInitializedFromReact } from '@eslint-react/core';
|
|
6
6
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
7
|
-
import { isMatching,
|
|
7
|
+
import { isMatching, match, P } from 'ts-pattern';
|
|
8
8
|
import { compare } from 'compare-versions';
|
|
9
9
|
import * as VAR from '@eslint-react/var';
|
|
10
10
|
import { getConstrainedTypeAtLocation, isTypeReadonly } from '@typescript-eslint/type-utils';
|
|
@@ -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.23.3-next.
|
|
18
|
+
var version = "1.23.3-next.2";
|
|
19
19
|
var createRule = createRuleForPlugin("x");
|
|
20
20
|
|
|
21
21
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -623,22 +623,12 @@ var RULE_NAME12 = "no-class-component";
|
|
|
623
623
|
var RULE_FEATURES12 = [
|
|
624
624
|
"CHK"
|
|
625
625
|
];
|
|
626
|
-
|
|
627
|
-
key
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
static: false
|
|
633
|
-
});
|
|
634
|
-
var isGetDerivedStateFromError = isMatching({
|
|
635
|
-
key: {
|
|
636
|
-
type: AST_NODE_TYPES.Identifier,
|
|
637
|
-
name: "getDerivedStateFromError"
|
|
638
|
-
},
|
|
639
|
-
type: P.union(AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition),
|
|
640
|
-
static: true
|
|
641
|
-
});
|
|
626
|
+
function isComponentDidCatch(node) {
|
|
627
|
+
return (node.type === AST_NODE_TYPES.MethodDefinition || node.type === AST_NODE_TYPES.PropertyDefinition) && !node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidCatch";
|
|
628
|
+
}
|
|
629
|
+
function isGetDerivedStateFromError(node) {
|
|
630
|
+
return (node.type === AST_NODE_TYPES.MethodDefinition || node.type === AST_NODE_TYPES.PropertyDefinition) && node.static && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "getDerivedStateFromError";
|
|
631
|
+
}
|
|
642
632
|
var no_class_component_default = createRule({
|
|
643
633
|
meta: {
|
|
644
634
|
type: "problem",
|
|
@@ -1824,7 +1814,7 @@ var no_nested_components_default = createRule({
|
|
|
1824
1814
|
},
|
|
1825
1815
|
name: RULE_NAME30,
|
|
1826
1816
|
create(context) {
|
|
1827
|
-
const hint = ERComponentHint.SkipMapCallback | ERComponentHint.SkipNullLiteral | ERComponentHint.
|
|
1817
|
+
const hint = ERComponentHint.SkipMapCallback | ERComponentHint.SkipNullLiteral | ERComponentHint.SkipUndefined | ERComponentHint.SkipBooleanLiteral | ERComponentHint.SkipStringLiteral | ERComponentHint.SkipNumberLiteral | ERComponentHint.StrictLogical | ERComponentHint.StrictConditional;
|
|
1828
1818
|
const collector = useComponentCollector(context, hint);
|
|
1829
1819
|
const collectorLegacy = useComponentCollectorLegacy();
|
|
1830
1820
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.23.3-next.
|
|
3
|
+
"version": "1.23.3-next.2",
|
|
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",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"string-ts": "^2.2.0",
|
|
52
52
|
"ts-api-utils": "^2.0.0",
|
|
53
53
|
"ts-pattern": "^5.6.0",
|
|
54
|
-
"@eslint-react/ast": "1.23.3-next.
|
|
55
|
-
"@eslint-react/core": "1.23.3-next.
|
|
56
|
-
"@eslint-react/eff": "1.23.3-next.
|
|
57
|
-
"@eslint-react/jsx": "1.23.3-next.
|
|
58
|
-
"@eslint-react/shared": "1.23.3-next.
|
|
59
|
-
"@eslint-react/types": "1.23.3-next.
|
|
60
|
-
"@eslint-react/var": "1.23.3-next.
|
|
54
|
+
"@eslint-react/ast": "1.23.3-next.2",
|
|
55
|
+
"@eslint-react/core": "1.23.3-next.2",
|
|
56
|
+
"@eslint-react/eff": "1.23.3-next.2",
|
|
57
|
+
"@eslint-react/jsx": "1.23.3-next.2",
|
|
58
|
+
"@eslint-react/shared": "1.23.3-next.2",
|
|
59
|
+
"@eslint-react/types": "1.23.3-next.2",
|
|
60
|
+
"@eslint-react/var": "1.23.3-next.2"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/react": "^19.0.3",
|