Questions tagged [eslintignore]

.eslintignore is a file which lists files that esLint should not lint as part of a javascript projet

.eslintignore is a file which lists files that esLint should not lint as part of a javascript projet. The file should be located int the root directory of the project.

eslintignore grammar

  • Lines starint with # are treated as comments and are not ignored.
  • All paths are treated as relative paths to the .eslintignore file.
  • Patterns follow the same behavior as the .gitignore.
  • Lines strating with ! are treated as reinclusion from a previous exclusion.

Some pattern are always ignore by default, this is the case for directories like /node_modules/* and /bower_components/*

/# This line will be ignored
/build/*
/|build/index.js
/*.min.js

The following files will be ignored:

  • Every files in the build directory, except index.js.
  • Every minified javascript files.

You can specify any file as a eslintignore when launching eslint with the --ignore-path argument, as long as the file follows the .eslintignore standard. For example you could use a .jshintignore. Although when using this argument this file will be used in place of the project .eslintignore

/eslint --ignore-path .jshintignore myfile.js

Files can also be ignored in the package.json if no .eslintignore file is found.

/{
/  "name": "mypackage",
/  "version": "0.0.1",
/  "eslintIgnore": ["hello.js", "world.js"]
/}

The --no-ignore argument can also be used to bypass the the ignore rules.

11 questions
34
votes
6 answers

Allow debugger; statements in certain files, using ESLint

Say I want to use this rule: https://eslint.org/docs/rules/no-debugger however, I have about 15 files where I want to keep debugger; statements. Is there something I can add at the top of the .ts/.js files, that can tell ESLint to ignore the…
user7898461
13
votes
2 answers

Is there a way to ignore test files for eslint-plugin-security?

With a node.js project, I've added eslint-plugin-security and it is giving a lot of warnings for code in my test/spec files (using mochajs). Since the test code won't be running in production, these don't seem as useful as they do in the project's…
Jim
  • 3,476
  • 4
  • 23
  • 33
11
votes
0 answers

eslint ignores all files when adding specific file to ignorePatterns

I'm trying to implement eslint in a Next.js project but I don't want next.config.js to be linted. I tried adding ignorePatterns to .eslintrc.json, adding a .eslintignore file and adding eslintIgnore property to my package.json and they all seem to…
Thiago Loddi
  • 2,212
  • 4
  • 21
  • 35
5
votes
1 answer

Disabling eslint for .ejs files

I have a template file on my project and while running the eslint I am facing various issues because of it. Some of those are - error Parsing error: Unexpected token ! error Parsing error: Unexpected token < To overcome from that I tried to use…
Jeet
  • 5,569
  • 8
  • 43
  • 75
4
votes
1 answer

How can I make eslint/vscode-eslint stop linting .eslintrc?

Problem I have a bunch of "Problems" in my VS Code PROBLEMS pane from eslint complaining about various JSON issues with my .eslintrc. Linting the directory outside of VS Code does not show me .eslintrc issues. My .eslintrc and .eslintignore files…
Eric H
  • 1,100
  • 16
  • 32
4
votes
0 answers

ESlint - Parsing error: Unexpected token for class private function

I got Parsing error: Unexpected token for below class's _processMessage (private function). i am using babel and eslint ("babel-eslint", "babel-cli", "babel-core", "babel-preset-env", "babel-plugin-add-module-exports", "eslint", …
Gopi
  • 163
  • 1
  • 13
3
votes
2 answers

ESLint linting node_modules

I have been trying all results on google search as a possible solution but without any luck so far. Whenever I run npm run vue-cli-service serve --port 1024 on my vue project (created using vue cli) I get errors from node_modules 4111:10 Type alias…
Bruno Francisco
  • 3,841
  • 4
  • 31
  • 61
2
votes
3 answers

eslint not ignoring node_modules and getting error when try to lint

I'm trying to implement eslint in a Next.js project.The file structure look like below .eslintignore .eslintrc.js .next .prettierrc .stylelintrc.js components forms modals modules node_modules And I have node_modules/* in my .eslintignore file.…
Rich
  • 155
  • 1
  • 8
  • 23
2
votes
0 answers

When debugging JavaScript within Visual Studio Code and ESlint, is it possible to turn off the default of stepping into ?

When debugging JavaScript in Visual Studio Code using ESlint, most of the files it tries to step into are node_internals, eg: module.js, bootstrap_node.js util.js etc. You can manually 'Toggle skipping this file' to skip them but it doesn't remember…
Leigh Mathieson
  • 1,658
  • 2
  • 17
  • 25
1
vote
1 answer

.eslintignore exclusions not applying when launching eslint

Here is my project architecture : My .eslintignore : /public/* /test/* These two folders are located at client/public && client/test but for some reason when starting eslint, it still lints my excluded files. I am launching eslint through this…
Jaro
  • 1,587
  • 5
  • 20
  • 39
0
votes
0 answers

How to exclude documentation folder from eslint

I am creating documentation in a React app (using web-pack) by running the following command, jsdoc src -r -d docs This creates a folder on the root of the app called docs. However when I run npm test sometest.test.js, eslint runs before the test…
Ahmed
  • 2,966
  • 7
  • 42
  • 69