Skip to content

Compatibility with linters's rules "no-new" and "no-undef" #1948

@arianrhodsandlot

Description

@arianrhodsandlot

I'm using ESlint for code linting. When my Vue code goes like this:

var demo = new Vue({
  el: '#demo',
  data: {
    message: 'Hello Vue.js!'
  }
})

The linter will say "demo is defined but unused" because of this.

But if I write:

new Vue({
  el: '#demo',
  data: {
    message: 'Hello Vue.js!'
  }
})

The linter will say "do not use 'new' for side-effects" because of this.

It's okay if I can add an config file for the linter to my project. But when it comes to using an unconfigable linter, like Standard, the error will always be shown.

Is there any way to avoid this, or a new method in further versions? Like:

Vue.create({
  el: '#demo',
  data: {
    message: 'Hello Vue.js!'
  }
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions