I am trying to lint my files with eslint on file change using npm scripts
:
"scripts": {
"lint": "eslint ./* lib",
"lint:watch":"watch 'npm run lint' .",
"test": "echo \"Error: no test specified\" && exit 1"
}
I use the watch package to acplish this.
I find that the watch task runs infinitely in a loop. Does eslint write to a file in the app's root directory. If so, how can I teach watch to ignore the changes made by eslint
.
My .eslintrc
, if nessecary:
{
"parser":"babel-eslint",
"extends":"eslint:remended",
"rules":{
"strict":2,
"no-var":2,
"prefer-template":2,
"prefer-arrow-callback":1,
"prefer-rest-params":2,
"prefer-spread":2,
"object-shorthand":1,
"no-duplicate-imports":2,
"no-confusing-arrow":2,
"ma-dangle":0
}
}
I am trying to lint my files with eslint on file change using npm scripts
:
"scripts": {
"lint": "eslint ./* lib",
"lint:watch":"watch 'npm run lint' .",
"test": "echo \"Error: no test specified\" && exit 1"
}
I use the watch package to acplish this.
I find that the watch task runs infinitely in a loop. Does eslint write to a file in the app's root directory. If so, how can I teach watch to ignore the changes made by eslint
.
My .eslintrc
, if nessecary:
{
"parser":"babel-eslint",
"extends":"eslint:remended",
"rules":{
"strict":2,
"no-var":2,
"prefer-template":2,
"prefer-arrow-callback":1,
"prefer-rest-params":2,
"prefer-spread":2,
"object-shorthand":1,
"no-duplicate-imports":2,
"no-confusing-arrow":2,
"ma-dangle":0
}
}
Share
Improve this question
asked Apr 4, 2016 at 21:04
vamsiampoluvamsiampolu
6,64220 gold badges89 silver badges193 bronze badges
2
-
to quickly disable a file just put this line at the top:
/* eslint-disable */
– omarjmh Commented Apr 4, 2016 at 21:22 -
1
@Omarjmh I think there was a mismunication, I run a package called
watch
oneslint
, this package is watching for files in the project's root directory, when eslint runs it seems to write to a folder on theroot directory
causing watch to detect changes which runs eslint again. If I know which file, I can askwatch
to ignore it. – vamsiampolu Commented Apr 5, 2016 at 18:59
1 Answer
Reset to default 5You can tell ESLint to ignore specific files and directories by creating an .eslintignore
file in your project’s root directory. This is what one looks like:
It is plain text, simply add a .eslintignore
file to your project and write the files you don't want 'watched'
The following will ignore all JS files:
**/*.js
You can get specific or use a glob pattern like the above to ignore all files of a certain type.
Relevant Docs