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

Configuration for rule "indent" is invalid error when running a full path file. #9479

Closed
happyhebaby opened this issue Oct 18, 2017 · 17 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion needs info Not enough information has been provided to triage this issue

Comments

@happyhebaby
Copy link

Tell us about your environment

  • **ESLint Version:2.15.5
  • **Node Version:6.11.3
  • **npm Version:2.15.5

What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
basically a bare version of custom rules that I implemented. I had to remove the bulk portion of a working config from the package.json file as they no longer work current version and gave all sorts of errors.
{
"rules": {
"no-eval": 1,
...omitted other rules
}
}

What did you do? Please include the actual source code causing the issue.
If I run the following command pointing to the rules dir and a local js file, it runs fine:
eslint -c package.eslint.json --rulesdir C:\mycompany\SecTools\Code\nodejs\NodeJSSecRun\eslint\eslint-rules app.js
If I run the same command to a full path file, basically change app.js to c:\foo\bar\app.js
It will error:
Error: c:\mycompany\GoogleChromeExtension\package.json:
Configuration for rule "indent" is invalid:
Value "[object Object]" should NOT have additional properties.

at validateRuleOptions (C:\Program Files\nodejs\node_modules\eslint\lib\config\config-validator.js:113:15)
at Object.keys.forEach.id (C:\Program Files\nodejs\node_modules\eslint\lib\config\config-validator.js:153:9)
at Array.forEach (native)
at validateRules (C:\Program Files\nodejs\node_modules\eslint\lib\config\config-validator.js:152:30)
at Object.validate (C:\Program Files\nodejs\node_modules\eslint\lib\config\config-validator.js:230:5)
at loadFromDisk (C:\Program Files\nodejs\node_modules\eslint\lib\config\config-file.js:549:19)
at Object.load (C:\Program Files\nodejs\node_modules\eslint\lib\config\config-file.js:592:20)
at Config.getLocalConfigHierarchy (C:\Program Files\nodejs\node_modules\eslint\lib\config.js:226:44)
at Config.getConfigHierarchy (C:\Program Files\nodejs\node_modules\eslint\lib\config.js:180:43)
at Config.getConfigVector (C:\Program Files\nodejs\node_modules\eslint\lib\config.js:285:21)

If I just run against a full path dir then it also runs ok.
Let me know if you need any other info.

A big issue with this great tool is all the breaking changes it introduces all the time, what worked fine half year ago no longer work today, and when you spend a lot of time, it may break again in a few months.

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Oct 18, 2017
@not-an-aardvark
Copy link
Member

not-an-aardvark commented Oct 18, 2017

Hi, thanks for the report.

ESLint version: 2.15.5

Was this a typo? This version of ESLint doesn't exist.

Please show your full configuration:

{
  "rules": {
    "no-eval": 1
   }
}

It doesn't seem like you have the indent rule configured at all. If you omitted your indent rule configuration, could you please include it? It's difficult for me to debug your "invalid rule configuration" error without knowing the configuration that you supplied to the rule.

A big issue with this great tool is all the breaking changes it introduces all the time, what worked fine half year ago no longer work today, and when you spend a lot of time, it may break again in a few months.

Actually, we follow a semantic versioning policy which requires that we only make breaking changes in major releases. Moreover, we don't make breaking changes to rule schemas at all. The goal of this is to allow users to upggrade easily, and only receive breaking changes when they opt-in to a new major version.

If you find that we accidentally make a breaking change outside of a major release, I would encourage you to report an issue like you've done here. (In this case, I suspect that this may be a configuration issue on your end, given that we haven't received any other reports about a broken config file.)

@happyhebaby
Copy link
Author

happyhebaby commented Oct 18, 2017 via email

@not-an-aardvark
Copy link
Member

not-an-aardvark commented Oct 18, 2017

Thanks for the clarification.

since I tried an old package.json file which runs fine for a quite while one year ago, it didn't work and gave errors

Could you show me the configuration that caused errors?


In the original issue, you reported a problem where ESLint was outputting an error along the lines of "Configuration for rule 'indent' is invalid:". Could you show me what configuration you were using when that error was produced?


If this is a bug in ESLint, then I'd like to figure out what's causing the bug so that I can fix it. But you will have to provide enough information for me to reproduce the bug.

@aladdin-add aladdin-add added needs info Not enough information has been provided to triage this issue and removed triage An ESLint team member will look at this issue soon labels Oct 19, 2017
@eslintbot
Copy link

Hi @happyhebaby, thanks for the issue. It looks like there's not enough information for us to know how to help you.

If you're reporting a bug, please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. What you did (the source code and ESLint configuration)
  3. The actual ESLint output complete with numbers
  4. What you expected to happen instead

Requesting a new rule? Please see Proposing a New Rule for instructions.

Requesting a rule change? Please see Proposing a Rule Change for instructions.

If it's something else, please just provide as much additional information as possible. Thanks!

@happyhebaby
Copy link
Author

Before the config is as simple as the following to trigger the error:
{
"rules": { "no-eval": 1}
}

However, after the machine rebooted with a bunch of updates. The error went away. I will close the bug for now. If in future I can repro. I will re-open it. Thanks.

@happyhebaby
Copy link
Author

I just repro the issue again. This time I execute eslint from current directory(c:\work\temp) against another full path directory, in that full path directory there is a different package.json. I run eslint with -c option which points to the desired package.json in my working directory c:\work\temp, but eslint seems to ignore that option and still try to pick up the package.json from the targeted directory. It gave the exact same error.

Command I used: c:\work\temp>eslint -c package.json --rulesdir C:\mycompany\SecTools\Code\nodejs\NodeJSSecRun\eslint\eslint-rules c:\mycompany\GoogleChromeExtension

@not-an-aardvark
Copy link
Member

Is there an eslintConfig object in c:\mycompany\GoogleChromeExtension\package.json? What does that object contain?

@happyhebaby
Copy link
Author

It has a different package.json, no other config object. I think this problem existed one year ago when I wrote my initial implementation. There is a work around for this: copy the desired package.json to the targeted dir, it will work, but this looks like a bug too me.

@happyhebaby
Copy link
Author

And I am not sure the purpose of using multiple types of config file like .eslintrc.json and package.json, why not just use one file? This adds confusion and extra complicity to the user.

@not-an-aardvark
Copy link
Member

I'm going to close this issue because I can't reproduce it and you haven't followed the instructions in the issue template. Feel free to create another issue and follow those instructions.

@happyhebaby
Copy link
Author

Other than source code, which I couldn't share due to company policy. I shared all the info asked by the template. I also provided detailed repro steps. Not sure what info you are looking for that hasn't been provided. A good programmer should always investigate and fix bugs in code...

@not-an-aardvark
Copy link
Member

I did investigate the issue, and I found that I couldn't reproduce it based on the steps that you've provided. I think it's most likely that you have an invalid config file somewhere.

@happyhebaby
Copy link
Author

happyhebaby commented Oct 23, 2017 via email

@not-an-aardvark
Copy link
Member

not-an-aardvark commented Oct 23, 2017

Thanks for clarifying. I think the -c option adds an additional config file that ESLint can read, but by default it still looks for other config files in the filesystem. If you use --no-eslintrc -c yourFile.json then only the additional config file will get used.

@happyhebaby
Copy link
Author

happyhebaby commented Oct 23, 2017 via email

@not-an-aardvark
Copy link
Member

Yeah, I agree that it's sort of confusing for -c to also use other config files from the filesystem. Maybe we would be able to change that in the next major release.

@not-an-aardvark
Copy link
Member

Closing in favor of #9535

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Apr 28, 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 Apr 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion needs info Not enough information has been provided to triage this issue
Projects
None yet
Development

No branches or pull requests

4 participants