0.0.7 • Published 5 years ago
@zorrilla/eslint-config-react v0.0.7
Eslint and Prettier Setup
You can use this config for a project using React and Typescript.
Usage
If you don't already have a
package.jsonfile, create one withnpm init.Then we need to install everything needed by the config:
npx install-peerdeps --dev @zorrilla/eslint-config-reactYou can see in your package.json there are now a big list of devDependencies.
Create a
.eslintrcfile in the root of your project's directory (it should live where package.json does). Your.eslintrcfile should look like this:
{
"extends": "@zorrilla/react"
}Tip: You can alternatively put this object in your package.json under the property "eslintConfig":. This makes one less file in your project.
- You can add two scripts to your package.json to lint and/or fix:
"scripts": {
"lint": "eslint './**/*.{ts,tsx}'",
"lint:fix": "eslint --fix './**/*.{ts,tsx}'"
}- Now you can manually lint your code by running
npm run lintand fix all fixable issues withnpm run lint:fix. You probably want your editor to do this though.