eslint-config-varp
v1.10.0
Published
ESLint, Prettier configs by Varp
Downloads
68
Maintainers
Readme
eslint-config-varp
Go in
Setup
- Install:
npm install -D eslint-config-varp
- Create
.prettierrc.js
file with content:
module.exports = {
/* Rrettier rules */
};
- Create
.eslintrc.js
file with content:
module.exports = {
extends: ["varp"],
rules: {
/* Eslint rules */
}
};
- Add
.vscode/settings.json
file with content:
{
"editor.tabSize": 2,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"eslint.format.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
},
"eslint.validate": ["typescript", "typescriptreact", "javascript", "javascriptreact", "markdown", "json"],
}
- Add new scripts to package.json:
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
User cases
Override rules
- Add
overrides
property in config file
module.exports = {
overrides: [
{
files: ["*/**/*.js"],
rules: {
/* Overrided rules */
},
},
],
};
Override rules with file
- Create file in selected folter:
.eslintrc.js
- Add content:
module.exports = {
extends: '../.eslintrc.js',
rules: {
/* Overrided rules */
}
};
Override rules for the folder
overrides: [
{
files: ["folder/**/*.js"],
rules: {
/* Overrided rules */
}
}
]
Ignore path
- Create file:
.eslintignore
- Add content:
disc
Notes
typescript
package is not onpeerDependencies
, but it require to be on the project.