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:
---
---
{/* β GOOD */}
<Element a="a" b="b" c="c" />
{/* β BAD */}
<Element c="c" b="b" a="a" />
: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
Back
β astro/prefer-split-class-list Next Page
astro/jsx-a11y/alt-text β
β astro/prefer-split-class-list Next Page
astro/jsx-a11y/alt-text β