Is it possible to turn off the eslint rule for the whole file? Something such as:
// eslint-disable-file no-use-before-define
(Analogous to eslint-disable-line.) It happens to me quite often, that in a certain file, I'm breaking a specific rule on many places which is considered OK for that file, but I don't want to disable the rule for the whole project nor do I want to disable other rules for that specific file.
You can turn off/change a particular rule for a file by putting the configurations at the top of the file.
/* eslint no-use-before-define: 0 */ // --> OFF
or
/* eslint no-use-before-define: 2 */ // --> ON
Is there a way to put a rule in
.eslintrc
that enforces all file specific rules like this to the top of the file?@Jeremy see my answer. You just need to add an
.eslintignore
file to your project root directory.Nice! Saw some JSON-y answers floating around that didn't seem to work for disabling no-camelcase errors, but this (
/* eslint camelcase: 0 */
) did the trick (using eslint via standard.js)I tried /* eslint-disable rule-name */ and it worked
:1 makes it a Warning instead of Error