eslint-plugin-react-x 1.38.0-beta.12 → 1.38.0-beta.13
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 +12 -17
- package/dist/index.mjs +12 -17
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -4,11 +4,11 @@ var shared = require('@eslint-react/shared');
|
|
|
4
4
|
var JSX9 = require('@eslint-react/jsx');
|
|
5
5
|
var utils = require('@typescript-eslint/utils');
|
|
6
6
|
var types = require('@typescript-eslint/types');
|
|
7
|
+
var eff = require('@eslint-react/eff');
|
|
7
8
|
var VAR2 = require('@eslint-react/var');
|
|
9
|
+
var tsPattern = require('ts-pattern');
|
|
8
10
|
var AST11 = require('@eslint-react/ast');
|
|
9
11
|
var core = require('@eslint-react/core');
|
|
10
|
-
var eff = require('@eslint-react/eff');
|
|
11
|
-
var tsPattern = require('ts-pattern');
|
|
12
12
|
var kit = require('@eslint-react/kit');
|
|
13
13
|
var compareVersions = require('compare-versions');
|
|
14
14
|
var typeUtils = require('@typescript-eslint/type-utils');
|
|
@@ -57,7 +57,6 @@ __export(recommended_exports, {
|
|
|
57
57
|
var name = "react-x/recommended";
|
|
58
58
|
var rules = {
|
|
59
59
|
"react-x/jsx-no-duplicate-props": "warn",
|
|
60
|
-
"react-x/jsx-no-undef": "error",
|
|
61
60
|
"react-x/jsx-uses-vars": "warn",
|
|
62
61
|
"react-x/no-access-state-in-setstate": "error",
|
|
63
62
|
"react-x/no-array-index-key": "warn",
|
|
@@ -139,7 +138,7 @@ var settings3 = {
|
|
|
139
138
|
|
|
140
139
|
// package.json
|
|
141
140
|
var name4 = "eslint-plugin-react-x";
|
|
142
|
-
var version = "1.38.0-beta.
|
|
141
|
+
var version = "1.38.0-beta.13";
|
|
143
142
|
var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("x"));
|
|
144
143
|
|
|
145
144
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -270,22 +269,18 @@ var jsx_no_undef_default = createRule({
|
|
|
270
269
|
});
|
|
271
270
|
function create4(context) {
|
|
272
271
|
return {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
if (/^[a-z]/u.test(
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
if (node.parent.type === types.AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node) {
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
const initialScope = context.sourceCode.getScope(node);
|
|
284
|
-
if (VAR2__namespace.findVariable(node.name, initialScope) == null) {
|
|
272
|
+
JSXOpeningElement(node) {
|
|
273
|
+
const name5 = tsPattern.match(node.name).with({ type: types.AST_NODE_TYPES.JSXIdentifier }, (n) => n.name).with({ type: types.AST_NODE_TYPES.JSXMemberExpression, object: { type: types.AST_NODE_TYPES.JSXIdentifier } }, (n) => n.object.name).otherwise(() => eff._);
|
|
274
|
+
if (name5 == null) return;
|
|
275
|
+
if (name5 === "this") return;
|
|
276
|
+
if (/^[a-z]/u.test(name5)) return;
|
|
277
|
+
if (VAR2__namespace.findVariable(name5, context.sourceCode.getScope(node)) == null) {
|
|
285
278
|
context.report({
|
|
286
279
|
messageId: "jsxNoUndef",
|
|
287
280
|
node,
|
|
288
|
-
data: {
|
|
281
|
+
data: {
|
|
282
|
+
name: name5
|
|
283
|
+
}
|
|
289
284
|
});
|
|
290
285
|
}
|
|
291
286
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import { getDocsUrl, getSettingsFromContext, unsafeDecodeSettings, DEFAULT_ESLIN
|
|
|
2
2
|
import * as JSX9 from '@eslint-react/jsx';
|
|
3
3
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
4
4
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
5
|
+
import { _, flow, getOrUpdate, constTrue, constFalse } from '@eslint-react/eff';
|
|
5
6
|
import * as VAR2 from '@eslint-react/var';
|
|
7
|
+
import { match, isMatching, P } from 'ts-pattern';
|
|
6
8
|
import * as AST11 from '@eslint-react/ast';
|
|
7
9
|
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';
|
|
8
|
-
import { _, flow, getOrUpdate, constTrue, constFalse } from '@eslint-react/eff';
|
|
9
|
-
import { isMatching, match, P } from 'ts-pattern';
|
|
10
10
|
import { createReport } from '@eslint-react/kit';
|
|
11
11
|
import { compare } from 'compare-versions';
|
|
12
12
|
import { getConstrainedTypeAtLocation, isTypeReadonly } from '@typescript-eslint/type-utils';
|
|
@@ -30,7 +30,6 @@ __export(recommended_exports, {
|
|
|
30
30
|
var name = "react-x/recommended";
|
|
31
31
|
var rules = {
|
|
32
32
|
"react-x/jsx-no-duplicate-props": "warn",
|
|
33
|
-
"react-x/jsx-no-undef": "error",
|
|
34
33
|
"react-x/jsx-uses-vars": "warn",
|
|
35
34
|
"react-x/no-access-state-in-setstate": "error",
|
|
36
35
|
"react-x/no-array-index-key": "warn",
|
|
@@ -112,7 +111,7 @@ var settings3 = {
|
|
|
112
111
|
|
|
113
112
|
// package.json
|
|
114
113
|
var name4 = "eslint-plugin-react-x";
|
|
115
|
-
var version = "1.38.0-beta.
|
|
114
|
+
var version = "1.38.0-beta.13";
|
|
116
115
|
var createRule = ESLintUtils.RuleCreator(getDocsUrl("x"));
|
|
117
116
|
|
|
118
117
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -243,22 +242,18 @@ var jsx_no_undef_default = createRule({
|
|
|
243
242
|
});
|
|
244
243
|
function create4(context) {
|
|
245
244
|
return {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if (/^[a-z]/u.test(
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
if (node.parent.type === AST_NODE_TYPES.JSXMemberExpression && node.parent.property === node) {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
const initialScope = context.sourceCode.getScope(node);
|
|
257
|
-
if (VAR2.findVariable(node.name, initialScope) == null) {
|
|
245
|
+
JSXOpeningElement(node) {
|
|
246
|
+
const name5 = match(node.name).with({ type: AST_NODE_TYPES.JSXIdentifier }, (n) => n.name).with({ type: AST_NODE_TYPES.JSXMemberExpression, object: { type: AST_NODE_TYPES.JSXIdentifier } }, (n) => n.object.name).otherwise(() => _);
|
|
247
|
+
if (name5 == null) return;
|
|
248
|
+
if (name5 === "this") return;
|
|
249
|
+
if (/^[a-z]/u.test(name5)) return;
|
|
250
|
+
if (VAR2.findVariable(name5, context.sourceCode.getScope(node)) == null) {
|
|
258
251
|
context.report({
|
|
259
252
|
messageId: "jsxNoUndef",
|
|
260
253
|
node,
|
|
261
|
-
data: {
|
|
254
|
+
data: {
|
|
255
|
+
name: name5
|
|
256
|
+
}
|
|
262
257
|
});
|
|
263
258
|
}
|
|
264
259
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.38.0-beta.
|
|
3
|
+
"version": "1.38.0-beta.13",
|
|
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,13 +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/ast": "1.38.0-beta.
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/kit": "1.38.0-beta.
|
|
58
|
-
"@eslint-react/shared": "1.38.0-beta.
|
|
59
|
-
"@eslint-react/var": "1.38.0-beta.
|
|
53
|
+
"@eslint-react/ast": "1.38.0-beta.13",
|
|
54
|
+
"@eslint-react/core": "1.38.0-beta.13",
|
|
55
|
+
"@eslint-react/eff": "1.38.0-beta.13",
|
|
56
|
+
"@eslint-react/jsx": "1.38.0-beta.13",
|
|
57
|
+
"@eslint-react/kit": "1.38.0-beta.13",
|
|
58
|
+
"@eslint-react/shared": "1.38.0-beta.13",
|
|
59
|
+
"@eslint-react/var": "1.38.0-beta.13"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/react": "^19.0.12",
|