eslint-plugin-react-hooks 6.2.0-canary-c7862584-20251006 → 6.2.0-canary-a4eb2dfa-20251006

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.
@@ -19,6 +19,7 @@ var BabelParser = require('@babel/parser');
19
19
  var zod = require('zod');
20
20
  var zodValidationError = require('zod-validation-error');
21
21
  var crypto = require('crypto');
22
+ var HermesParser = require('hermes-parser');
22
23
  var util = require('util');
23
24
 
24
25
  const SETTINGS_KEY = 'react-hooks';
@@ -54178,14 +54179,28 @@ function runReactCompilerImpl({ sourceCode, filename, userOpts, }) {
54178
54179
  (_b = options.logger) === null || _b === void 0 ? void 0 : _b.logEvent(filename, err);
54179
54180
  }
54180
54181
  let babelAST = null;
54181
- try {
54182
- babelAST = BabelParser.parse(sourceCode.text, {
54183
- sourceFilename: filename,
54184
- sourceType: 'unambiguous',
54185
- plugins: ['typescript', 'jsx'],
54186
- });
54182
+ if (filename.endsWith('.tsx') || filename.endsWith('.ts')) {
54183
+ try {
54184
+ babelAST = BabelParser.parse(sourceCode.text, {
54185
+ sourceFilename: filename,
54186
+ sourceType: 'unambiguous',
54187
+ plugins: ['typescript', 'jsx'],
54188
+ });
54189
+ }
54190
+ catch (_c) {
54191
+ }
54187
54192
  }
54188
- catch (err) {
54193
+ else {
54194
+ try {
54195
+ babelAST = HermesParser.parse(sourceCode.text, {
54196
+ babel: true,
54197
+ enableExperimentalComponentSyntax: true,
54198
+ sourceFilename: filename,
54199
+ sourceType: 'module',
54200
+ });
54201
+ }
54202
+ catch (_d) {
54203
+ }
54189
54204
  }
54190
54205
  if (babelAST != null) {
54191
54206
  results.flowSuppressions = getFlowSuppressions(sourceCode);
@@ -15,6 +15,7 @@ var BabelParser = require('@babel/parser');
15
15
  var zod = require('zod');
16
16
  var zodValidationError = require('zod-validation-error');
17
17
  var crypto = require('crypto');
18
+ var HermesParser = require('hermes-parser');
18
19
  var util = require('util');
19
20
 
20
21
  const SETTINGS_KEY = 'react-hooks';
@@ -54005,14 +54006,28 @@ function runReactCompilerImpl({ sourceCode, filename, userOpts, }) {
54005
54006
  (_b = options.logger) === null || _b === void 0 ? void 0 : _b.logEvent(filename, err);
54006
54007
  }
54007
54008
  let babelAST = null;
54008
- try {
54009
- babelAST = BabelParser.parse(sourceCode.text, {
54010
- sourceFilename: filename,
54011
- sourceType: 'unambiguous',
54012
- plugins: ['typescript', 'jsx'],
54013
- });
54009
+ if (filename.endsWith('.tsx') || filename.endsWith('.ts')) {
54010
+ try {
54011
+ babelAST = BabelParser.parse(sourceCode.text, {
54012
+ sourceFilename: filename,
54013
+ sourceType: 'unambiguous',
54014
+ plugins: ['typescript', 'jsx'],
54015
+ });
54016
+ }
54017
+ catch (_c) {
54018
+ }
54014
54019
  }
54015
- catch (err) {
54020
+ else {
54021
+ try {
54022
+ babelAST = HermesParser.parse(sourceCode.text, {
54023
+ babel: true,
54024
+ enableExperimentalComponentSyntax: true,
54025
+ sourceFilename: filename,
54026
+ sourceType: 'module',
54027
+ });
54028
+ }
54029
+ catch (_d) {
54030
+ }
54016
54031
  }
54017
54032
  if (babelAST != null) {
54018
54033
  results.flowSuppressions = getFlowSuppressions(sourceCode);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-hooks",
3
3
  "description": "ESLint rules for React Hooks",
4
- "version": "6.2.0-canary-c7862584-20251006",
4
+ "version": "6.2.0-canary-a4eb2dfa-20251006",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/facebook/react.git",
@@ -41,6 +41,7 @@
41
41
  "dependencies": {
42
42
  "@babel/core": "^7.24.4",
43
43
  "@babel/parser": "^7.24.4",
44
+ "hermes-parser": "^0.25.1",
44
45
  "zod": "^3.22.4 || ^4.0.0",
45
46
  "zod-validation-error": "^3.0.3 || ^4.0.0"
46
47
  },