Skip to content

vue/sort-keys runOutsideVue option #1865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lukethompson opened this issue Apr 23, 2022 · 0 comments
Closed

vue/sort-keys runOutsideVue option #1865

lukethompson opened this issue Apr 23, 2022 · 0 comments

Comments

@lukethompson
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant