varp-code
v0.0.3
Published
ESLint, StyleLint, Prettier configs by Varp
Downloads
2
Maintainers
Readme
varp-code
ESlint
- Install with peer dependencies:
npm install --save-dev varp-code eslint eslint-import-resolver-alias eslint-import-resolver-typescript eslint-plugin-import eslint-plugin-react eslint-plugin-react-hooks @typescript-eslint/eslint-plugin @typescript-eslint/parser prettier eslint-config-prettier eslint-plugin-prettier
- Create
.prettierrc.json
file with content:
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"printWidth": 120,
"useTabs": false
}
- Create
.eslintrc.js
file with content:
module.exports = {
extends: ["plugin:varp-code/index"],
rules: {
/* Additional rules */
}
};
- Add
.vscode/settings.json
file with content:
{
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.trimAutoWhitespace": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": [
"typescript",
"typescriptreact"
],
"eslint.run": "onSave",
"eslint.nodePath": "./node_modules"
}
- Add new scripts to package.json:
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
StyleLint
- Install with peer dependencies:
npm install --save-dev stylelint stylelint-config-recommended stylelint-order stylelint-scss stylelint-selector-bem-pattern
- Create
.stylelintrc.js
with content:
module.exports = {
extends: ["plugin:varp-code/style"],
rules: {
/* Additional rules */
}
};
- Add
.vscode/settings.json
with content:
{
"editor.codeActionsOnSave": {
"source.fixAll.stylelint": true
},
"stylelint.validate": ["scss"],
}
- Add
.stylelintignore
with content:
node_modules
!*.scss
- Add new scripts to package.json:
"scripts": {
"stylelint": "stylelint .",
"stylelint:fix": "stylelint . --fix"
}
- Call
stylelint
witheslint
:
"scripts": {
"lint": "stylelint . && eslint .",
"lint:fix": "stylelint . --fix && eslint . --fix"
}
Notes
typescript
package not onpeerDependencies
, but it require to be on the project.