Skip to content

Issue in documentation for vue/block-order #2744

Closed
@sbrauch

Description

@sbrauch

In the documentation I found this example which didn't work. I made it work by removing the additional parentheses.
Did not work
{
"vue/block-order": ["error", {
"order": [ [ "script", "template" ], "style" ]
}]
}

Worked for me
"vue/block-order": ["error", { order: ["script", "template", "style"] }],

If I'm not the only one, I think it's just a small documentation error.

Activity

added
needs reproNeed a repository that can reproduce the problem, or a link to DEMO.
on May 14, 2025
waynzh

waynzh commented on May 18, 2025

@waynzh
Member

The docs seems to be fine. Please follow the bug report template and provide more detailed information.
The outer array defines the overall order, while the inner array indicates that the order among these elements is interchangeable.

sbrauch

sbrauch commented on May 21, 2025

@sbrauch
Author

Hey,
Thanks for your quick reply.
I've tried again with a college and another computer but it doesn't seem to work. I have a simple configuration where some files in my project have the order template, script, style and some script, template, style.
I want all of them to change to and always be script, template, style.

When I implement it without the inner array it works. This works meaning the import order becomes the one that I have defined:
Image

This doesn't work, meaning when I save the import order does not change.

Image
FloEdelmann

FloEdelmann commented on May 21, 2025

@FloEdelmann
Member

The inner array means "the order of these is irrelevant", i.e. [["script", "template"], "style"] means both ["script", "template", "style"] and ["template", "script", "style"] are valid. This is exactly what you noticed. If you want to force a specific order, please specify it without an inner array.

I'll close this issue because the rule is working as intended and the docs are correct. If you think the docs can be improved, feel free to comment or open a PR 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs infoneeds reproNeed a repository that can reproduce the problem, or a link to DEMO.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @FloEdelmann@ota-meshi@waynzh@sbrauch

      Issue actions

        Issue in documentation for vue/block-order · Issue #2744 · vuejs/eslint-plugin-vue