@sahoja/eslint-config-sahoja
v1.0.8
Published
Sahoja's ESLint config
Readme
Sahoja Javascript Styleguide
This package exports a centralized ESLint + Prettier configuration to be used by Sahoja's projects.
The goal of this configuration is to standarize the code style for all Javascript based projects. The config is based upon Airbnb's styles and adds Prettier's rules as well. We're using ESLint v6 because of a better compatibility with the current stable Airbnb packages in NPM.
Setup
Common
For both React and Node.js projects you'll need to set up these configurations:
Add the default prettier config inside package.json
{
...
"prettier": "@sahoja/eslint-config-sahoja/prettier"
...
}Install this package as a development dependency
$ yarn add @sahoja/eslint-config-sahoja --devReact
- Install dependencies
For React-based projects, you'll need to install peer dependencies and the following:
eslint-config-airbnbeslint-plugin-jsx-a11yeslint-plugin-reacteslint-plugin-react-hooks
So your devDependencies should look something like this:
"devDependencies": {
"@sahoja/eslint-config-sahoja": "^1.0.6-beta.0",
"babel-eslint": "^10.1.0",
"eslint": "^6",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^2.5.0",
"prettier": "^2.0.5"
},- Add
.eslintrc
Add an ESLint config file that looks like this:
{
"extends": "@sahoja/eslint-config-sahoja/configs/react"
}Node.js
- Install dependencies
For Node-based projects, you'll need to install peer dependencies and the following:
eslint-config-airbnb-baseeslint-plugin-node
So your devDependencies should look something like this:
"devDependencies": {
"@sahoja/eslint-config-sahoja": "^1.0.6-beta.0",
"babel-eslint": "^10.1.0",
"eslint": "^6",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.3",
"prettier": "^2.0.5"
},- Add
.eslintrc
Add an ESLint config file that looks like this:
{
"extends": "@sahoja/eslint-config-sahoja/configs/node"
}