Adding Static Analysis Tools

https://leanpub.com/code-react-sweetly

Project Configuration

https://leanpub.com/code-react-sweetly

Create a new project directory

https://leanpub.com/code-react-sweetly

Create a package.json file

https://leanpub.com/code-react-sweetly

Install React and ReactDOM

https://leanpub.com/code-react-sweetly

TypeScript Configuration

https://leanpub.com/code-react-sweetly

Install TypeScript and type definitions

https://leanpub.com/code-react-sweetly

Configure the TypeScript compiler

https://leanpub.com/code-react-sweetly

Specify the type-checking command

https://leanpub.com/code-react-sweetly

Develop the project’s React component

https://leanpub.com/code-react-sweetly

Type-check your code

https://leanpub.com/code-react-sweetly

Add static type definitions to your code

https://leanpub.com/code-react-sweetly

Run the type-check script

https://leanpub.com/code-react-sweetly

Create the entry script

https://leanpub.com/code-react-sweetly

Create the web page

https://leanpub.com/code-react-sweetly

Run your application

https://leanpub.com/code-react-sweetly

Optional: Run multiple scripts at the same time

https://leanpub.com/code-react-sweetly

ESLint Configuration

https://leanpub.com/code-react-sweetly

Initialize ESLint’s configuration

https://leanpub.com/code-react-sweetly

Lint your code

https://leanpub.com/code-react-sweetly

Configure eslint-plugin-react to auto-detect the app’s React version

https://leanpub.com/code-react-sweetly

Configure eslint-plugin-react to support the new JSX transform

https://leanpub.com/code-react-sweetly

Add a rel="noreferrer" to the anchor element

https://leanpub.com/code-react-sweetly

Re-lint your code

https://leanpub.com/code-react-sweetly

Customize ESLint rules

https://leanpub.com/code-react-sweetly

Specify the files ESLint should ignore

https://leanpub.com/code-react-sweetly

Prettier Configuration

https://leanpub.com/code-react-sweetly

Install Prettier and eslint-config-prettier

https://leanpub.com/code-react-sweetly

Set up the app’s Prettier formatting rules

https://leanpub.com/code-react-sweetly

Specify the files Prettier should ignore

https://leanpub.com/code-react-sweetly

Check if your files are formatted

https://leanpub.com/code-react-sweetly

Format unformatted files

https://leanpub.com/code-react-sweetly

And That’s It!

https://leanpub.com/code-react-sweetly

Optional: Configure VS Code to Auto-Format and Lint Your Code

https://leanpub.com/code-react-sweetly

1. Install the ESLint and Prettier VSCode extensions

https://leanpub.com/code-react-sweetly

2. Configure VS Code to use Prettier to auto-format on save

https://leanpub.com/code-react-sweetly