webpack icon indicating copy to clipboard operation
webpack copied to clipboard

Linting external JavaScript files

Open smares opened this issue 6 years ago • 1 comments

I have a quick question: Noticing that my external JavaScript files are not processed by ESLint, I stumbled upon https://github.com/vuejs-templates/webpack/issues/716 that is now closed, but has the valuable last comment to add preLoaders: { js: 'eslint-loader' } to vue-loader.conf.js which fixed my problem. A quick look at the file on GitHub shows that the current vue-loader.conf.js is still missing that line. I am using a slightly older version of the template in my project, so I am now wondering why preLoaders: { js: 'eslint-loader' } still did not make it into the current template - is it not needed anymore because of other loaders being used?

smares avatar Feb 22 '18 18:02 smares

You need to explicitly set a tip for ESlint Vue Plugin that the exported object is a component declaration

componenst-javascript.js

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

But this will not bound the template with JavaScript when you

<script src="./componenst-javascript.js" />

So you will still have such errors like

The "Footer" component has been used but not registered (vue/no-unregistered-components)

Which is an issue

constgen avatar Dec 12 '20 15:12 constgen