Skip to content

Feature Request: Support HTML/Vue Attribute Sorting #3382

Closed as duplicate
Closed as duplicate

Description

@cbkmutlu

Description

Summary
It would be great to have configurable HTML attribute sorting support in Oxfmt, similar to what prettier-plugin-organize-attributes provides for Prettier.

Currently, Oxfmt supports sorting imports and Tailwind CSS classes, but there is no equivalent functionality for organizing HTML, Vue, or JSX attributes.

Motivation
In Vue projects, attribute order is an important part of maintaining consistent and readable templates.

For example, I would like to define a custom ordering for Vue directives, bindings, attributes, and event listeners:

attributeGroups: [ "^v-if", "^v-else-if", "^v-else", "^v-for", "^v-model", "^:model-value", "^v-bind:is", "^v-", "$CODE_GUIDE", "^:", "$DEFAULT", "^tabindex", "^@" ], attributeSort: "ASC"

This allows developers to enforce a consistent order across Vue templates instead of relying on the order in which attributes were originally written.

Suggested solution

Proposed Configuration
Ideally, Oxfmt could provide something similar to:
{ sortAttributes: { groups: [ "^v-if", "^v-else-if", "^v-else", "^v-for", "^v-model", "^v-", "$CODE_GUIDE", "^:", "$DEFAULT", "^tabindex", "^@" ], order: "asc" } }

Expected Benefits

  • Configurable attribute groups using regular expressions.
  • Support for Vue directives (v-if, v-for, v-model, etc.).
  • Support for HTML attributes and event listeners.
  • Support for JSX/TSX attributes where applicable.
  • Custom ordering and alphabetical sorting within groups.
  • Preservation of existing formatting behavior and attribute values.
  • Compatibility with Tailwind CSS class sorting.

Alternative

No response

Additional context

This feature would be particularly valuable for developers migrating from Prettier to Oxfmt who currently depend on prettier-plugin-organize-attributes.

It would also make Oxfmt's sorting capabilities more comprehensive and reduce the need for external formatting tools.

Would this functionality be considered within the scope of Oxfmt?

Validations

  • Read the Contributing Guidelines.
  • Confirm this request is for Vite+ itself and not for Vite, Vitest, tsdown, Rolldown, or Oxc.
  • Check that there isn't already an issue requesting the same feature.

Activity

  1. added theissue type on Nov 8, 2026
  2. liangmiQwQ commented on Nov 8, 2026

    @liangmiQwQ
    Collaborator

    This is a feature about Oxfmt, could you please move to https://github.com/oxc-project/oxc repo to learn more?

    Also, there is already a related issue on this topic: oxc-project/oxc#28453

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

Metadata

Metadata

Assignees

No one assigned

    Fields

    Priority

    None yet

    Start date

    None yet

    Target date

    None yet

    Effort

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions