eslint-config
These are my personal configurations for ESLint. They are based on Airbnb's ESLint configurations.
Base configuration
- Install the required packages:
npx install-peerdeps --dev eslint-config-airbnb-base
npm i --save--dev @zilahir/eslint-config
# If you are using TypeScript, also run the following:
npm i --save-dev @typescript-eslint/eslint-plugin @typescript-eslint/parser
- Create a
.eslintrc.yml
file with the following content in your project root:
root: true
extends:
- "@zilahir/eslint-config/base"
# OR
- "@zialhir/eslint-config/base-typescript"
env:
browser: true
- Add a linting script to your
package.json
file:
{
"scripts": {
"lint:js": "eslint --fix .",
// OR
"lint:ts": "eslint --ext .ts --fix ."
}
}
React configuration
- Install the required packages:
npx install-peerdeps --dev eslint-config-airbnb
yarn add --dev --tilde @samuelmeuli/eslint-config
# If you are using TypeScript, also run the following:
yarn add --dev @typescript-eslint/eslint-plugin @typescript-eslint/parser
- Create a
.eslintrc.yml
file with the following content in your project root:
root: true
extends:
- "@zilahir/eslint-config/react"
# OR
- "@zilahir/eslint-config/react-typescript"
env:
browser: true
node: true
- Add a linting script to your
package.json
file:
{
"scripts": {
"lint:js": "eslint --ext .js,.jsx --fix .",
// OR
"lint:ts": "eslint --ext .ts,.tsx --fix ."
}
}