lyra lint
Opinated linter library for React using styled-components
Installation
- Install
lyra-lint
package:
npm install --save-dev lyra-lint
- Add these lines to
package.json
:
"eslintConfig": {
"extends": ["./node_modules/lyra-lint/.eslintrc.js"]
},
"stylelint": {
"extends": "./node_modules/lyra-lint/stylelint.config.js"
},
Usage
- Add these scripts to the
package.json
:
"eslint": "./node_modules/.bin/eslint \"src/**/*.{js,jsx}\"",
"stylelint": "./node_modules/.bin/stylelint \"src/**/*.{js,jsx}\"",
"format": "npm run prettier -- --write",
"prettier": "./node_modules/.bin/prettier \"src/**/*.{js,jsx,css,json}\"",
- Add as a new property in the
package.json
in order to find the .prettierrc
config from the package:
"name": "",
"version": "",
"description": "",
"main": "",
"scripts": {},
"keywords": [],
"author": "",
"license": "",
"eslintConfig": {},
"stylelint": {},
"prettier": "./node_modules/lyra-lint/.prettierrc.js",
"husky": {},
"lint-staged": {},
"devDependencies": {}
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]