eslint-plugin-react-x 1.45.3 → 1.45.4-beta.5
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 +14 -14
- package/dist/index.mjs +16 -16
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -143,7 +143,7 @@ var settings3 = {
|
|
|
143
143
|
|
|
144
144
|
// package.json
|
|
145
145
|
var name4 = "eslint-plugin-react-x";
|
|
146
|
-
var version = "1.45.
|
|
146
|
+
var version = "1.45.4-beta.5";
|
|
147
147
|
var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("x"));
|
|
148
148
|
|
|
149
149
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -577,7 +577,7 @@ var no_array_index_key_default = createRule({
|
|
|
577
577
|
defaultOptions: []
|
|
578
578
|
});
|
|
579
579
|
function create8(context) {
|
|
580
|
-
const report = kit.
|
|
580
|
+
const report = kit.Report.make(context);
|
|
581
581
|
const indexParamNames = [];
|
|
582
582
|
function isArrayIndex(node) {
|
|
583
583
|
return node.type === types.AST_NODE_TYPES.Identifier && indexParamNames.some((name5) => name5 != null && name5 === node.name);
|
|
@@ -655,7 +655,7 @@ function create8(context) {
|
|
|
655
655
|
continue;
|
|
656
656
|
}
|
|
657
657
|
for (const descriptor of getReportDescriptors(prop.value)) {
|
|
658
|
-
report(descriptor);
|
|
658
|
+
report.send(descriptor);
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
661
|
},
|
|
@@ -673,7 +673,7 @@ function create8(context) {
|
|
|
673
673
|
return;
|
|
674
674
|
}
|
|
675
675
|
for (const descriptor of getReportDescriptors(node.value.expression)) {
|
|
676
|
-
report(descriptor);
|
|
676
|
+
report.send(descriptor);
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
679
|
};
|
|
@@ -1713,7 +1713,7 @@ function create29(context) {
|
|
|
1713
1713
|
return tsPattern.match(variableDefNode).with({ init: tsPattern.P.select({ type: tsPattern.P.not(types.AST_NODE_TYPES.VariableDeclaration) }) }, getReportDescriptor).otherwise(() => eff._);
|
|
1714
1714
|
}).otherwise(() => eff._);
|
|
1715
1715
|
}
|
|
1716
|
-
const visitorFunction = eff.flow(getReportDescriptor, kit.
|
|
1716
|
+
const visitorFunction = eff.flow(getReportDescriptor, kit.Report.make(context).send);
|
|
1717
1717
|
return {
|
|
1718
1718
|
"JSXExpressionContainer > ConditionalExpression": visitorFunction,
|
|
1719
1719
|
"JSXExpressionContainer > LogicalExpression": visitorFunction
|
|
@@ -1848,7 +1848,7 @@ var no_missing_key_default = createRule({
|
|
|
1848
1848
|
defaultOptions: []
|
|
1849
1849
|
});
|
|
1850
1850
|
function create32(context) {
|
|
1851
|
-
const report = kit.
|
|
1851
|
+
const report = kit.Report.make(context);
|
|
1852
1852
|
const state = { isWithinChildrenToArray: false };
|
|
1853
1853
|
function checkIteratorElement(node) {
|
|
1854
1854
|
switch (node.type) {
|
|
@@ -1912,7 +1912,7 @@ function create32(context) {
|
|
|
1912
1912
|
const initialScope = context.sourceCode.getScope(node);
|
|
1913
1913
|
for (const element of elements) {
|
|
1914
1914
|
if (!JSX9__namespace.hasAttribute("key", element.openingElement.attributes, initialScope)) {
|
|
1915
|
-
report({
|
|
1915
|
+
report.send({
|
|
1916
1916
|
messageId: "missingKey",
|
|
1917
1917
|
node: element
|
|
1918
1918
|
});
|
|
@@ -1926,10 +1926,10 @@ function create32(context) {
|
|
|
1926
1926
|
if (!AST8__namespace.isFunction(callback)) return;
|
|
1927
1927
|
const body = callback.body;
|
|
1928
1928
|
if (body.type === types.AST_NODE_TYPES.BlockStatement) {
|
|
1929
|
-
checkBlockStatement(body).forEach(report);
|
|
1929
|
+
checkBlockStatement(body).forEach(report.send);
|
|
1930
1930
|
return;
|
|
1931
1931
|
}
|
|
1932
|
-
report(checkExpression(body));
|
|
1932
|
+
report.send(checkExpression(body));
|
|
1933
1933
|
},
|
|
1934
1934
|
"CallExpression:exit"(node) {
|
|
1935
1935
|
if (!ER22__namespace.isChildrenToArrayCall(context, node)) {
|
|
@@ -1942,7 +1942,7 @@ function create32(context) {
|
|
|
1942
1942
|
return;
|
|
1943
1943
|
}
|
|
1944
1944
|
if (node.parent.type === types.AST_NODE_TYPES.ArrayExpression) {
|
|
1945
|
-
report({
|
|
1945
|
+
report.send({
|
|
1946
1946
|
messageId: "unexpectedFragmentSyntax",
|
|
1947
1947
|
node
|
|
1948
1948
|
});
|
|
@@ -2617,7 +2617,7 @@ function create45(context) {
|
|
|
2617
2617
|
const { version: version2 } = shared.getSettingsFromContext(context);
|
|
2618
2618
|
const isReact18OrBelow = compareVersions.compare(version2, "19.0.0", "<");
|
|
2619
2619
|
const { ctx, listeners } = ER22__namespace.useComponentCollector(context);
|
|
2620
|
-
const constructions = /* @__PURE__ */ new
|
|
2620
|
+
const constructions = /* @__PURE__ */ new WeakMap();
|
|
2621
2621
|
return {
|
|
2622
2622
|
...listeners,
|
|
2623
2623
|
JSXOpeningElement(node) {
|
|
@@ -2640,7 +2640,7 @@ function create45(context) {
|
|
|
2640
2640
|
if (ER22__namespace.isReactHookCall(construction.node)) {
|
|
2641
2641
|
return;
|
|
2642
2642
|
}
|
|
2643
|
-
eff.
|
|
2643
|
+
eff.getOrElseUpdate(constructions, functionEntry.node, () => []).push(construction);
|
|
2644
2644
|
},
|
|
2645
2645
|
"Program:exit"(program) {
|
|
2646
2646
|
const components = ctx.getAllComponents(program).values();
|
|
@@ -2688,7 +2688,7 @@ var no_unstable_default_props_default = createRule({
|
|
|
2688
2688
|
});
|
|
2689
2689
|
function create46(context) {
|
|
2690
2690
|
const { ctx, listeners } = ER22__namespace.useComponentCollector(context);
|
|
2691
|
-
const declarators = /* @__PURE__ */ new
|
|
2691
|
+
const declarators = /* @__PURE__ */ new WeakMap();
|
|
2692
2692
|
return {
|
|
2693
2693
|
...listeners,
|
|
2694
2694
|
"Program:exit"(program) {
|
|
@@ -2734,7 +2734,7 @@ function create46(context) {
|
|
|
2734
2734
|
[kit.SEL.OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR](node) {
|
|
2735
2735
|
const functionEntry = ctx.getCurrentEntry();
|
|
2736
2736
|
if (functionEntry == null) return;
|
|
2737
|
-
eff.
|
|
2737
|
+
eff.getOrElseUpdate(
|
|
2738
2738
|
declarators,
|
|
2739
2739
|
functionEntry.node,
|
|
2740
2740
|
() => []
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { getDocsUrl, getSettingsFromContext, unsafeDecodeSettings, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
|
|
2
2
|
import * as JSX9 from '@eslint-react/jsx';
|
|
3
3
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
4
|
-
import { JsxConfig,
|
|
4
|
+
import { JsxConfig, Report, SEL } from '@eslint-react/kit';
|
|
5
5
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
6
6
|
import * as VAR2 from '@eslint-react/var';
|
|
7
7
|
import { match, isMatching, P } from 'ts-pattern';
|
|
8
8
|
import ts, { JsxEmit } from 'typescript';
|
|
9
9
|
import * as AST8 from '@eslint-react/ast';
|
|
10
10
|
import * as ER22 from '@eslint-react/core';
|
|
11
|
-
import { flow,
|
|
11
|
+
import { flow, getOrElseUpdate, constTrue, constFalse, _ } from '@eslint-react/eff';
|
|
12
12
|
import { compare } from 'compare-versions';
|
|
13
13
|
import { getConstrainedTypeAtLocation, isTypeReadonly } from '@typescript-eslint/type-utils';
|
|
14
14
|
import { unionTypeParts, isTypeFlagSet, isTrueLiteralType, isFalseLiteralType } from 'ts-api-utils';
|
|
@@ -115,7 +115,7 @@ var settings3 = {
|
|
|
115
115
|
|
|
116
116
|
// package.json
|
|
117
117
|
var name4 = "eslint-plugin-react-x";
|
|
118
|
-
var version = "1.45.
|
|
118
|
+
var version = "1.45.4-beta.5";
|
|
119
119
|
var createRule = ESLintUtils.RuleCreator(getDocsUrl("x"));
|
|
120
120
|
|
|
121
121
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -549,7 +549,7 @@ var no_array_index_key_default = createRule({
|
|
|
549
549
|
defaultOptions: []
|
|
550
550
|
});
|
|
551
551
|
function create8(context) {
|
|
552
|
-
const report =
|
|
552
|
+
const report = Report.make(context);
|
|
553
553
|
const indexParamNames = [];
|
|
554
554
|
function isArrayIndex(node) {
|
|
555
555
|
return node.type === AST_NODE_TYPES.Identifier && indexParamNames.some((name5) => name5 != null && name5 === node.name);
|
|
@@ -627,7 +627,7 @@ function create8(context) {
|
|
|
627
627
|
continue;
|
|
628
628
|
}
|
|
629
629
|
for (const descriptor of getReportDescriptors(prop.value)) {
|
|
630
|
-
report(descriptor);
|
|
630
|
+
report.send(descriptor);
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
633
|
},
|
|
@@ -645,7 +645,7 @@ function create8(context) {
|
|
|
645
645
|
return;
|
|
646
646
|
}
|
|
647
647
|
for (const descriptor of getReportDescriptors(node.value.expression)) {
|
|
648
|
-
report(descriptor);
|
|
648
|
+
report.send(descriptor);
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
651
|
};
|
|
@@ -1685,7 +1685,7 @@ function create29(context) {
|
|
|
1685
1685
|
return match(variableDefNode).with({ init: P.select({ type: P.not(AST_NODE_TYPES.VariableDeclaration) }) }, getReportDescriptor).otherwise(() => _);
|
|
1686
1686
|
}).otherwise(() => _);
|
|
1687
1687
|
}
|
|
1688
|
-
const visitorFunction = flow(getReportDescriptor,
|
|
1688
|
+
const visitorFunction = flow(getReportDescriptor, Report.make(context).send);
|
|
1689
1689
|
return {
|
|
1690
1690
|
"JSXExpressionContainer > ConditionalExpression": visitorFunction,
|
|
1691
1691
|
"JSXExpressionContainer > LogicalExpression": visitorFunction
|
|
@@ -1820,7 +1820,7 @@ var no_missing_key_default = createRule({
|
|
|
1820
1820
|
defaultOptions: []
|
|
1821
1821
|
});
|
|
1822
1822
|
function create32(context) {
|
|
1823
|
-
const report =
|
|
1823
|
+
const report = Report.make(context);
|
|
1824
1824
|
const state = { isWithinChildrenToArray: false };
|
|
1825
1825
|
function checkIteratorElement(node) {
|
|
1826
1826
|
switch (node.type) {
|
|
@@ -1884,7 +1884,7 @@ function create32(context) {
|
|
|
1884
1884
|
const initialScope = context.sourceCode.getScope(node);
|
|
1885
1885
|
for (const element of elements) {
|
|
1886
1886
|
if (!JSX9.hasAttribute("key", element.openingElement.attributes, initialScope)) {
|
|
1887
|
-
report({
|
|
1887
|
+
report.send({
|
|
1888
1888
|
messageId: "missingKey",
|
|
1889
1889
|
node: element
|
|
1890
1890
|
});
|
|
@@ -1898,10 +1898,10 @@ function create32(context) {
|
|
|
1898
1898
|
if (!AST8.isFunction(callback)) return;
|
|
1899
1899
|
const body = callback.body;
|
|
1900
1900
|
if (body.type === AST_NODE_TYPES.BlockStatement) {
|
|
1901
|
-
checkBlockStatement(body).forEach(report);
|
|
1901
|
+
checkBlockStatement(body).forEach(report.send);
|
|
1902
1902
|
return;
|
|
1903
1903
|
}
|
|
1904
|
-
report(checkExpression(body));
|
|
1904
|
+
report.send(checkExpression(body));
|
|
1905
1905
|
},
|
|
1906
1906
|
"CallExpression:exit"(node) {
|
|
1907
1907
|
if (!ER22.isChildrenToArrayCall(context, node)) {
|
|
@@ -1914,7 +1914,7 @@ function create32(context) {
|
|
|
1914
1914
|
return;
|
|
1915
1915
|
}
|
|
1916
1916
|
if (node.parent.type === AST_NODE_TYPES.ArrayExpression) {
|
|
1917
|
-
report({
|
|
1917
|
+
report.send({
|
|
1918
1918
|
messageId: "unexpectedFragmentSyntax",
|
|
1919
1919
|
node
|
|
1920
1920
|
});
|
|
@@ -2589,7 +2589,7 @@ function create45(context) {
|
|
|
2589
2589
|
const { version: version2 } = getSettingsFromContext(context);
|
|
2590
2590
|
const isReact18OrBelow = compare(version2, "19.0.0", "<");
|
|
2591
2591
|
const { ctx, listeners } = ER22.useComponentCollector(context);
|
|
2592
|
-
const constructions = /* @__PURE__ */ new
|
|
2592
|
+
const constructions = /* @__PURE__ */ new WeakMap();
|
|
2593
2593
|
return {
|
|
2594
2594
|
...listeners,
|
|
2595
2595
|
JSXOpeningElement(node) {
|
|
@@ -2612,7 +2612,7 @@ function create45(context) {
|
|
|
2612
2612
|
if (ER22.isReactHookCall(construction.node)) {
|
|
2613
2613
|
return;
|
|
2614
2614
|
}
|
|
2615
|
-
|
|
2615
|
+
getOrElseUpdate(constructions, functionEntry.node, () => []).push(construction);
|
|
2616
2616
|
},
|
|
2617
2617
|
"Program:exit"(program) {
|
|
2618
2618
|
const components = ctx.getAllComponents(program).values();
|
|
@@ -2660,7 +2660,7 @@ var no_unstable_default_props_default = createRule({
|
|
|
2660
2660
|
});
|
|
2661
2661
|
function create46(context) {
|
|
2662
2662
|
const { ctx, listeners } = ER22.useComponentCollector(context);
|
|
2663
|
-
const declarators = /* @__PURE__ */ new
|
|
2663
|
+
const declarators = /* @__PURE__ */ new WeakMap();
|
|
2664
2664
|
return {
|
|
2665
2665
|
...listeners,
|
|
2666
2666
|
"Program:exit"(program) {
|
|
@@ -2706,7 +2706,7 @@ function create46(context) {
|
|
|
2706
2706
|
[SEL.OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR](node) {
|
|
2707
2707
|
const functionEntry = ctx.getCurrentEntry();
|
|
2708
2708
|
if (functionEntry == null) return;
|
|
2709
|
-
|
|
2709
|
+
getOrElseUpdate(
|
|
2710
2710
|
declarators,
|
|
2711
2711
|
functionEntry.node,
|
|
2712
2712
|
() => []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.45.
|
|
3
|
+
"version": "1.45.4-beta.5",
|
|
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",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
"is-immutable-type": "^5.0.1",
|
|
51
51
|
"string-ts": "^2.2.1",
|
|
52
52
|
"ts-pattern": "^5.7.0",
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/eff": "1.45.
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/shared": "1.45.
|
|
58
|
-
"@eslint-react/var": "1.45.
|
|
59
|
-
"@eslint-react/
|
|
53
|
+
"@eslint-react/ast": "1.45.4-beta.5",
|
|
54
|
+
"@eslint-react/eff": "1.45.4-beta.5",
|
|
55
|
+
"@eslint-react/jsx": "1.45.4-beta.5",
|
|
56
|
+
"@eslint-react/core": "1.45.4-beta.5",
|
|
57
|
+
"@eslint-react/shared": "1.45.4-beta.5",
|
|
58
|
+
"@eslint-react/var": "1.45.4-beta.5",
|
|
59
|
+
"@eslint-react/kit": "1.45.4-beta.5"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/react": "^19.1.1",
|