4.0.1 • Published 9 years ago
eslint-config-ory-am v4.0.1
ory.am/eslint-config-ory-am
Installation
Install ESLint and the our configuration.
npm install --save-dev eslint eslint-config-ory-amCreate a .eslintrc.json file in your root with the following content:
{
"extends": [
"eslint-config-ory-am",
],
"env": {
"node": true,
"browser": true
}
}Add a linter script to your package.json. In the following example, all files in the src and test folder (and their subfolders) are checked:
{
"scripts": {
"lint": "eslint \"+(src|test)/**/*.js\" --fix"
}
}Watcher task
You can use chokidar-cli to add a task that lints your files on save. First install it:
npm install --save-dev chokidar-cliThen add a watch script to your package.json. In the following example, chokidar will look for changes in any files in the src and test folder (and their subfolders):
{
"scripts": {
"lint": "eslint \"+(src|test)/**/*.js\" --fix",
"lint:watch": "npm run watch:js -- -c \"npm run lint\"",
"watch:js": "chokidar \"+(src|test)/**/*.js\" --initial"
}
}Usage with WebStorm
- Import webstorm-code-style.xml in preferences
Editor › Code Style › JavaScript. - Deactivate
Unterminated statementinspection in preferencesEditor › Inspections