-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Support specifying extensions in the config #10828
Comments
@ilyavolodin Do you have any background on why |
I think it was done for historical reasons. ESLint originally only supported js files. Once we added support for jsx we had the need to also lint jsx files, but at that point, all the rules that would apply to js files would also apply to jsx files, so there was no reason to create separate configurations for extensions. As such it was added as a command line flag. @nzakas wanted to change the functionality of how extensions are specified and also modify the way preprocessors are configured, but we never got around to doing that. |
Unfortunately, it looks like there wasn't enough interest from the team Thanks for contributing to ESLint and we appreciate your understanding. |
@not-an-aardvark @ilyavolodin Can this be reopened please? It's a sorely needed feature and the issue has many upvotes. |
Also think it should be re-opened. Doesn't feel very intuitive when the end user has to specify CLI flags for certain configs to work. I think that should be specified by the config itself making it "self-contained". |
Self-assign to prevent auto closing and for discussion. |
Does it make sense to add Although of course if config could specify it, that would probably solve it as well. I'm not sure how many people extend the eslint plugin's recommended config (it has a bunch of stylistic rules, so it might be that people just add the parser without the plugin?) |
For current JavaScript eco-system, not only |
I don't see how we can make this happen. As I mentioned, configs are constructed after globs are resolved (that's how we know where to look for configs to begin with). If extensions are going to be in config files, we will not know them soon enough to construct correct globs. For example, if you have a subfolder with only |
Babel added what they call "project-wide" configuration (more details there) I'm not praising babel's solution, I found it weird the first time I read it, but I think it's worth consideration to solve this issue. |
The new ESLint config format proposal might resolve this: eslint/rfcs#9 |
XO should not lint type definition files until eslint/eslint#10828 has been resolved.
Hi. #11546 changed the processing order to "config-then-files" from "files-then-config". Now ESLint loads config files before globs resolved, so there are no technical barriers to implement this. There are some related RFCs: eslint/rfcs#20, eslint/rfcs#22 Personally, I hope to go with eslint/rfcs#20, though it's on 7.0.0 line since 6.0.0 has been feature-frozen. |
@mysticatea Is there an eta for this (or v7)? No rush, just wondering because I'm making a custom wrapper for ESLint (as well as other dev tools) to solve some repetitive issues I have across my projects, I was going to bake the extension handling into it, but if v7 comes out soon(ish), I was thinking I might as well leave it out |
I think, we will start to publish v7 alpha releases December 2019 or January 2020. |
…12677) * Breaking: lint `overrides` files (fixes #10828, refs eslint/rfcs#20) * update docs * sort for tests See also: #12700 (comment)
…s#20) (eslint#12677) * Breaking: lint `overrides` files (fixes eslint#10828, refs eslint/rfcs#20) * update docs * sort for tests See also: eslint#12700 (comment)
The version of ESLint you are using.
v5.5.0
The problem you want to solve.
It's currently only possible to specify the extensions of the files to lint with the
--ext
CLI flag. This creates an annoying user-experience for sharable configs that adds support for non-JS environments. For example, if someone wants to use myeslint-config-xo-typescript
shareable config, they need to run ESLint witheslint . --ext=ts
.Your take on the correct solution to problem.
It should be possible to specify an extension in the ESLint config. This makes it possible to create a shareable config that can be used directly without having to use any CLI flags.
For example:
I don't see any downside with supporting this. And it would also make it easier to use ESLint with non-JS files in non-CLI situations like editors and with wrappers like XO and Standard.
The text was updated successfully, but these errors were encountered: