complete/sort-objects
💼 This rule is enabled in the ✅ recommended config.
📝 Requires object properties to match the declared type order or alphabetical order.
🔧 This rule is automatically fixable by the
--fix CLI option.
💭 This rule requires type information.
Requires object literal properties to match the declared type order. If there is no declared property order, object literal properties must be in alphabetical order.
For single interface inheritance chains, derived properties come first, followed
by inherited properties, with source order preserved within each declaration.
Overrides keep their derived position. Mapped types such as Partial and Omit
preserve this order when their properties retain the original declarations.
Properties from unrelated bases, intersections, or merged declarations still
fall back to alphabetical order when they span multiple declaration containers.
This rule has an auto-fixer, but it will refuse to auto-fix if there are attached block comments, as those usually semantic meaning relating to the line and the auto-fixer is not smart enough to move them.
Rule Details
Section titled “Rule Details”interface Foo { name: string; description: string;}
// Badconst foo: Foo = { description: "A foo.", name: "foo",};
// Goodconst foo: Foo = { name: "foo", description: "A foo.",};Options
Section titled “Options”This rule is not configurable.
