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

In-file sourceType configuration #8148

Closed
silverwind opened this issue Feb 24, 2017 · 3 comments
Closed

In-file sourceType configuration #8148

silverwind opened this issue Feb 24, 2017 · 3 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion

Comments

@silverwind
Copy link
Contributor

silverwind commented Feb 24, 2017

Currently, the sourceType parser option can only be set in the configuration file for all files in a directory. If one has a mix of both script and module files in the same directory, there's currently no way discern which file is which type.

The prime example of this issue should be ava which expects its tests to be written in module syntax, while other files can be plain scripts.

I think a new inline configuration option could elegantly solve the issue:

// eslint-source-type module
@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Feb 24, 2017
@not-an-aardvark
Copy link
Member

I'm not sure this is feasible because source type is a parser option, which needs to be known before the file starts getting parsed and the comments are available.

@platinumazure platinumazure added core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Feb 24, 2017
@platinumazure
Copy link
Member

I agree with @not-an-aardvark that this might not be feasible.

Glob-based configuration could potentially solve this, if the tests can be easily denoted via glob expressions. See #3611 for more information.

@silverwind
Copy link
Contributor Author

Right, this seems something better solved by globs, which could be applied on all parser options, not just sourceType. I'll watch #3611 and workaround through a test directory in the meanwhile. Thanks!

@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
archived due to age This issue has been archived; please open a new issue for any further discussion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion
Projects
None yet
Development

No branches or pull requests

4 participants