eslint-plugin-react-x 1.37.4-next.0 → 1.38.0-beta.3
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -8
- package/dist/index.mjs +8 -7
- package/package.json +8 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
|
-
import { RulePreset } from '@eslint-react/
|
|
2
|
+
import { RulePreset } from '@eslint-react/kit';
|
|
3
3
|
|
|
4
4
|
type MessageID$1 = "noNestedComponentDefinition" | "noNestedComponentDefinitionInProps";
|
|
5
5
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
2
|
-
import { RulePreset } from '@eslint-react/
|
|
2
|
+
import { RulePreset } from '@eslint-react/kit';
|
|
3
3
|
|
|
4
4
|
type MessageID$1 = "noNestedComponentDefinition" | "noNestedComponentDefinitionInProps";
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
var shared = require('@eslint-react/shared');
|
|
4
4
|
var JSX8 = require('@eslint-react/jsx');
|
|
5
|
+
var utils = require('@typescript-eslint/utils');
|
|
5
6
|
var AST11 = require('@eslint-react/ast');
|
|
6
7
|
var core = require('@eslint-react/core');
|
|
7
8
|
var eff = require('@eslint-react/eff');
|
|
8
9
|
var types = require('@typescript-eslint/types');
|
|
9
10
|
var tsPattern = require('ts-pattern');
|
|
11
|
+
var kit = require('@eslint-react/kit');
|
|
10
12
|
var compareVersions = require('compare-versions');
|
|
11
13
|
var VAR = require('@eslint-react/var');
|
|
12
14
|
var typeUtils = require('@typescript-eslint/type-utils');
|
|
13
|
-
var utils = require('@typescript-eslint/utils');
|
|
14
15
|
var tsApiUtils = require('ts-api-utils');
|
|
15
16
|
var ts = require('typescript');
|
|
16
17
|
var isImmutableType = require('is-immutable-type');
|
|
@@ -136,8 +137,8 @@ var settings3 = {
|
|
|
136
137
|
|
|
137
138
|
// package.json
|
|
138
139
|
var name4 = "eslint-plugin-react-x";
|
|
139
|
-
var version = "1.
|
|
140
|
-
var createRule = shared.
|
|
140
|
+
var version = "1.38.0-beta.3";
|
|
141
|
+
var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("x"));
|
|
141
142
|
|
|
142
143
|
// src/rules/avoid-shorthand-boolean.ts
|
|
143
144
|
var RULE_NAME = "avoid-shorthand-boolean";
|
|
@@ -414,7 +415,7 @@ var no_array_index_key_default = createRule({
|
|
|
414
415
|
defaultOptions: []
|
|
415
416
|
});
|
|
416
417
|
function create4(context) {
|
|
417
|
-
const report =
|
|
418
|
+
const report = kit.createReport(context);
|
|
418
419
|
const indexParamNames = [];
|
|
419
420
|
function isArrayIndex(node) {
|
|
420
421
|
return node.type === types.AST_NODE_TYPES.Identifier && indexParamNames.some((name5) => name5 != null && name5 === node.name);
|
|
@@ -1593,11 +1594,11 @@ function create26(context) {
|
|
|
1593
1594
|
return getReportDescriptor(consequent) ?? getReportDescriptor(alternate);
|
|
1594
1595
|
}).with({ type: types.AST_NODE_TYPES.Identifier }, (n) => {
|
|
1595
1596
|
const variable = VAR__namespace.findVariable(n.name, context.sourceCode.getScope(n));
|
|
1596
|
-
const
|
|
1597
|
-
return getReportDescriptor(
|
|
1597
|
+
const variableDefNode = variable?.defs.at(0)?.node;
|
|
1598
|
+
return tsPattern.match(variableDefNode).with({ init: tsPattern.P.select({ type: tsPattern.P.not(types.AST_NODE_TYPES.VariableDeclaration) }) }, getReportDescriptor).otherwise(() => eff._);
|
|
1598
1599
|
}).otherwise(() => eff._);
|
|
1599
1600
|
}
|
|
1600
|
-
const visitorFunction = eff.flow(getReportDescriptor,
|
|
1601
|
+
const visitorFunction = eff.flow(getReportDescriptor, kit.createReport(context));
|
|
1601
1602
|
return {
|
|
1602
1603
|
"JSXExpressionContainer > ConditionalExpression": visitorFunction,
|
|
1603
1604
|
"JSXExpressionContainer > LogicalExpression": visitorFunction
|
|
@@ -1732,7 +1733,7 @@ var no_missing_key_default = createRule({
|
|
|
1732
1733
|
defaultOptions: []
|
|
1733
1734
|
});
|
|
1734
1735
|
function create29(context) {
|
|
1735
|
-
const report =
|
|
1736
|
+
const report = kit.createReport(context);
|
|
1736
1737
|
const state = { isWithinChildrenToArray: false };
|
|
1737
1738
|
function checkIteratorElement(node) {
|
|
1738
1739
|
switch (node.type) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getDocsUrl, getSettingsFromContext, unsafeDecodeSettings, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
|
|
2
2
|
import * as JSX8 from '@eslint-react/jsx';
|
|
3
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
3
4
|
import * as AST11 from '@eslint-react/ast';
|
|
4
5
|
import { isClassComponent, isThisSetState, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, useComponentCollectorLegacy, isComponentDidCatch, isGetDerivedStateFromError, isCloneElementCall, isComponentNameLoose, isCreateRefCall, isAssignmentToThisState, isForwardRefCall, useComponentCollector, DEFAULT_COMPONENT_HINT, ERComponentFlag, getInstanceId, isInstanceIdEqual, DISPLAY_NAME_ASSIGNMENT_SELECTOR, isCreateContextCall, isChildrenToArrayCall, ERComponentHint, isDirectValueOfRenderPropertyLoose, isDeclaredInRenderPropLoose, isInsideRenderMethod, isCreateElementCall, isReactHookCall, isReactHookCallWithNameAlias, isGetDerivedStateFromProps, isInitializedFromReact } from '@eslint-react/core';
|
|
5
|
-
import { _, flow, getOrUpdate, constTrue, constFalse
|
|
6
|
+
import { _, flow, getOrUpdate, constTrue, constFalse } from '@eslint-react/eff';
|
|
6
7
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
7
8
|
import { isMatching, match, P } from 'ts-pattern';
|
|
9
|
+
import { createReport } from '@eslint-react/kit';
|
|
8
10
|
import { compare } from 'compare-versions';
|
|
9
11
|
import * as VAR from '@eslint-react/var';
|
|
10
12
|
import { getConstrainedTypeAtLocation, isTypeReadonly } from '@typescript-eslint/type-utils';
|
|
11
|
-
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
12
13
|
import { unionTypeParts, isTypeFlagSet, isTrueLiteralType, isFalseLiteralType } from 'ts-api-utils';
|
|
13
14
|
import ts from 'typescript';
|
|
14
15
|
import { getTypeImmutability, isUnknown, isImmutable, isReadonlyShallow, isReadonlyDeep } from 'is-immutable-type';
|
|
@@ -109,8 +110,8 @@ var settings3 = {
|
|
|
109
110
|
|
|
110
111
|
// package.json
|
|
111
112
|
var name4 = "eslint-plugin-react-x";
|
|
112
|
-
var version = "1.
|
|
113
|
-
var createRule =
|
|
113
|
+
var version = "1.38.0-beta.3";
|
|
114
|
+
var createRule = ESLintUtils.RuleCreator(getDocsUrl("x"));
|
|
114
115
|
|
|
115
116
|
// src/rules/avoid-shorthand-boolean.ts
|
|
116
117
|
var RULE_NAME = "avoid-shorthand-boolean";
|
|
@@ -1566,8 +1567,8 @@ function create26(context) {
|
|
|
1566
1567
|
return getReportDescriptor(consequent) ?? getReportDescriptor(alternate);
|
|
1567
1568
|
}).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
|
|
1568
1569
|
const variable = VAR.findVariable(n.name, context.sourceCode.getScope(n));
|
|
1569
|
-
const
|
|
1570
|
-
return getReportDescriptor(
|
|
1570
|
+
const variableDefNode = variable?.defs.at(0)?.node;
|
|
1571
|
+
return match(variableDefNode).with({ init: P.select({ type: P.not(AST_NODE_TYPES.VariableDeclaration) }) }, getReportDescriptor).otherwise(() => _);
|
|
1571
1572
|
}).otherwise(() => _);
|
|
1572
1573
|
}
|
|
1573
1574
|
const visitorFunction = flow(getReportDescriptor, createReport(context));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.38.0-beta.3",
|
|
4
4
|
"description": "A set of composable linting rules for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -50,12 +50,13 @@
|
|
|
50
50
|
"is-immutable-type": "^5.0.1",
|
|
51
51
|
"string-ts": "^2.2.1",
|
|
52
52
|
"ts-pattern": "^5.6.2",
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/eff": "1.
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
58
|
-
"@eslint-react/
|
|
53
|
+
"@eslint-react/core": "1.38.0-beta.3",
|
|
54
|
+
"@eslint-react/eff": "1.38.0-beta.3",
|
|
55
|
+
"@eslint-react/ast": "1.38.0-beta.3",
|
|
56
|
+
"@eslint-react/shared": "1.38.0-beta.3",
|
|
57
|
+
"@eslint-react/var": "1.38.0-beta.3",
|
|
58
|
+
"@eslint-react/jsx": "1.38.0-beta.3",
|
|
59
|
+
"@eslint-react/kit": "1.38.0-beta.3"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
62
|
"@types/react": "^19.0.12",
|