-
Notifications
You must be signed in to change notification settings - Fork 46.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[compiler][eslint] remove compilationMode override; report bailouts on first line #30423
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,6 @@ function makeSuggestions( | |
|
||
const COMPILER_OPTIONS: Partial<PluginOptions> = { | ||
noEmit: true, | ||
compilationMode: "infer", | ||
panicThreshold: "none", | ||
}; | ||
|
||
|
@@ -161,9 +160,16 @@ const rule: Rule.RuleModule = { | |
detail.loc != null && typeof detail.loc !== "symbol" | ||
? ` (@:${detail.loc.start.line}:${detail.loc.start.column})` | ||
: ""; | ||
const firstLineLoc = { | ||
start: event.fnLoc.start, | ||
end: { | ||
line: event.fnLoc.start.line, | ||
column: 10e3, | ||
}, | ||
}; | ||
Comment on lines
+163
to
+169
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Slightly hacky, but the alternative is to attach another loc object to events (e.g. function identifier, parameters, etc). This felt cleaner, as not all functions we compile have id or param nodes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth noting that in Flow we have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ohhh i've wanted that a few times |
||
context.report({ | ||
message: `[ReactCompilerBailout] ${detail.reason}${locStr}`, | ||
loc: event.fnLoc, | ||
loc: firstLineLoc, | ||
suggest, | ||
}); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that
infer
is already thecompilationMode
default, so this override only affects user-specifiedcompilationMode
s (by overriding all other options toinfer
).