Skip to content

Issue in documentation for vue/block-order #2744

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
sbrauch opened this issue May 14, 2025 · 3 comments
Closed

Issue in documentation for vue/block-order #2744

sbrauch opened this issue May 14, 2025 · 3 comments
Labels
needs info needs repro Need a repository that can reproduce the problem, or a link to DEMO.

Comments

@sbrauch
Copy link

sbrauch commented May 14, 2025

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.

@ota-meshi ota-meshi added needs info needs repro Need a repository that can reproduce the problem, or a link to DEMO. labels May 14, 2025
@waynzh
Copy link
Member

waynzh commented May 18, 2025

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
Copy link
Author

sbrauch commented May 21, 2025

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
Copy link
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
Labels
needs info needs repro Need a repository that can reproduce the problem, or a link to DEMO.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants