[healthcheck] Check for StrictMode

ghstack-source-id: f05222073be785b77346c4e8760bf4d0bb4d658e
Pull Request resolved: https://github.com/facebook/react-forget/pull/2922
This commit is contained in:
Sathya Gunsasekaran
2024-05-01 13:35:06 +01:00
parent c88d356603
commit 36d775596f
@@ -20,6 +20,9 @@ import yargs from "yargs/yargs";
const SUCCESS: Array<LoggerEvent> = [];
const ACTIONABLE_FAILURES: Array<LoggerEvent> = [];
const OTHER_FAILURES: Array<LoggerEvent> = [];
let STRICT_MODE_USAGE = false;
const StrictModeRE = /\<StrictMode\>/;
const logger = {
logEvent(_: string | null, event: LoggerEvent) {
@@ -113,11 +116,16 @@ async function main() {
const source = await fs.readFile(path, "utf-8");
spinner.text = `Compiling ${path}`;
compile(source, path);
if (!STRICT_MODE_USAGE) {
STRICT_MODE_USAGE = StrictModeRE.exec(source) !== null;
}
}
spinner.stop();
console.log(`Successful compilation: ${SUCCESS.length}`);
console.log(`Failed compilation: ${ACTIONABLE_FAILURES.length}`);
console.log(`StrictMode usage: ${STRICT_MODE_USAGE}`);
}
main();