question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use .gitignore by default if no .eslintignore is found

See original GitHub issue

This is a proposal intended to reduce the friction for the adoption of eslint into a project. Most times, files which are not version controlled are also not linted (node_modules being a common example, but also compiled code and dynamically generated files as well). Currently, every project must either create an .eslintignore file to specify those files, or if they are using a .gitignore, they can add a command line flag like --ignore-pattern .gitignore. But in both cases they must take an action to prevent non-controlled files from being linted.

In the Gitter chat room earlier today, @gabmontes suggested that we could default to using a .gitignore file if no .eslintignore file is found (and of course no --ignore-path or --ignore-pattern was provided).

I believe this is a sane default. It is easily overridden, but will be sufficient for the vast majority of users. It will help avoid config file clutter, and lower the learning curve for getting started with ESLint.

I’d be willing to implement this if it is accepted, although I’m guessing this could be seen as a breaking change and may need be held until a major version bump.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
qfoxcommented, Apr 16, 2016

Ah, forget about tricky solution: symlinking .eslintignore to .gitignore usually works just fine.

1reaction
nzakascommented, Apr 15, 2016

@zxqfox we made --ignore-path .gitignore work correctly so that people had the option to use their .gitignore file for this purpose. I think that’s the correct recommendation for solving this problem rather than changing the default behavior.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignoring Code - ESLint - Pluggable JavaScript Linter
gitignore . Using eslintIgnore in package.json. If an .eslintignore file is not found and an alternate file is not specified, ESLint looks in ......
Read more >
Visual Studio Code ESLint Extension: Use .gitignore as ...
eslintignore , in the ESLint Visual Studio Code extension? I know it is possible when using eslint from the command line: eslint --ignore-path...
Read more >
.gitignore mistake that everyone makes - DEV Community ‍ ‍
gitignore should be a whitelist, not a blacklist of files you want to include. If we look at a bunch of random open-source...
Read more >
eslint-plugin-import - npm
Start using eslint-plugin-import in your project by running `npm i ... will not report the matching module if no export s are found....
Read more >
Configuring ESLint - Breword 文档集合
We recommend using eslint-plugin-react if you are using React and want React ... for ESLint to work properly with features not in ECMAScript...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found