astro/sort-attributes

enforce sorting of attributes

  • πŸ”§ The --fix option on the command line can automatically fix some of the problems reported by this rule.

:book: Rule Details

Maintaining a consistent order of attributes in Astro elements is crucial for readability and maintainability. This rule ensures that attributes are sorted, making the structure of your elements more predictable and easier to manage.

Adopting this rule helps standardize code formatting across your project, facilitating better collaboration and reducing cognitive load for developers.

It’s safe. The rule considers spread elements in an attributes list and does not break component functionality.

Default:

:wrench: Options

{
  "astro/sort-attributes": [
    "error", 
    { "type": "alphabetical", "order": "asc", "ignoreCase": true }
  ]
}

:rocket: Version

This rule was introduced in eslint-plugin-astro v1.3.0

:mag: Implementation

πŸš€ Version

This rule was introduced in eslint-plugin-astro v1.3.0

πŸ” Implementation



Edit this page