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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/@vue/cli-plugin-eslint/eslintOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ function makeJSOnlyValue (str) {
}

const baseExtensions = ['.js', '.jsx', '.vue']
exports.extensions = api => api.hasPlugin('typescript')
? baseExtensions.concat('.ts', '.tsx')
: baseExtensions
exports.extensions = api => {
let extensions = baseExtensions
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?

extensions = extensions.concat('.coffee')
}
return extensions
}
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-eslint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)$/)

.use('eslint-loader')
.loader(require.resolve('eslint-loader'))
.options({
Expand Down