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 throws exception when no configuration file found.

See original GitHub issue

When no configuration file is present, eslint prints an exception backtrace to the console and returns an exit status of 1. This throws a spanner in the works of automated syntax checkers like flycheck as seen here.

$ echo 'var x = "y";' | eslint --stdin                                                                                                                                                                
No ESLint configuration found.
Error: No ESLint configuration found.
    at getLocalConfig (/Users/cowboyd/.nvm/versions/node/v4.2.3/lib/node_modules/eslint/lib/config.js:162:35)
    at Config.getConfig (/Users/cowboyd/.nvm/versions/node/v4.2.3/lib/node_modules/eslint/lib/config.js:256:22)
    at processText (/Users/cowboyd/.nvm/versions/node/v4.2.3/lib/node_modules/eslint/lib/cli-engine.js:222:33)
    at CLIEngine.executeOnText (/Users/cowboyd/.nvm/versions/node/v4.2.3/lib/node_modules/eslint/lib/cli-engine.js:749:26)
    at Object.execute (/Users/cowboyd/.nvm/versions/node/v4.2.3/lib/node_modules/eslint/lib/cli.js:174:42)
    at /Users/cowboyd/.nvm/versions/node/v4.2.3/lib/node_modules/eslint/bin/eslint.js:57:36
    at ConcatStream.<anonymous> (/Users/cowboyd/.nvm/versions/node/v4.2.3/lib/node_modules/eslint/node_modules/concat-stream/index.js:36:43)
    at emitNone (events.js:72:20)
    at ConcatStream.emit (events.js:166:7)
    at finishMaybe (/Users/cowboyd/.nvm/versions/node/v4.2.3/lib/node_modules/eslint/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:475:14)

One possible solution would be to make this a warning not an error, or also to have an option to suppress the error / warning. e.g. eslint --no-configuration-ok

Environment

> eslint "--version"
>v3.5.0
> node -v                                                                                                                                                   
> v4.2.3
> npm -v

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
Simplifycommented, Sep 13, 2016

Actually, having --check-config or '–show-config-location` option in ESLint that prints location of configuration file of showing notice that there is no configuration is best solution to this problem. In the case that there is configuration, we can still be using ESLint as default JS checker in Emacs and keep ESLint as first JS checker. If there is no configuration we know that using ESLint can not be used. In that case we can fallback to JSHint or something else.

@platinumazure, is implementing this an option for ESLint team?

0reactions
nzakascommented, Oct 3, 2016

Nope, it seems like we’ve resolved what we can resolve.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"No ESLint configuration found" error - Stack Overflow
I had eslint.rc file in my root project directory but event though I was getting error. Solution was to add exclude property to...
Read more >
eslint throws exception when no configuration file found.
When no configuration file is present, eslint prints an exception backtrace to the console and returns an exit status of 1 . This...
Read more >
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 >
no-console - ESLint - Pluggable JavaScript Linter
This rule disallows calls or assignments to methods of the console object. Examples of incorrect code for this rule: /* eslint no-console: "error"...
Read more >
no-unreachable - ESLint - Pluggable JavaScript Linter
The "extends": "eslint:recommended" property in a configuration file enables this rule ... console.log("done"); } function bar() { throw new Error("Oops!
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