eslint-plugin-react-x 1.17.0 → 1.17.1-next.0
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 +41 -39
- package/dist/index.mjs +42 -40
- package/package.json +9 -8
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ var VAR = require('@eslint-react/var');
|
|
|
11
11
|
var typeUtils = require('@typescript-eslint/type-utils');
|
|
12
12
|
var utils = require('@typescript-eslint/utils');
|
|
13
13
|
var astUtils = require('@typescript-eslint/utils/ast-utils');
|
|
14
|
+
var compareVersions = require('compare-versions');
|
|
14
15
|
var ts25 = require('typescript');
|
|
15
16
|
var isImmutableType = require('is-immutable-type');
|
|
16
17
|
|
|
@@ -41,7 +42,7 @@ var ts25__default = /*#__PURE__*/_interopDefault(ts25);
|
|
|
41
42
|
|
|
42
43
|
// package.json
|
|
43
44
|
var name = "eslint-plugin-react-x";
|
|
44
|
-
var version = "1.17.0";
|
|
45
|
+
var version = "1.17.1-next.0";
|
|
45
46
|
var createRule = shared.createRuleForPlugin("x");
|
|
46
47
|
|
|
47
48
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1704,21 +1705,21 @@ var require_prerelease = __commonJS({
|
|
|
1704
1705
|
var require_compare = __commonJS({
|
|
1705
1706
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/compare.js"(exports, module) {
|
|
1706
1707
|
var SemVer = require_semver();
|
|
1707
|
-
var
|
|
1708
|
-
module.exports =
|
|
1708
|
+
var compare2 = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
1709
|
+
module.exports = compare2;
|
|
1709
1710
|
}
|
|
1710
1711
|
});
|
|
1711
1712
|
var require_rcompare = __commonJS({
|
|
1712
1713
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/rcompare.js"(exports, module) {
|
|
1713
|
-
var
|
|
1714
|
-
var rcompare = (a, b, loose) =>
|
|
1714
|
+
var compare2 = require_compare();
|
|
1715
|
+
var rcompare = (a, b, loose) => compare2(b, a, loose);
|
|
1715
1716
|
module.exports = rcompare;
|
|
1716
1717
|
}
|
|
1717
1718
|
});
|
|
1718
1719
|
var require_compare_loose = __commonJS({
|
|
1719
1720
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/compare-loose.js"(exports, module) {
|
|
1720
|
-
var
|
|
1721
|
-
var compareLoose = (a, b) =>
|
|
1721
|
+
var compare2 = require_compare();
|
|
1722
|
+
var compareLoose = (a, b) => compare2(a, b, true);
|
|
1722
1723
|
module.exports = compareLoose;
|
|
1723
1724
|
}
|
|
1724
1725
|
});
|
|
@@ -1749,43 +1750,43 @@ var require_rsort = __commonJS({
|
|
|
1749
1750
|
});
|
|
1750
1751
|
var require_gt = __commonJS({
|
|
1751
1752
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/gt.js"(exports, module) {
|
|
1752
|
-
var
|
|
1753
|
-
var gt = (a, b, loose) =>
|
|
1753
|
+
var compare2 = require_compare();
|
|
1754
|
+
var gt = (a, b, loose) => compare2(a, b, loose) > 0;
|
|
1754
1755
|
module.exports = gt;
|
|
1755
1756
|
}
|
|
1756
1757
|
});
|
|
1757
1758
|
var require_lt = __commonJS({
|
|
1758
1759
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/lt.js"(exports, module) {
|
|
1759
|
-
var
|
|
1760
|
-
var lt = (a, b, loose) =>
|
|
1760
|
+
var compare2 = require_compare();
|
|
1761
|
+
var lt = (a, b, loose) => compare2(a, b, loose) < 0;
|
|
1761
1762
|
module.exports = lt;
|
|
1762
1763
|
}
|
|
1763
1764
|
});
|
|
1764
1765
|
var require_eq = __commonJS({
|
|
1765
1766
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/eq.js"(exports, module) {
|
|
1766
|
-
var
|
|
1767
|
-
var eq = (a, b, loose) =>
|
|
1767
|
+
var compare2 = require_compare();
|
|
1768
|
+
var eq = (a, b, loose) => compare2(a, b, loose) === 0;
|
|
1768
1769
|
module.exports = eq;
|
|
1769
1770
|
}
|
|
1770
1771
|
});
|
|
1771
1772
|
var require_neq = __commonJS({
|
|
1772
1773
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/neq.js"(exports, module) {
|
|
1773
|
-
var
|
|
1774
|
-
var neq = (a, b, loose) =>
|
|
1774
|
+
var compare2 = require_compare();
|
|
1775
|
+
var neq = (a, b, loose) => compare2(a, b, loose) !== 0;
|
|
1775
1776
|
module.exports = neq;
|
|
1776
1777
|
}
|
|
1777
1778
|
});
|
|
1778
1779
|
var require_gte = __commonJS({
|
|
1779
1780
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/gte.js"(exports, module) {
|
|
1780
|
-
var
|
|
1781
|
-
var gte = (a, b, loose) =>
|
|
1781
|
+
var compare2 = require_compare();
|
|
1782
|
+
var gte = (a, b, loose) => compare2(a, b, loose) >= 0;
|
|
1782
1783
|
module.exports = gte;
|
|
1783
1784
|
}
|
|
1784
1785
|
});
|
|
1785
1786
|
var require_lte = __commonJS({
|
|
1786
1787
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/lte.js"(exports, module) {
|
|
1787
|
-
var
|
|
1788
|
-
var lte = (a, b, loose) =>
|
|
1788
|
+
var compare2 = require_compare();
|
|
1789
|
+
var lte = (a, b, loose) => compare2(a, b, loose) <= 0;
|
|
1789
1790
|
module.exports = lte;
|
|
1790
1791
|
}
|
|
1791
1792
|
});
|
|
@@ -2613,12 +2614,12 @@ var require_intersects = __commonJS({
|
|
|
2613
2614
|
var require_simplify = __commonJS({
|
|
2614
2615
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/ranges/simplify.js"(exports, module) {
|
|
2615
2616
|
var satisfies = require_satisfies();
|
|
2616
|
-
var
|
|
2617
|
+
var compare2 = require_compare();
|
|
2617
2618
|
module.exports = (versions, range, options) => {
|
|
2618
2619
|
const set = [];
|
|
2619
2620
|
let first = null;
|
|
2620
2621
|
let prev = null;
|
|
2621
|
-
const v = versions.sort((a, b) =>
|
|
2622
|
+
const v = versions.sort((a, b) => compare2(a, b, options));
|
|
2622
2623
|
for (const version2 of v) {
|
|
2623
2624
|
const included = satisfies(version2, range, options);
|
|
2624
2625
|
if (included) {
|
|
@@ -2663,7 +2664,7 @@ var require_subset = __commonJS({
|
|
|
2663
2664
|
var Comparator = require_comparator();
|
|
2664
2665
|
var { ANY } = Comparator;
|
|
2665
2666
|
var satisfies = require_satisfies();
|
|
2666
|
-
var
|
|
2667
|
+
var compare2 = require_compare();
|
|
2667
2668
|
var subset = (sub, dom, options = {}) => {
|
|
2668
2669
|
if (sub === dom) {
|
|
2669
2670
|
return true;
|
|
@@ -2724,7 +2725,7 @@ var require_subset = __commonJS({
|
|
|
2724
2725
|
}
|
|
2725
2726
|
let gtltComp;
|
|
2726
2727
|
if (gt && lt) {
|
|
2727
|
-
gtltComp =
|
|
2728
|
+
gtltComp = compare2(gt.semver, lt.semver, options);
|
|
2728
2729
|
if (gtltComp > 0) {
|
|
2729
2730
|
return null;
|
|
2730
2731
|
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
@@ -2804,14 +2805,14 @@ var require_subset = __commonJS({
|
|
|
2804
2805
|
if (!a) {
|
|
2805
2806
|
return b;
|
|
2806
2807
|
}
|
|
2807
|
-
const comp =
|
|
2808
|
+
const comp = compare2(a.semver, b.semver, options);
|
|
2808
2809
|
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
2809
2810
|
};
|
|
2810
2811
|
var lowerLT = (a, b, options) => {
|
|
2811
2812
|
if (!a) {
|
|
2812
2813
|
return b;
|
|
2813
2814
|
}
|
|
2814
|
-
const comp =
|
|
2815
|
+
const comp = compare2(a.semver, b.semver, options);
|
|
2815
2816
|
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
2816
2817
|
};
|
|
2817
2818
|
module.exports = subset;
|
|
@@ -2832,7 +2833,7 @@ var require_semver2 = __commonJS({
|
|
|
2832
2833
|
var minor = require_minor();
|
|
2833
2834
|
var patch = require_patch();
|
|
2834
2835
|
var prerelease = require_prerelease();
|
|
2835
|
-
var
|
|
2836
|
+
var compare2 = require_compare();
|
|
2836
2837
|
var rcompare = require_rcompare();
|
|
2837
2838
|
var compareLoose = require_compare_loose();
|
|
2838
2839
|
var compareBuild = require_compare_build();
|
|
@@ -2870,7 +2871,7 @@ var require_semver2 = __commonJS({
|
|
|
2870
2871
|
minor,
|
|
2871
2872
|
patch,
|
|
2872
2873
|
prerelease,
|
|
2873
|
-
compare,
|
|
2874
|
+
compare: compare2,
|
|
2874
2875
|
rcompare,
|
|
2875
2876
|
compareLoose,
|
|
2876
2877
|
compareBuild,
|
|
@@ -2935,18 +2936,6 @@ function unionTypeParts(type) {
|
|
|
2935
2936
|
return isUnionType(type) ? type.types : [type];
|
|
2936
2937
|
}
|
|
2937
2938
|
var RULE_NAME26 = "no-leaked-conditional-rendering";
|
|
2938
|
-
var allowedVariants = [
|
|
2939
|
-
"any",
|
|
2940
|
-
"boolean",
|
|
2941
|
-
"nullish",
|
|
2942
|
-
"object",
|
|
2943
|
-
"string",
|
|
2944
|
-
"falsy boolean",
|
|
2945
|
-
"truthy bigint",
|
|
2946
|
-
"truthy boolean",
|
|
2947
|
-
"truthy number",
|
|
2948
|
-
"truthy string"
|
|
2949
|
-
];
|
|
2950
2939
|
var tsHelpers = {
|
|
2951
2940
|
isAnyType: (type) => isTypeFlagSet(type, ts25__default.default.TypeFlags.TypeParameter | ts25__default.default.TypeFlags.Any),
|
|
2952
2941
|
isBigIntType: (type) => isTypeFlagSet(type, ts25__default.default.TypeFlags.BigIntLike),
|
|
@@ -3053,6 +3042,19 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
3053
3042
|
name: RULE_NAME26,
|
|
3054
3043
|
create(context) {
|
|
3055
3044
|
if (!context.sourceCode.text.includes("&&") && !context.sourceCode.text.includes("?")) return {};
|
|
3045
|
+
const { version: version2 } = shared.normalizeSettings(shared.decodeSettings(context.settings));
|
|
3046
|
+
const allowedVariants = [
|
|
3047
|
+
"any",
|
|
3048
|
+
"boolean",
|
|
3049
|
+
"nullish",
|
|
3050
|
+
"object",
|
|
3051
|
+
"falsy boolean",
|
|
3052
|
+
"truthy bigint",
|
|
3053
|
+
"truthy boolean",
|
|
3054
|
+
"truthy number",
|
|
3055
|
+
"truthy string",
|
|
3056
|
+
...compareVersions.compare(version2, "18.0.0", "<") ? [] : ["string", "falsy string"]
|
|
3057
|
+
];
|
|
3056
3058
|
const services = utils.ESLintUtils.getParserServices(context, false);
|
|
3057
3059
|
function getReportDescriptor(node) {
|
|
3058
3060
|
return tsPattern.match(node).when(AST11__namespace.isJSX, tools.O.none).with({ type: types.AST_NODE_TYPES.LogicalExpression, operator: "&&" }, ({ left, right }) => {
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as JSX7 from '@eslint-react/jsx';
|
|
2
2
|
import { F, O, isString, MutRef, isNullable } from '@eslint-react/tools';
|
|
3
|
-
import { createRuleForPlugin, decodeSettings, unsafeReadSettings } from '@eslint-react/shared';
|
|
3
|
+
import { createRuleForPlugin, normalizeSettings, decodeSettings, unsafeReadSettings } from '@eslint-react/shared';
|
|
4
4
|
import * as AST11 from '@eslint-react/ast';
|
|
5
5
|
import { isForwardRefCall, isThisSetState, isClassComponent, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, useComponentCollectorLegacy, isCloneElementCall, isCreateRefCall, isComponentName, isChildrenToArrayCall, useComponentCollector, ERFunctionComponentFlag, ERComponentHint, isDirectValueOfRenderPropertyLoose, isDeclaredInRenderPropLoose, isInsideCreateElementProps, isInsideRenderMethod, ERClassComponentFlag, isFragmentElement, isCreateElementCall, isInitializedFromReact } from '@eslint-react/core';
|
|
6
6
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
@@ -9,12 +9,13 @@ import * as VAR from '@eslint-react/var';
|
|
|
9
9
|
import { getConstrainedTypeAtLocation, isTypeReadonly } from '@typescript-eslint/type-utils';
|
|
10
10
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
11
11
|
import { getStaticValue } from '@typescript-eslint/utils/ast-utils';
|
|
12
|
+
import { compare } from 'compare-versions';
|
|
12
13
|
import ts25 from 'typescript';
|
|
13
14
|
import { getTypeImmutability, isUnknown, isImmutable, isReadonlyShallow, isReadonlyDeep } from 'is-immutable-type';
|
|
14
15
|
|
|
15
16
|
// package.json
|
|
16
17
|
var name = "eslint-plugin-react-x";
|
|
17
|
-
var version = "1.17.0";
|
|
18
|
+
var version = "1.17.1-next.0";
|
|
18
19
|
var createRule = createRuleForPlugin("x");
|
|
19
20
|
|
|
20
21
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -1677,21 +1678,21 @@ var require_prerelease = __commonJS({
|
|
|
1677
1678
|
var require_compare = __commonJS({
|
|
1678
1679
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/compare.js"(exports, module) {
|
|
1679
1680
|
var SemVer = require_semver();
|
|
1680
|
-
var
|
|
1681
|
-
module.exports =
|
|
1681
|
+
var compare2 = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
1682
|
+
module.exports = compare2;
|
|
1682
1683
|
}
|
|
1683
1684
|
});
|
|
1684
1685
|
var require_rcompare = __commonJS({
|
|
1685
1686
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/rcompare.js"(exports, module) {
|
|
1686
|
-
var
|
|
1687
|
-
var rcompare = (a, b, loose) =>
|
|
1687
|
+
var compare2 = require_compare();
|
|
1688
|
+
var rcompare = (a, b, loose) => compare2(b, a, loose);
|
|
1688
1689
|
module.exports = rcompare;
|
|
1689
1690
|
}
|
|
1690
1691
|
});
|
|
1691
1692
|
var require_compare_loose = __commonJS({
|
|
1692
1693
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/compare-loose.js"(exports, module) {
|
|
1693
|
-
var
|
|
1694
|
-
var compareLoose = (a, b) =>
|
|
1694
|
+
var compare2 = require_compare();
|
|
1695
|
+
var compareLoose = (a, b) => compare2(a, b, true);
|
|
1695
1696
|
module.exports = compareLoose;
|
|
1696
1697
|
}
|
|
1697
1698
|
});
|
|
@@ -1722,43 +1723,43 @@ var require_rsort = __commonJS({
|
|
|
1722
1723
|
});
|
|
1723
1724
|
var require_gt = __commonJS({
|
|
1724
1725
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/gt.js"(exports, module) {
|
|
1725
|
-
var
|
|
1726
|
-
var gt = (a, b, loose) =>
|
|
1726
|
+
var compare2 = require_compare();
|
|
1727
|
+
var gt = (a, b, loose) => compare2(a, b, loose) > 0;
|
|
1727
1728
|
module.exports = gt;
|
|
1728
1729
|
}
|
|
1729
1730
|
});
|
|
1730
1731
|
var require_lt = __commonJS({
|
|
1731
1732
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/lt.js"(exports, module) {
|
|
1732
|
-
var
|
|
1733
|
-
var lt = (a, b, loose) =>
|
|
1733
|
+
var compare2 = require_compare();
|
|
1734
|
+
var lt = (a, b, loose) => compare2(a, b, loose) < 0;
|
|
1734
1735
|
module.exports = lt;
|
|
1735
1736
|
}
|
|
1736
1737
|
});
|
|
1737
1738
|
var require_eq = __commonJS({
|
|
1738
1739
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/eq.js"(exports, module) {
|
|
1739
|
-
var
|
|
1740
|
-
var eq = (a, b, loose) =>
|
|
1740
|
+
var compare2 = require_compare();
|
|
1741
|
+
var eq = (a, b, loose) => compare2(a, b, loose) === 0;
|
|
1741
1742
|
module.exports = eq;
|
|
1742
1743
|
}
|
|
1743
1744
|
});
|
|
1744
1745
|
var require_neq = __commonJS({
|
|
1745
1746
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/neq.js"(exports, module) {
|
|
1746
|
-
var
|
|
1747
|
-
var neq = (a, b, loose) =>
|
|
1747
|
+
var compare2 = require_compare();
|
|
1748
|
+
var neq = (a, b, loose) => compare2(a, b, loose) !== 0;
|
|
1748
1749
|
module.exports = neq;
|
|
1749
1750
|
}
|
|
1750
1751
|
});
|
|
1751
1752
|
var require_gte = __commonJS({
|
|
1752
1753
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/gte.js"(exports, module) {
|
|
1753
|
-
var
|
|
1754
|
-
var gte = (a, b, loose) =>
|
|
1754
|
+
var compare2 = require_compare();
|
|
1755
|
+
var gte = (a, b, loose) => compare2(a, b, loose) >= 0;
|
|
1755
1756
|
module.exports = gte;
|
|
1756
1757
|
}
|
|
1757
1758
|
});
|
|
1758
1759
|
var require_lte = __commonJS({
|
|
1759
1760
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/lte.js"(exports, module) {
|
|
1760
|
-
var
|
|
1761
|
-
var lte = (a, b, loose) =>
|
|
1761
|
+
var compare2 = require_compare();
|
|
1762
|
+
var lte = (a, b, loose) => compare2(a, b, loose) <= 0;
|
|
1762
1763
|
module.exports = lte;
|
|
1763
1764
|
}
|
|
1764
1765
|
});
|
|
@@ -2586,12 +2587,12 @@ var require_intersects = __commonJS({
|
|
|
2586
2587
|
var require_simplify = __commonJS({
|
|
2587
2588
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/ranges/simplify.js"(exports, module) {
|
|
2588
2589
|
var satisfies = require_satisfies();
|
|
2589
|
-
var
|
|
2590
|
+
var compare2 = require_compare();
|
|
2590
2591
|
module.exports = (versions, range, options) => {
|
|
2591
2592
|
const set = [];
|
|
2592
2593
|
let first = null;
|
|
2593
2594
|
let prev = null;
|
|
2594
|
-
const v = versions.sort((a, b) =>
|
|
2595
|
+
const v = versions.sort((a, b) => compare2(a, b, options));
|
|
2595
2596
|
for (const version2 of v) {
|
|
2596
2597
|
const included = satisfies(version2, range, options);
|
|
2597
2598
|
if (included) {
|
|
@@ -2636,7 +2637,7 @@ var require_subset = __commonJS({
|
|
|
2636
2637
|
var Comparator = require_comparator();
|
|
2637
2638
|
var { ANY } = Comparator;
|
|
2638
2639
|
var satisfies = require_satisfies();
|
|
2639
|
-
var
|
|
2640
|
+
var compare2 = require_compare();
|
|
2640
2641
|
var subset = (sub, dom, options = {}) => {
|
|
2641
2642
|
if (sub === dom) {
|
|
2642
2643
|
return true;
|
|
@@ -2697,7 +2698,7 @@ var require_subset = __commonJS({
|
|
|
2697
2698
|
}
|
|
2698
2699
|
let gtltComp;
|
|
2699
2700
|
if (gt && lt) {
|
|
2700
|
-
gtltComp =
|
|
2701
|
+
gtltComp = compare2(gt.semver, lt.semver, options);
|
|
2701
2702
|
if (gtltComp > 0) {
|
|
2702
2703
|
return null;
|
|
2703
2704
|
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
@@ -2777,14 +2778,14 @@ var require_subset = __commonJS({
|
|
|
2777
2778
|
if (!a) {
|
|
2778
2779
|
return b;
|
|
2779
2780
|
}
|
|
2780
|
-
const comp =
|
|
2781
|
+
const comp = compare2(a.semver, b.semver, options);
|
|
2781
2782
|
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
2782
2783
|
};
|
|
2783
2784
|
var lowerLT = (a, b, options) => {
|
|
2784
2785
|
if (!a) {
|
|
2785
2786
|
return b;
|
|
2786
2787
|
}
|
|
2787
|
-
const comp =
|
|
2788
|
+
const comp = compare2(a.semver, b.semver, options);
|
|
2788
2789
|
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
2789
2790
|
};
|
|
2790
2791
|
module.exports = subset;
|
|
@@ -2805,7 +2806,7 @@ var require_semver2 = __commonJS({
|
|
|
2805
2806
|
var minor = require_minor();
|
|
2806
2807
|
var patch = require_patch();
|
|
2807
2808
|
var prerelease = require_prerelease();
|
|
2808
|
-
var
|
|
2809
|
+
var compare2 = require_compare();
|
|
2809
2810
|
var rcompare = require_rcompare();
|
|
2810
2811
|
var compareLoose = require_compare_loose();
|
|
2811
2812
|
var compareBuild = require_compare_build();
|
|
@@ -2843,7 +2844,7 @@ var require_semver2 = __commonJS({
|
|
|
2843
2844
|
minor,
|
|
2844
2845
|
patch,
|
|
2845
2846
|
prerelease,
|
|
2846
|
-
compare,
|
|
2847
|
+
compare: compare2,
|
|
2847
2848
|
rcompare,
|
|
2848
2849
|
compareLoose,
|
|
2849
2850
|
compareBuild,
|
|
@@ -2908,18 +2909,6 @@ function unionTypeParts(type) {
|
|
|
2908
2909
|
return isUnionType(type) ? type.types : [type];
|
|
2909
2910
|
}
|
|
2910
2911
|
var RULE_NAME26 = "no-leaked-conditional-rendering";
|
|
2911
|
-
var allowedVariants = [
|
|
2912
|
-
"any",
|
|
2913
|
-
"boolean",
|
|
2914
|
-
"nullish",
|
|
2915
|
-
"object",
|
|
2916
|
-
"string",
|
|
2917
|
-
"falsy boolean",
|
|
2918
|
-
"truthy bigint",
|
|
2919
|
-
"truthy boolean",
|
|
2920
|
-
"truthy number",
|
|
2921
|
-
"truthy string"
|
|
2922
|
-
];
|
|
2923
2912
|
var tsHelpers = {
|
|
2924
2913
|
isAnyType: (type) => isTypeFlagSet(type, ts25.TypeFlags.TypeParameter | ts25.TypeFlags.Any),
|
|
2925
2914
|
isBigIntType: (type) => isTypeFlagSet(type, ts25.TypeFlags.BigIntLike),
|
|
@@ -3026,6 +3015,19 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
3026
3015
|
name: RULE_NAME26,
|
|
3027
3016
|
create(context) {
|
|
3028
3017
|
if (!context.sourceCode.text.includes("&&") && !context.sourceCode.text.includes("?")) return {};
|
|
3018
|
+
const { version: version2 } = normalizeSettings(decodeSettings(context.settings));
|
|
3019
|
+
const allowedVariants = [
|
|
3020
|
+
"any",
|
|
3021
|
+
"boolean",
|
|
3022
|
+
"nullish",
|
|
3023
|
+
"object",
|
|
3024
|
+
"falsy boolean",
|
|
3025
|
+
"truthy bigint",
|
|
3026
|
+
"truthy boolean",
|
|
3027
|
+
"truthy number",
|
|
3028
|
+
"truthy string",
|
|
3029
|
+
...compare(version2, "18.0.0", "<") ? [] : ["string", "falsy string"]
|
|
3030
|
+
];
|
|
3029
3031
|
const services = ESLintUtils.getParserServices(context, false);
|
|
3030
3032
|
function getReportDescriptor(node) {
|
|
3031
3033
|
return match(node).when(AST11.isJSX, O.none).with({ type: AST_NODE_TYPES.LogicalExpression, operator: "&&" }, ({ left, right }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.17.0",
|
|
3
|
+
"version": "1.17.1-next.0",
|
|
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
|
"eslint",
|
|
@@ -46,15 +46,16 @@
|
|
|
46
46
|
"@typescript-eslint/type-utils": "^8.15.0",
|
|
47
47
|
"@typescript-eslint/types": "^8.15.0",
|
|
48
48
|
"@typescript-eslint/utils": "^8.15.0",
|
|
49
|
+
"compare-versions": "^6.1.1",
|
|
49
50
|
"is-immutable-type": "5.0.0",
|
|
50
51
|
"ts-pattern": "^5.5.0",
|
|
51
|
-
"@eslint-react/ast": "1.17.0",
|
|
52
|
-
"@eslint-react/core": "1.17.0",
|
|
53
|
-
"@eslint-react/jsx": "1.17.0",
|
|
54
|
-
"@eslint-react/shared": "1.17.0",
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/var": "1.17.0"
|
|
52
|
+
"@eslint-react/ast": "1.17.1-next.0",
|
|
53
|
+
"@eslint-react/core": "1.17.1-next.0",
|
|
54
|
+
"@eslint-react/jsx": "1.17.1-next.0",
|
|
55
|
+
"@eslint-react/shared": "1.17.1-next.0",
|
|
56
|
+
"@eslint-react/tools": "1.17.1-next.0",
|
|
57
|
+
"@eslint-react/types": "1.17.1-next.0",
|
|
58
|
+
"@eslint-react/var": "1.17.1-next.0"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@types/react": "^18.3.12",
|