Rename error type
Lauren Tan committed
Mar 28, 2024 at 10:40 UTC
f4229cdb7fd53cf95bdb79209fa86f4216701c9b
3 files changed
+5
-5
compiler/packages/babel-plugin-react-forget/src/CompilerError.ts
+1
-1
@@ -173,7 +173,7 @@ export class CompilerError extends Error {
173
174
constructor(...args: any[]) {
175
super(...args);
176
- this.name = "ReactForgetCompilerError";
176
+ this.name = "ReactCompilerError";
177
}
178
179
override get message(): string {
compiler/packages/babel-plugin-react-forget/src/__tests__/envConfig-test.ts
+1
-1
@@ -20,7 +20,7 @@ describe("parseConfigPragma()", () => {
20
validateHooksUsage: 1,
21
} as any);
22
}).toThrowErrorMatchingInlineSnapshot(
23
- `"[ReactForget] InvalidConfig: Validation error: Expected boolean, received number at "validateHooksUsage". Update Forget config to fix the error"`
23
+ `"InvalidConfig: Validation error: Expected boolean, received number at "validateHooksUsage". Update Forget config to fix the error"`
24
);
25
});
26
compiler/packages/eslint-plugin-react-compiler/src/rules/ReactCompilerRule.ts
+3
-3
@@ -29,8 +29,8 @@ function assertExhaustive(_: never, errorMsg: string): never {
29
throw new Error(errorMsg);
30
}
31
32
-function isReactForgetCompilerError(err: Error): err is CompilerError {
33
- return err.name === "ReactForgetCompilerError";
32
+function isReactCompilerError(err: Error): err is CompilerError {
33
+ return err.name === "ReactCompilerError";
34
}
35
36
function isReportableDiagnostic(
@@ -131,7 +131,7 @@ const rule: Rule.RuleModule = {
131
sourceType: "module",
132
});
133
} catch (err) {
134
- if (isReactForgetCompilerError(err) && Array.isArray(err.details)) {
134
+ if (isReactCompilerError(err) && Array.isArray(err.details)) {
135
for (const detail of err.details) {
136
if (!isReportableDiagnostic(detail)) {
137
continue;