1/**2 * Copyright (c) Meta Platforms, Inc. and affiliates.3 *4 * This source code is licensed under the MIT license found in the5 * LICENSE file in the root directory of this source tree.6 */78import {glob} from 'fast-glob';9import * as fs from 'fs/promises';10import ora from 'ora';11import yargs from 'yargs/yargs';12import libraryCompatCheck from './checks/libraryCompat';13import reactCompilerCheck from './checks/reactCompiler';14import strictModeCheck from './checks/strictMode';1516async function main() {17 const argv = yargs(process.argv.slice(2))18 .scriptName('healthcheck')19 .usage('$ npx healthcheck <src>')20 .option('src', {21 description: 'glob expression matching src files to compile',22 type: 'string',23 default: '**/+(*.{js,mjs,jsx,ts,tsx}|package.json)',24 })25 .parseSync();2627 const spinner = ora('Checking').start();28 let src = argv.src;2930 const globOptions = {31 onlyFiles: true,32 ignore: [33 '**/node_modules/**',34 '**/dist/**',35 '**/tests/**',36 '**/__tests__/**',37 '**/__mocks__/**',38 '**/__e2e__/**',39 ],40 };4142 for (const path of await glob(src, globOptions)) {43 const source = await fs.readFile(path, 'utf-8');44 spinner.text = `Checking ${path}`;45 reactCompilerCheck.run(source, path);46 strictModeCheck.run(source, path);47 libraryCompatCheck.run(source, path);48 }49 spinner.stop();5051 reactCompilerCheck.report();52 strictModeCheck.report();53 libraryCompatCheck.report();54}5556main();
Findings
✓ No findings reported for this file.