eslint-plugin-react-hooks 6.2.0-canary-4fdf7cf2-20251003 → 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.
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as estree from 'estree';
|
|
2
2
|
import { Rule, Linter } from 'eslint';
|
|
3
3
|
|
|
4
|
+
type FlatConfig = {
|
|
5
|
+
plugins: Record<string, any>;
|
|
6
|
+
rules: Linter.RulesRecord;
|
|
7
|
+
};
|
|
4
8
|
declare const plugin: {
|
|
5
9
|
meta: {
|
|
6
10
|
name: string;
|
|
@@ -81,9 +85,9 @@ declare const plugin: {
|
|
|
81
85
|
plugins: Array<string>;
|
|
82
86
|
rules: Linter.RulesRecord;
|
|
83
87
|
};
|
|
84
|
-
"flat/recommended": Array<
|
|
85
|
-
"recommended-latest": Array<
|
|
86
|
-
recommended: Array<
|
|
88
|
+
"flat/recommended": Array<FlatConfig>;
|
|
89
|
+
"recommended-latest": Array<FlatConfig>;
|
|
90
|
+
recommended: Array<FlatConfig>;
|
|
87
91
|
};
|
|
88
92
|
};
|
|
89
93
|
|
|
@@ -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
|
-
|
|
54182
|
-
|
|
54183
|
-
|
|
54184
|
-
|
|
54185
|
-
|
|
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
|
-
|
|
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
|
-
|
|
54009
|
-
|
|
54010
|
-
|
|
54011
|
-
|
|
54012
|
-
|
|
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
|
-
|
|
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/index.d.ts
CHANGED
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-
|
|
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
|
},
|