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
Based on the number of rules you want to ignore (All, or Some), and the scope of disabling it (Line(s), File(s), Everywhere), we have 2 × 3 = 6 cases.
Case 1.1: You want to disable "All Rules" for "One or more Lines"
Two ways you can do this:
/* eslint-disable-line */ at the end of the line(s),/* eslint-disable-next-line */ right before the line.Case 1.2: You want to disable "All Rules" for "One File"
/* eslint-disable */ at the top of the file.Case 1.3: You want to disable "All rules" for "Some Files"
There are 3 ways you can do this:
/* eslint-disable */ on top of the files, one by one..eslintignore. This works well especially if you have a path that you want to be ignored. (e.g. apidoc/**).eslintignore file, you can add
"eslintIgnore": ["file1.js", "file2.js"] in package.json as
instructed here.Case 2.1: You want to disable "Some Rules" for "One or more Lines"
Two ways you can do this:
You can put /* eslint-disable-line quotes */ (replace quotes with your rules) at the end of the line(s),
or /* eslint-disable-next-line no-alert, quotes, semi */ before the line.
Case 2.2: You want to disable "Some Rules" for "One File"
/* eslint-disable no-use-before-define */ comment at the top of the file.More examples here.
Case 2.3: You want to disable "Some Rules" for "Some files"
"excludedFiles" object of "overrides" section of your .eslintrc as instructed here.