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
Proposal: eslint --doctor #8241
Comments
In my view, there are two types of configuration issues here:
I think the first type of issue should be addressed by throwing an error when eslint is run, because there's a high likelihood of user error. I'm not sure having a separate command would be useful for these problems, because:
I think the second type of issue is better suited to having a separate command (e.g.
To summarize, I'm concerned that the |
I think a command line option for checking configuration file sanity would be useful. Having to run In my opinion having the ability to run I also think that the |
Prior art: |
If |
Don't get too hanged up on the name, I'm more interested in the idea. We can find a better name ( @not-an-aardvark It wouldn't replace reporting errors when eslint is run. About users not knowing the command, we could tell them to use it if there is a problem. |
Could you explain how this flag would be an improvement over just looking at the error message when eslint is run? Would it do anything other than displaying an error message? |
It could try to detect more problems instead of a single one and it wouldn't need to run the rules. I'm not sure how feasible it would be without duplicating much logic, though, it's something we would have to explore. It would allow us to introduce "warnings" (non fatal problems, the second category you mentioned) without worrying about them being a breaking change. |
I'm not seeing the benefit of this. I see how it might be useful to detect multiple errors rather than a single one, but it seems like in many cases encountering a fatal problem would prevent it from doing anything else useful anyway. Validating a config without running the rules can already be done with As far as deprecation warnings are concerned: If they're going to be behind a flag anyway, I think it would be better to have a specific flag for them, e.g. |
@not-an-aardvark Shouldn't eslint show deprecations by default? Is the only way to check if a rule is deprecated with the documentation or the change log? |
Also |
This command would still need to accept a path so that it would know which configs in subdirectories would need to be applied. But fair enough, I see how it would be useful to have a command to check that a config is valid without actually running eslint. In that case, I suppose my concern with this proposal is that the |
So you think we should have one command for fatal issues and another for informational ones? |
Not necessarily -- I just think deprecations are separate from config validation. If there are non-fatal issues resulting from possible configuration errors (although I'm not sure what this would look like), I think the config-validation command should also report them. |
One additional feature that would be nice would be detecting duplicate rule definitions, e.g. (I extend eslint's config which defines |
Also, I feel like deprecation warnings should be opt-out, not opt-in. I'm not aware of any other library/framework/tool which has deprecations as opt-in. Fussy console messages get things fixed quickly. |
Thanks for your interest in improving eslint. Unfortunately, it looks like this issue didn't get enough support from the team and so I'm closing it. While we wish we'd be able to accommodate everyone's requests, we do need to prioritize. We've found that issues failing to reach consensus after 21 days tend to never do it, and as such, we close those issues. This doesn't mean the idea isn't interesting, just that it's not something the team can commit to. |
There are a few issues related to catching problems in configuration. I think it would be useful to have an specific API and command line option to check the configuration of eslint for a given path.
It could be used:
The text was updated successfully, but these errors were encountered: