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

Configurable Extension Filter #801

Closed
dfreeman opened this issue Apr 16, 2014 · 10 comments
Closed

Configurable Extension Filter #801

dfreeman opened this issue Apr 16, 2014 · 10 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 cli Relates to ESLint's command-line interface enhancement This change enhances an existing feature of ESLint good first issue Good for people who haven't worked on ESLint before

Comments

@dfreeman
Copy link

Currently it appears the .js extension filter is hard coded when traversing a directory hierarchy for files to lint. It would be nice for this to be configurable, particularly as ES6 support starts to come up.
As an example use case, we're currently using .js.es6 as an extension for files that have ES6 module syntax transpiled to AMD, and it would be nice to be able to lint the original source files.

@nzakas
Copy link
Member

nzakas commented Apr 16, 2014

Can you explain the use case a bit more? I'm not quite following. ESLint can't understand ES6 syntax (yet) so it seems like you'd want to skip over .js.es6 files.

@dfreeman
Copy link
Author

For the moment that's absolutely the case. More just interested in getting this on the radar for whenever ES6 support does land.

I believe the repo README says ES6 would be revisited after the 0.5.0 release, so I was hopeful there might be some movement on that front soon :)

@nzakas
Copy link
Member

nzakas commented Apr 16, 2014

Yes, we are basically waiting for ES6 support in Esprima to land.

@nzakas nzakas added the accepted There is consensus among the team that this change meets the criteria for inclusion label Sep 20, 2014
@nzakas
Copy link
Member

nzakas commented Nov 27, 2014

Working on this.

@nzakas nzakas closed this as completed in 02898c1 Nov 27, 2014
nzakas added a commit that referenced this issue Nov 27, 2014
New: Allow other file extensions (fixes #801)
Holixus pushed a commit to Holixus/eslint that referenced this issue Feb 12, 2015
@SimenB
Copy link
Contributor

SimenB commented Oct 2, 2015

Is it possible to define the extensions-array in .eslintrc? .jsx files are not picked up even though ecmaFeatures contains jsx: true. If I give the CLI just the jsx-file directly it's linted, but giving it the directory containing a .jsx-file it's not linted.

Current workaround is just to name the file .js, of course, but we'd like to use the jsx-extension

@mwilc0x
Copy link

mwilc0x commented Oct 18, 2015

I'm seeing the same behavior as @SimenB where the ecmaFeatures: { jsx: true } is not working for including jsx files.

If possible, I'd like to stick with .jsx extension because it is offering the best dev experience with the ide my team is using. Having eslint support for this would be nice.

@ilyavolodin
Copy link
Member

You have to use --ext CLI option in order to lint jsx files.

@mwilc0x
Copy link

mwilc0x commented Oct 18, 2015

Thanks @ilyavolodin, --ext=js --ext=jsx does work. Is there a way to configure this from .eslintrc? Thanks.

@SimenB
Copy link
Contributor

SimenB commented Oct 18, 2015

I tried digging in the source, and it seems .eslintrc is only read AFTER a file is loaded. So I'm guessing no, but don't quote me on that.
I'm guessing that's the reason .eslintignore is a separate file as well.

For IntelliJ (if that's what you're using), you can pass CLI arguments.

image

But it'd definitely be preferable to have that in the config...

EDIT: I don't suppose eslint could test against /.jsx?$/. Doesn't really scale when the next cool js-extension pops up, though...

@ilyavolodin
Copy link
Member

You are correct. We can't configure this through .eslintrc because we only read configuration after we build up a list of files to lint. And I think there's an open issue somewhere to make jsx files be linted by default.

CurtisHumphrey added a commit to CurtisHumphrey/react-redux-starter-kit that referenced this issue Jan 27, 2016
flags needed to that jsx files are linted too.  see: eslint/eslint#801
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 7, 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 7, 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 cli Relates to ESLint's command-line interface enhancement This change enhances an existing feature of ESLint good first issue Good for people who haven't worked on ESLint before
Projects
None yet
Development

No branches or pull requests

5 participants