Skip to content

Idea to allow eslint to skip over and allow <script lang="coffee"> in *.vue files #446

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

Closed
wants to merge 1 commit into from

Conversation

shreeve
Copy link

@shreeve shreeve commented Mar 29, 2018

I'd like to use eslint in my *.vue files, but it bombs out with coffeescript, when using <script lang="coffee">.

Instead of disabling eslint for all *.vue files, this change skips over the coffeescript.

This is probably a terrible approach, but perhaps there's a way that the preprocess function could be overridden by user config?

@shreeve
Copy link
Author

shreeve commented Mar 29, 2018

How does typescript get around this same issue? Does eslint already know how to lint typescript?

@michalsnik
Copy link
Member

Hello @shreeve I'm not sure what would be the best solution for this issue, hence I requested review from @mysticatea that actually crated the whole parser for vue.
In terms of typescript though, I guess you can use typescript-eslint-parser to make eslint know what's going on there. Unfortunately there's no coffee parser.

@shreeve
Copy link
Author

shreeve commented Apr 13, 2018

@michalsnik - Cool, thanks. @mysticatea - Any suggestions on how to support coffeescript in *.vue files?

mysticatea added a commit to vuejs/vue-eslint-parser that referenced this pull request Jul 21, 2018
@mysticatea
Copy link
Member

Hi. I apologize for the delay. I was inactive for several months.

I understand that it's inconvenient for CoffeeScript users.

ESLint checks AST which is defined by this page. We can use custom parsers, so we can check the source code of various kinds with ESLint.

This plugin uses vue-eslint-parser to parse .vue files. The vue-eslint-parser parses the files as HTML then parses <script> tags with the configured parser. People can configure the script parser with parserOptions.parser property of the .eslintrc file. If it's omtited, vue-eslint-parser uses espree, the default parser of ESLint, to parse <script> tags.

TypeScript users can use typescript-eslint-parser to parse <script> tags.
But I don't know if there is the custom parser for CoffeeScript.
If you want to support CoffeeScript, probably you have to make a custom parser. Documentation is here: https://eslint.org/docs/developer-guide/working-with-custom-parsers

I added the functionality to skip parsing <script> tags completely into vue-eslint-parser: vuejs/vue-eslint-parser@9b947b1
It will allow us to check only templates.

@mysticatea mysticatea closed this Jul 21, 2018
@armano2
Copy link
Contributor

armano2 commented Oct 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants