Eslint-plugin-vue: Using standard with eslint-plugin-vue

Created on 4 Apr 2018  路  7Comments  路  Source: vuejs/eslint-plugin-vue

Hi folks, I'd like to suggest a snippet added to the docs describing how to use eslint-plugin-vue with standard, under the assumption that it's a rather common linter, but specifically because its users don't typically use it via eslint, but as its own binary.

I currently have it running as a separate npm script: one runs standard --plugin html '**/*.{js,vue}', and the other runs eslint 'src/**/*.vue' (with an .eslintrc that has the vue plugin in it) and that works fine, but there's probably a way to consolidate. I haven't done it, but figured someone here had, and waited to raise the suggestion of including it in the docs if others feel it's warranted.

question

Most helpful comment

Sorry @timwis I'm a bit confused. vue-cli 3 is a CLI, and I was more looking for a linter in VScode as a plugin perhaps. Or am I confusing things?

All 7 comments

Hey @timwis. Thanks for this proposal. I personally however didn't try consolidating it yet. I only used standard as eslint preset and it worked well with this plugin. I'm not sure there's a better way of making both working closely together. If you however manage to come up with something don't hesitate to submit PR, we can discuss it :)

I think vue-cli 3 takes care of this

I have a similar problem where I want my vue files to receive linting from standard and vue/essential.
If I write my .eslintrc.js file like so, standard is somehow disabled:

  extends: ['standard', 'plugin:vue/essential'],
  // required to lint *.vue files
  plugins: [
    'vue'
  ],

but if I remove the 'plugin:vue/essential' standard is linted in vue files properly.

Any advice for me?

@mesqueeb check out how vue-cli 3 does it. there's a package in there called vue-standard

Sorry @timwis I'm a bit confused. vue-cli 3 is a CLI, and I was more looking for a linter in VScode as a plugin perhaps. Or am I confusing things?

@timwis Sorry,I did not find the package,can you paste the link please?

@fancyboynet I guess it is related to Adonuxt template and/or AdonisJS starter .eslistrc.js configuration (I recognized it by // required to lint *.vue files comment).
Adonuxt starter has error in configuration that seems pretty innocent:

  parser: 'babel-eslint',

but it should be replaced with

  parserOptions: {
    parser: 'babel-eslint'
  },

as noted here.

They also put html plugin as one that should lint vue files, but IMHO it's weird: Vue SFCs are special, directives and scripts should be linted through eslint-plugin-vue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

apertureless picture apertureless  路  4Comments

Hyzual picture Hyzual  路  3Comments

maple-leaf picture maple-leaf  路  3Comments

lichnow picture lichnow  路  3Comments

rodneyrehm picture rodneyrehm  路  4Comments