Skip to content

ESLint validation not working if VUE component script is located in separate file #1602

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
erik-sytnyk opened this issue Jun 17, 2018 · 6 comments

Comments

@erik-sytnyk
Copy link

Version

3.0.0-rc.2

Reproduction link

https://codesandbox.io/s/ly7ywz0409

Steps to reproduce

Move script part of vue component into separate JS file (HelloWorld.vue.js)

Reference in main component (HelloWorld.vue: <script src="./HelloWorld.vue.js'></script>)

Add code which violete ESLint rules

What is expected?

To see warning/error report in a console (via vue-cli)

What is actually happening?

Nothing is reported (code is not checked)

@Akryum
Copy link
Member

Akryum commented Jun 17, 2018

@Akryum Akryum closed this as completed Jun 17, 2018
@erik-sytnyk
Copy link
Author

erik-sytnyk commented Jun 18, 2018

@Akryum thanks for pointing out, but putting '// @vue/component' did not change anything

it may be convenient to put JS source file for components in separate files as support for autocomplete and other features in VUE components is not great for all IDEs

and logically it seems that

<template>
  ...code
</template>

and

<template src="./code.js"></template>

should be treated the same way (without adding extra comments)

@Akryum
Copy link
Member

Akryum commented Jun 18, 2018

You need to put // @vue/component just before the component definition:

// @vue/component
export default {
  props: { ... }
}

@erik-sytnyk
Copy link
Author

@Akryum it is not working

here is repo https://bitbucket.org/yegor_sytnyk/vue_cli_eslint_bug/src/master/
(https://[email protected]/yegor_sytnyk/vue_cli_eslint_bug.git)

the same ESLint warning is reported inside vue component but ignored if the code is referenced via src path

@Akryum Akryum reopened this Jun 20, 2018
@Akryum Akryum added bug scope: eslint needs team repro We acknowledged your report and will soon try to reproduce it labels Jun 28, 2018
@Akryum Akryum removed the needs team repro We acknowledged your report and will soon try to reproduce it label Jul 8, 2018
@Akryum
Copy link
Member

Akryum commented Jul 8, 2018

After reproducing this, I think it's an issue with vue-loader 15 (and preLoaders deprecation). Please open an issue there as well.

@yyx990803
Copy link
Member

Fixed in vue-loader 15.2.5.

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

No branches or pull requests

3 participants