ESlint Sammy Preset
Highly opinionated & React/JSX centric.
Features:
- Lots of React goodness
- "Prettier" formatting (https://prettier.io/)
Installation
Step 1:
yarn add eslint eslint-sammy-preset --dev
or, if you use npm:
npm install eslint eslint-sammy-preset --save-dev
Step 2:
To the root of your project add the following two files:
.eslintrc.js
module.exports = require('eslint-sammy-preset');
.prettierrc.js
module.exports = require('eslint-sammy-preset/.prettierrc.recommended.js');
Step 3:
Add to your package.json "scripts" key (if doesn't exist, create):
"scripts": {
"lint": "\"./node_modules/.bin/eslint\" src --ext js,ts,tsx",
"lint:fix": "\"./node_modules/.bin/eslint\" src --ext js,ts,tsx --fix",
}
Step 4:
Run in your terminal
yarn lint
or, if you use npm:
npm run lint
Step 4.5
To auto-fix your code formatting:
yarn lint:fix
or, if you use npm:
npm run lint:fix