There is many fields in vue instance/component where we can specify properties visible inside component, data, props, computed, methods.
Invalid Code:
export default {
props: ['foo'],
props: {
foo: String
},
computed: {
foo () {
}
},
data() {
return {
foo: null
}
},
data: {
foo: null
},
methods: {
foo () {
}
}
}
Also there is few reserved names witch should not be overridden by vue instance:
$data, $props, $el, $options, $parent, $root, $children, $slots, $scopedSlots, $refs, $isServer, $attrs, $listeners$watch, $set, $delete, $on, $once, $off, $emit, $mount, $forceUpdate, $nextTick, $destroy .....also user should be able to specify his own reserved names to remove conflicts with used plugins.
Thank you for the proposal!
Sounds reasonable to me.
no-dupe-keys core rule cannot catch duplication of Vue's definition. We should catch it.
Also, the names which start with _ in data are reserved by Vue.js.
@mysticatea i think we should rename this rule to same as core no-dupe-keys instead of no-duplicate-field-names
Also, the names which start with _ in data are reserved by Vue.js.
馃憤 i didn't know that but i will add this.
I like this proposition a lot, but.. I think this rule should be splitted into two rules.
no-dupe-keysno-reservered-keysSo that each rule does only one thing. What do you think @mysticatea @armano2 ?
eslint recommends to make functions to small chunks and split them to separate rules.
One rule should do one think
@michalsnik i like it 馃憤
Most helpful comment
I like this proposition a lot, but.. I think this rule should be splitted into two rules.
no-dupe-keysno-reservered-keysSo that each rule does only one thing. What do you think @mysticatea @armano2 ?