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!'
}
})
That is not Vue's concern if you are using an unconfigurable linter. You can just create that method yourself:
Vue.create = function (options) {
return new Vue(options)
}
You can always avoid warning by exporting the variable.
Most helpful comment
That is not Vue's concern if you are using an unconfigurable linter. You can just create that method yourself: