Skip to content

Support ESLint + Coffeescript #5581

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

helixbass
Copy link

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No (at least in theory I don't think it should have to, but may need clarification)

Other information:

Now that ESLint is legitimately supported for Coffeescript as of Coffeescript v2.5.0 (via eslint-plugin-coffee), people using Coffeescript + Vue should be able to successfully run ESLint against their Coffeescript files

But there have been a few issues encountered (see helixbass/eslint-plugin-coffee#27)

Specifically here, I needed to adjust the Vue CLI ESLint config to run against .coffee files

These changes (plus vuejs/vue-eslint-parser#62) got ESLint working with Coffeescript in an example Vue project: https://github.com/helixbass/vue-coffee-eslint-example

But I'm not sure if further refinement is needed here for this to be flexible enough eg for projects that include .coffee files but don't have ESLint configured for Coffeescript, or for "hybrid" projects that include both Coffeescript + JS?

if (api.hasPlugin('typescript')) {
extensions = extensions.concat('.ts', '.tsx')
}
if (api.hasPlugin('coffee')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you are trying to deal with a third-party Vue CLI plugin called vue-cli-plugin-coffee. Why not just modify the ESLint options in that plugin?

@@ -41,7 +41,7 @@ module.exports = (api, options) => {
.add(/node_modules/)
.add(path.dirname(require.resolve('@vue/cli-service')))
.end()
.test(/\.(vue|(j|t)sx?)$/)
.test(/\.(vue|(j|t)sx?|coffee)$/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also be the responsibility of the coffee plugin.
Can be achieved with this statement in chainWebpack:

config.module.rule('eslint').set('test', /\.(vue|(j|t)sx?|coffee)$/)

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

Successfully merging this pull request may close these issues.

2 participants