Linter
Table of contents
- Installation
- Scripts
- Usage
Installation
- Install
@rmyzdev/react-linter
package:
npm i -D @rmyzdev/react-linter
2. Add these lines to package.json
:
"eslintConfig": {
"extends": ["./node_modules/@rmyzdev/react-linter/.eslintrc.js"]
},
"stylelint": {
"extends": "./node_modules/@rmyzdev/react-linter/stylelint.config.js"
},
"prettier": "./node_modules/@rmyzdev/react-linter/.prettierrc.js"
Scripts
- Add these
scripts
to the package.json
:
"eslint": "./node_modules/.bin/eslint ./src",
"stylelint": "./node_modules/.bin/stylelint \"**/*.{js,jsx}\"",
"format": "npm run prettier -- --write",
"prettier": "./node_modules/.bin/prettier \"**/*.{js,jsx,css,json}\"",
Usage
Lint JS files
npm run eslint [options]
Fix JS files
npm run eslint -- --fix [options]
Format JS files
npm run format [options]
Lint Styled-Components
npm run stylelint [options]
Fix Styled-Components
npm run stylelint -- --fix [options]