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.

ESLint looks for .eslintrc.* files even when `-c` flag is used

See original GitHub issue

Tell us about your environment

  • ESLint Version: master
  • Node Version: 8.8.0
  • npm Version: 5.4.2

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

Configuration
# foo.yml

rules:
  semi: 2
# .eslintrc.yml

rules:
  no-console: 2

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

console.log('foo');
eslint -c foo.yml foo.js

What did you expect to happen?

I expected no errors to be reported, because I used the -c flag to specify a config, so I did not expect ESLint to also look for other config files in the filesystem.

What actually happened? Please include the actual, raw output from ESLint.

1:1   error  Unexpected console statement         no-console

In addition to the config file specified with -c, ESLint also looked for .eslintrc files in the current directory, so the no-console rule was enabled.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
not-an-aardvarkcommented, Oct 29, 2017

Ok, it seems like this is working as designed, so I’ll update it to be a documentation issue. I think we should document more clearly that -c still causes ESLint to look for other config files.

1reaction
gyandeepscommented, Oct 29, 2017

I dont think its a bug, it was designed this way. You have to use --no-eslintrc option to disable that feature. So -c and --no-eslintrc are individual options. Thats why your nested .eslintrc files (like in test folder) will respected even when you supply a config file using -c flag.

root: true is used inside .eslintrc files to stop the traversal lookup of .eslintrc files up in the hierarchy chain.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration Files - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Command Line Interface - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
ESLint's new config system, Part 2: Introduction to flat config
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Configuring ESLint - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Working with Rules - ESLint - Pluggable JavaScript Linter
Here is the basic format of the source file for a rule: /** * @fileoverview Rule to disallow unnecessary semicolons * @author Nicholas...
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