Home / Function/ main() — react Function Reference

main() — react Function Reference

Architecture documentation for the main() function in index.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  df89b88d_042a_7a49_a2cc_3011dc376d87["main()"]
  6e77e9aa_2734_003c_4db1_e70488f75644["index.js"]
  df89b88d_042a_7a49_a2cc_3011dc376d87 -->|defined in| 6e77e9aa_2734_003c_4db1_e70488f75644
  style df89b88d_042a_7a49_a2cc_3011dc376d87 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/prettier/index.js lines 71–118

async function main() {
  let didWarn = false;
  let didError = false;

  await Promise.all(
    files.map(async file => {
      const options = await prettier.resolveConfig(file, {
        config: prettierConfigPath,
      });
      try {
        const input = fs.readFileSync(file, 'utf8');
        if (shouldWrite) {
          const output = await prettier.format(input, options);
          if (output !== input) {
            fs.writeFileSync(file, output, 'utf8');
          }
        } else {
          const isFormatted = await prettier.check(input, options);
          if (!isFormatted) {
            if (!didWarn) {
              console.log(
                '\n' +
                  chalk.red(
                    `  This project uses prettier to format all JavaScript code.\n`
                  ) +
                  chalk.dim(`    Please run `) +
                  chalk.reset('yarn prettier-all') +
                  chalk.dim(
                    ` and add changes to files listed below to your commit:`
                  ) +
                  `\n\n`
              );
              didWarn = true;
            }
            console.log(file);
          }
        }
      } catch (error) {
        didError = true;
        console.log('\n\n' + error.message);
        console.log(file);
      }
    })
  );
  if (didWarn || didError) {
    process.exit(1);
  }
}

Domain

Subdomains

Frequently Asked Questions

What does main() do?
main() is a function in the react codebase, defined in scripts/prettier/index.js.
Where is main() defined?
main() is defined in scripts/prettier/index.js at line 71.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free