Is it possible to turn off the eslint rule for the whole file? Something such as:
// eslint-disable-file no-use-before-define
(Analogous t
/* eslint-disable */
//suppress all warnings between comments
alert('foo');
/* eslint-enable */
This will disable all eslint rules within the block.
As of today, the answer does not work for me, but putting this at the top of the file does work:
/* eslint-disable @typescript-eslint/no-unused-vars */
It is important to know that at least in my case, the type of comment makes a difference. The previous comment works for me, but the following won't work:
// eslint-disable @typescript-eslint/no-unused-vars
You can turn off specific rule for a file by using /*eslint [<rule: "off"], >]*/
/* eslint no-console: "off", no-mixed-operators: "off" */
Version: eslint@4.3.0
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
More info
Simply create an empty file .eslintignore
in your project root the type the path to the file you want it to be ignore.
Source: https://eslint.org/docs/2.13.1/user-guide/configuring#:~:text=To%20disable%20rule%20warnings%20in,*%2F%20alert('foo')%3B
Line Ignoring Files and Directories
Accepted answer didn't work for me (maybe a different version of eslint...? I'm using eslint v3.19.0
), but did find a solution with the following...
Place the following on the top of your file
/* eslint-disable no-use-before-define */
This will disable the rule for the entire file