Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message about invalid config file does not mention which config file is invalid #8963

Closed
not-an-aardvark opened this issue Jul 18, 2017 · 0 comments
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features

Comments

@not-an-aardvark
Copy link
Member

Tell us about your environment

  • ESLint Version: 4.2.0
  • Node Version: 8.1.4
  • npm Version: 5.0.3

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

N/A

Please show your full configuration:

(see below)

What did you do? Please include the actual source code causing the issue.

My config file looks like this:

# .eslintrc.yml
extends:
  - ./foo.yml
  - ./bar.yml

foo.yml looks like this:

# foo.yml
env: {}

bar.yml, an invalid config file, looks like this:

# bar.yml
invalidProperty: 5

I have an index.js file that looks like this:

a;

I tried to lint index.js: node_modules/.bin/eslint index.js

What did you expect to happen?

I expected to get an error about the invalid config file, and I expected the error message to mention that the invalid config file is bar.yml.

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

A config validation error was thrown, and the following output was produced:

[object Object]:
	ESLint configuration is invalid:
	- Unexpected top-level property "invalidProperty".

Referenced from: /path/to/.eslintrc.yml
Error: [object Object]:
	ESLint configuration is invalid:
	- Unexpected top-level property "invalidProperty".

Referenced from: /path/to/.eslintrc.yml
    at validateConfigSchema (/path/to/node_modules/eslint/lib/config/config-validator.js:192:15)
    at Object.validate (/path/to/node_modules/eslint/lib/config/config-validator.js:205:5)
    at loadFromDisk (/path/to/node_modules/eslint/lib/config/config-file.js:549:19)
    at load (/path/to/node_modules/eslint/lib/config/config-file.js:592:20)
    at configExtends.reduceRight (/path/to/node_modules/eslint/lib/config/config-file.js:421:36)
    at Array.reduceRight (native)
    at applyExtends (/path/to/node_modules/eslint/lib/config/config-file.js:405:28)
    at loadFromDisk (/path/to/node_modules/eslint/lib/config/config-file.js:556:22)
    at Object.load (/path/to/node_modules/eslint/lib/config/config-file.js:592:20)
    at Config.getLocalConfigHierarchy (/path/to/node_modules/eslint/lib/config.js:228:44)

The message does not mention bar.yml (although did does mention that the invalid config was referenced from .eslintrc.yml). This is probably because we used to assume that all config-loading errors were related to not being able to find the file, so it didn't make sense to repeat the filename before.

Also, the error message is printed twice. That part is probably a separate issue.

@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features labels Jul 18, 2017
not-an-aardvark added a commit that referenced this issue Jul 21, 2017
Previously, if an ESLint configuration was invalid, the error message would not contain the filename of the offending config. Instead, the error message contained `[object Object]`, which was probably a bug. This commit updates the error message to clearly indicate which config file contains the error.
not-an-aardvark added a commit that referenced this issue Jul 21, 2017
Previously, if an ESLint configuration was invalid, the error message would not contain the filename of the offending config. Instead, the error message contained `[object Object]`, which was probably a bug. This commit updates the error message to clearly indicate which config file contains the error.
not-an-aardvark added a commit that referenced this issue Jul 21, 2017
Previously, if an ESLint configuration was invalid, the error message would not contain the filename of the offending config. Instead, the error message contained `[object Object]`, which was probably a bug. This commit updates the error message to clearly indicate which config file contains the error.
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features
Projects
None yet
Development

No branches or pull requests

1 participant