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.

Proposal: throw error if no config file is found

See original GitHub issue

From my travels around the internet, it seems that first-time ESLint users are very confused about the “nothing by default” mode. It seems many do not read the getting started docs, and so don’t know to use --init to get started. That leaves them thinking that ESLint is broken because JSHint shows output out of the box.

To remedy this, I’d like to propose that in 3.0, we change the default behavior to use eslint:recommended when we don’t find a config file. This should only affect CLI users and not affect CLIEngine by default (so as not to affect API consumers).

Another option is to automatically run --init when a config file isn’t found, but that won’t work well in editors, where an interactive prompt won’t be available.

Edit: new proposal is throwing an error asking the user to run --init (we can use a pretty error message via messagsTemplate rather than showing the stack trace).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:26 (25 by maintainers)

github_iconTop GitHub Comments

7reactions
nzakascommented, Apr 30, 2016

Agree. @ilyavolodin makes a strong case for why using a default config is a bad idea. Thanks for taking the time to explain (and for everyone watching, I’d hold this up as an example of how to argue your case, taking the time to write more than a couple sentences makes a huge difference).

I can get behind throwing an error asking the user to run --init (we can use a pretty error message via messagsTemplate rather than showing the stack trace).

Are people good with that?

6reactions
ilyavolodincommented, Apr 29, 2016

Here’s a situation where I think this is going to create more problems then it will solve:

I’m a new user and I just installed ESLint and ran it on my repository without configuring it first. I got a bunch of errors and fixed them all. Now I continue to run ESLint with no config for a while on my repository and after a while I go to twitter and post “Love ESLint, but I wish it could check for indentations!”. Somebody responds with “All you need to do is add indent: 2 to your .eslintrc file and it will”. So I go do that and get a bunch of indentation errors that I fix. Now for the next few weeks I keep running ESLint, but at this point what I don’t realize is that the only rule that is checked by ESLint is indent. Since I fixed all of the previous errors, until I create a new error and remember that it should’ve been flagged, I have no way of knowing that default rules no longer apply.

This silent change is what I’m afraid of. I can see how this one change might result in a bunch of issues for us, create confusion for new users and in general make users very unhappy.

In my mind, exiting ESLint process with an error “No config file found, please run 'eslint --init` to configure. Exiting.” is much more to the point and explain to users how to get started. If we do this with exit code 1, most of the editors should be able to pick up this error (since they have to be able to pick up parsing errors, which are display in the same format). This will stop CI builds, but that’s probably a good thing as well.

P.S. I apologize for not making my thoughts clearer in the first response. I’m still a bit jet-lagged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint throws exception when no configuration file found. #7144
The easiest way to fix this is to run eslint --init and create a configuration file. Please see the section in the migration...
Read more >
File not found exception, only when including the code as a ...
First, verify that the configuration files are actually being packaged into the jar. I would view it in an archive viewer or unpack...
Read more >
DOORS error messages - IBM
A failure occurred attempting to add section ''{0}'' to module ''{1}''. CRCRD5010E The section, {0}, was not found in this module: {1}.
Read more >
Thoughts on the “guard” proposal for Go's error handling
My pet peeve is that when error types differ, I need to juggle between `err` ... could not open "doc.txt": open "doc.txt": file...
Read more >
detectron2.config
If not given, return all keys (whose values are config objects) in a dict. ... In that case we will print an error...
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