-
Install ESLint globally
$ npm install -g [email protected]
Verify ESLint is available globally
$ eslint -v
The terminal should output version info.
-
Ensure
.eslintrc.json
and.eslintignore
exist at the root of the local repo holding your code:When the files are missing, get them from the corresponding Github repo.
Before R3.2, find the files from below branches. Afterwards they should be avaliable and up-to-date on master branch.
-
Enable ESLint in WebStorm
- Go to Perference > Languages & Frameworks > JavaScript > Code Quality Tools > ESLint
- Select the Enable checkbox
- Set ESLint package to
/usr/local/lib/node_modules/eslint/
- Click OK to save
-
To run ESLint on specific file/directory:
$ eslint <relative/absolute path to the file/directory>
-
To let ESLint automatically fix some safe-to-fix errors:
$ eslint --fix <relative/absolute path to the file/directory>
A list of fixable errors can be found here(marked by wrench icon).
-
To disable some ESLint rule for certain code block/statement, find details from here
/* eslint-disable */ { foo(); bar(); baz(); } /* eslint-enable */ alert('foo'); // eslint-disable-line // eslint-disable-next-line alert('foo');
- Adjust linting rules:
Modify
.csslintrc
at the root ofcontrail-web-core
repo. - Run Linting task against some repo(s) (webCore, webController, webStorage and serverManager):
-
navigate into the root folder of
contrail-web-core
repo. -
run below command
$ make css-lint REPO=<comma-seperated-repo-list>
-