eslint-config-vast
ESLint shareable config Vast's JavaScript coding standards
![devDependency Status](https://david-dm.org/vast-engineering/eslint-config-vast/peer-status.svg)
Installation
npm install eslint-config-vast --save-dev
Usage
For server-side (Node.js) code
Create .eslintrc
file in the root of your project with the following config:
{
"extends": "eslint-config-vast",
"rules": {
}
}
For client-side code
Since the default settings are for server-side, in case you want to use the config for a client-side project, or in case you want to add an additional .stylelintrc
file in a client-side code folder (e.g. /client/.eslintrc
), use the following config:
{
"extends": "eslint-config-vast",
"env": {
"browser": true,
"es6": false
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 8
},
"globals": {
"SOME_GLOBAL": false
},
"rules": {
}
}
Setting up ESLint
If you haven’t already set up ESLint on your project, run:
npm install eslint --save-dev
Add "eslint" to "scripts" in package.json
(wrap globstar pattern with single quotes):
"scripts": {
"eslint": "eslint js tests *.js --ignore-pattern 'js/vendor/**/*.js'"
}
...and then you can run:
npm run eslint
To add a Git pre-commit hook for ESLint, run:
npm install pre-commit --save-dev
...and add this to package.json
:
"pre-commit": [
"eslint"
]
Tip: For real-time linting in your text editor, see ESLint integrations for editors.
Tip: Run eslint --fix /path/to/file.js
to automatically fix as many issues as possible.
Tip: You can create a personal configuration file in your home directory (~/.eslintrc
), it will only be used if no other configuration files are found. See Configuration Cascading and Hierarchy. But make sure to all install dependencies globally with -g
flag.
Related
License
MIT © 2016 Vast.com, Inc.