[healthcheck] Check for StrictMode
ghstack-source-id: f05222073be785b77346c4e8760bf4d0bb4d658e Pull Request resolved: https://github.com/facebook/react-forget/pull/2922
Sathya Gunsasekaran committed
May 1, 2024 at 13:35 UTC
36d775596f65470d9139e64ba7f32fe199ef371f
1 file changed
+8
compiler/packages/healthcheck/src/index.ts
+8
@@ -20,6 +20,9 @@ import yargs from "yargs/yargs";
20
const SUCCESS: Array<LoggerEvent> = [];
21
const ACTIONABLE_FAILURES: Array<LoggerEvent> = [];
22
const OTHER_FAILURES: Array<LoggerEvent> = [];
23
+let STRICT_MODE_USAGE = false;
24
+
25
+const StrictModeRE = /\<StrictMode\>/;
26
27
const logger = {
28
logEvent(_: string | null, event: LoggerEvent) {
@@ -113,11 +116,16 @@ async function main() {
116
const source = await fs.readFile(path, "utf-8");
117
spinner.text = `Compiling ${path}`;
118
compile(source, path);
119
+
120
+ if (!STRICT_MODE_USAGE) {
121
+ STRICT_MODE_USAGE = StrictModeRE.exec(source) !== null;
122
+ }
123
}
124
spinner.stop();
125
126
console.log(`Successful compilation: ${SUCCESS.length}`);
127
console.log(`Failed compilation: ${ACTIONABLE_FAILURES.length}`);
128
+ console.log(`StrictMode usage: ${STRICT_MODE_USAGE}`);
129
}
130
131
main();