eslint-plugin-react-x 1.38.0-beta.11 → 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.
Files changed (3) hide show
  1. package/dist/index.js +12 -17
  2. package/dist/index.mjs +12 -17
  3. package/package.json +12 -12
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.11";
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
- JSXIdentifier(node) {
274
- if (node.name === "this") {
275
- return;
276
- }
277
- if (/^[a-z]/u.test(node.name)) {
278
- return;
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: { name: node.name }
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.11";
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
- JSXIdentifier(node) {
247
- if (node.name === "this") {
248
- return;
249
- }
250
- if (/^[a-z]/u.test(node.name)) {
251
- return;
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: { name: node.name }
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.11",
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",
@@ -42,21 +42,21 @@
42
42
  "./package.json"
43
43
  ],
44
44
  "dependencies": {
45
- "@typescript-eslint/scope-manager": "^8.27.0",
46
- "@typescript-eslint/type-utils": "^8.27.0",
47
- "@typescript-eslint/types": "^8.27.0",
48
- "@typescript-eslint/utils": "^8.27.0",
45
+ "@typescript-eslint/scope-manager": "^8.28.0",
46
+ "@typescript-eslint/type-utils": "^8.28.0",
47
+ "@typescript-eslint/types": "^8.28.0",
48
+ "@typescript-eslint/utils": "^8.28.0",
49
49
  "compare-versions": "^6.1.1",
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.11",
54
- "@eslint-react/core": "1.38.0-beta.11",
55
- "@eslint-react/eff": "1.38.0-beta.11",
56
- "@eslint-react/jsx": "1.38.0-beta.11",
57
- "@eslint-react/shared": "1.38.0-beta.11",
58
- "@eslint-react/kit": "1.38.0-beta.11",
59
- "@eslint-react/var": "1.38.0-beta.11"
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",