@gbrachetta/eslint-config
v2.4.3
Published
Thorough ESLint configuration for React-based projects based on airbnb and Prettier configs with many additional rules such as autofixable sorting, etc.
Downloads
84
Maintainers
Readme
@gbrachetta/eslint-config
ESLint configuration for a React-based Project (Next.js, Gatsby, etc). Easy to install and configure, it follows the best code standards from airbnb and uses prettier configuration on code format. Integrated with my prettier configuration.
Purpose
This configuration uses airbnb and Prettier configuration plus some extra rules that I find useful for React applications.
For more information, check ESLint and Prettier documentations as well the airbnb and prettier.
This package integrates the Prettier rules with ESLint using my configuration. You can check it at @gbrachetta/prettier-config
How to install
You need ESLint and Prettier installed as development dependencies on your project. You can install them by using npm or yarn.
npm install --save-dev eslint prettier
# or
yarn add eslint prettier -D
Install all peer dependencies of my configuration, these can be listed with the command:
npm info "@gbrachetta/eslint-config@latest" peerDependencies
Install dependencies by:
npx install-peerdeps --dev @gbrachetta/eslint-config
How to use
To configure ESLint and Prettier you can add to your package.json
"eslintConfig": {
"extends": "@gbrachetta/eslint-config"
},
"prettier": "@gbrachetta/prettier-config"
If you need to override or extend the settings, you can create a .eslintrc.json
and .prettierrc.json
files and add extends: "@gbrachetta/eslint-config"
and "@gbrachetta/prettier-config"
respectivally. As an example:
// .eslintrc.json
{
"extends": "@gbrachetta/eslint-config"
}
// you can edit this configuration as usual, check ESLint docs
// .prettierrc.json
{
"@gbrachetta/prettier-config"
}
To use ESLint and Prettier from the terminal, add these scripts to your package.json
file
{
"lint": "eslint ./ --ignore-path .gitignore",
"lint:fix": "npm run lint -- --fix",
"format": "prettier --write \"{,!(node_modules)/**/}*.js\""
}
Contributing
How to contribute to this open source library
License
Copyright © 2022 Guillermo Brachetta. This library is licensed under the MIT license.