Description
What rule do you want to change?
vue/sort-keys
add option to give the ability to only run inside of Vue. My team likes to alphabetize our props
, computed
, methods
etc... but we do not want to enforce all object keys being sorted.
vue/sort-keys
does already have a runOutsideVue
option but it is not used in the rule.
Does this change cause the rule to produce more or fewer warnings?
Fewer if the option is set.
How will the change be implemented? (New option, new default behavior, etc.)?
vue/sort-keys
already has options.runOutsideVue
, the default value is true
passing false
doesn't do anything. The change will use the value passed by this option to allow users to ignore sorting outside of vue.
Please provide some example code that this change will affect:
// runOutsideVue: false
export default {
methods: {
// Will sort keys inside of `methods`, `props`, `computed` etc...
createArticle () {
return this.createEntity({
// Will ignore keys not on a Vue instance
id: 1,
type: 'article',
attributes: { createdAt: new Date() }
})
},
deleteArticle (id) {}
},
}
What does the rule currently do for this code?
options.runOutsideVue
exists but is not used. Currently all object keys are sorted by this rule.
What will the rule do after it's changed?
Use the options.runOutsideVue
option, currently is defaulted to true
so this change will have no impact on existing uses.
Additional context
This change will somewhat address the issue here #630
I have already implemented this change and will link the PR below.