Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable eslint rules for folder

Tags:

eslint

Is there a way to disable specific rules for a folder? For example, I don't want to have required JSDoc comments for all my test files in the test folder. Is there a way to do this?

like image 308
DevNebulae Avatar asked Feb 15 '17 13:02

DevNebulae


People also ask

How do I disable ESLint for a specific folder?

To ignore some folder from eslint rules we could create the file . eslintignore in root directory and add there the path to the folder we want omit (the same way as for . gitignore ). Excerpt from the ESLint documentation "In addition to any patterns in a .

How do I disable ESLint rules?

If you want to disable an ESLint rule in a file or on a specific line, you can add a comment. On a single line: const message = 'foo'; console. log(message); // eslint-disable-line no-console // eslint-disable-next-line no-console console.

Does ESLint automatically ignore Node_modules?

eslintignore file, ESLint always follows a couple of implicit ignore rules even if the --no-ignore flag is passed. The implicit rules are as follows: node_modules/ is ignored.


1 Answers

To ignore some folder from eslint rules we could create the file .eslintignore in root directory and add there the path to the folder we want omit (the same way as for .gitignore).

Here is the example from the ESLint docs on Ignoring Files and Directories:

# path/to/project/root/.eslintignore # /node_modules/* and /bower_components/* in the project root are ignored by default  # Ignore built files except build/index.js build/* !build/index.js 
like image 97
YaTaras Avatar answered Sep 19 '22 18:09

YaTaras