@eslint-react/core 5.8.3 → 5.8.4-beta.1

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.ts CHANGED
@@ -178,16 +178,11 @@ interface ClassComponentSemanticNode extends SemanticNode {
178
178
  node: TSESTreeClass;
179
179
  }
180
180
  /**
181
- * @param node The AST node to check.
182
- * @deprecated Class components are legacy. This function exists only to support legacy rules.
183
- */
184
- declare function isClassComponent(node: TSESTree.Node): node is TSESTreeClass;
185
- /**
186
- * @param node The AST node to check.
187
181
  * @param context The rule context.
182
+ * @param node The AST node to check.
188
183
  * @deprecated Class components are legacy. This function exists only to support legacy rules.
189
184
  */
190
- declare function isClassComponent(node: TSESTree.Node, context: RuleContext): node is TSESTreeClass;
185
+ declare function isClassComponent(context: RuleContext, node: TSESTree.Node): node is TSESTreeClass;
191
186
  declare function isClassComponentLoose(node: TSESTree.Node): node is TSESTreeClass;
192
187
  /**
193
188
  * @param node The AST node to check.
@@ -315,7 +310,7 @@ type FunctionSemanticNode = ClientFunctionSemanticNode | ServerFunctionSemanticN
315
310
  * @param node - The function node to analyze.
316
311
  * @returns The identifier node if found, `null` otherwise.
317
312
  */
318
- declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.TemplateLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.YieldExpression | TSESTree.PrivateIdentifier | null;
313
+ declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.PrivateIdentifier | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.TemplateLiteral | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.YieldExpression | null;
319
314
  /**
320
315
  * Identifies the initialization path of a function node in the AST.
321
316
  *
@@ -681,7 +676,7 @@ declare function isJsxLike(context: RuleContext, node: TSESTree.Node | null, hin
681
676
  * annotations found in the source file.
682
677
  */
683
678
  interface JsxConfig {
684
- jsx?: number;
679
+ jsx?: ts.JsxEmit;
685
680
  jsxFactory?: string;
686
681
  jsxFragmentFactory?: string;
687
682
  jsxImportSource?: string;
package/dist/index.js CHANGED
@@ -268,17 +268,20 @@ function getClassId(node) {
268
268
 
269
269
  //#endregion
270
270
  //#region src/class-component.ts
271
- function isClassComponent(node, context) {
271
+ /**
272
+ * @param context The rule context.
273
+ * @param node The AST node to check.
274
+ * @deprecated Class components are legacy. This function exists only to support legacy rules.
275
+ */
276
+ function isClassComponent(context, node) {
272
277
  if ("superClass" in node && node.superClass != null) {
273
278
  const re = /^(?:Pure)?Component$/u;
274
279
  switch (true) {
275
280
  case node.superClass.type === AST_NODE_TYPES.Identifier:
276
281
  if (!re.test(node.superClass.name)) return false;
277
- if (context == null) return true;
278
282
  return isAPIFromReact(node.superClass.name, context.sourceCode.getScope(node), "react");
279
283
  case node.superClass.type === AST_NODE_TYPES.MemberExpression && node.superClass.property.type === AST_NODE_TYPES.Identifier:
280
284
  if (!re.test(node.superClass.property.name)) return false;
281
- if (context == null) return true;
282
285
  if (node.superClass.object.type === AST_NODE_TYPES.Identifier) return isAPIFromReact(node.superClass.object.name, context.sourceCode.getScope(node), "react");
283
286
  return true;
284
287
  }
@@ -390,7 +393,7 @@ function getClassComponentCollector(context) {
390
393
  } };
391
394
  const getText = (n) => context.sourceCode.getText(n);
392
395
  const collect = (node) => {
393
- if (!isClassComponent(node)) return;
396
+ if (!isClassComponent(context, node)) return;
394
397
  const id = getClassId(node);
395
398
  const key = randomBytes(8).toString("hex");
396
399
  const name = id == null ? null : Extract.getFullyQualifiedName(id, getText);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "5.8.3",
3
+ "version": "5.8.4-beta.1",
4
4
  "description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -33,11 +33,11 @@
33
33
  "@typescript-eslint/types": "^8.59.3",
34
34
  "@typescript-eslint/utils": "^8.59.3",
35
35
  "ts-pattern": "^5.9.0",
36
- "@eslint-react/ast": "5.8.3",
37
- "@eslint-react/eslint": "5.8.3",
38
- "@eslint-react/shared": "5.8.3",
39
- "@eslint-react/var": "5.8.3",
40
- "@eslint-react/jsx": "5.8.3"
36
+ "@eslint-react/ast": "5.8.4-beta.1",
37
+ "@eslint-react/eslint": "5.8.4-beta.1",
38
+ "@eslint-react/shared": "5.8.4-beta.1",
39
+ "@eslint-react/jsx": "5.8.4-beta.1",
40
+ "@eslint-react/var": "5.8.4-beta.1"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@typescript-eslint/parser": "^8.59.3",
@@ -63,7 +63,7 @@
63
63
  "@local/eff": "workspace:*"
64
64
  },
65
65
  "scripts": {
66
- "build": "tsdown --dts-resolve",
66
+ "build": "tsdown",
67
67
  "build:docs": "typedoc",
68
68
  "lint:publish": "publint",
69
69
  "lint:ts": "tsl"