Skip to content

propertyOrder

Enforces that package properties are declared in a consistent order.

✅ This rule is included in the package-json sorting presets.

A conventional order exists for package.json top-level properties. npm does not enforce this order, but for consistency and readability, this rule can enforce it. We use the order specified in sort-package-json as the default sort order. Any properties not defined by this ordering are placed after the standard fields and sorted lexicographically.

{
"version": "1.0.0",
"name": "my-package"
}

Type: string[]

Custom order for package properties. This option replaces the default order, and allows you to specify any custom properties you may have in your packages. All properties not in this collection will be sorted according to the sort-package-json specification.

any
packageJson
.
any
rules
({
propertyOrder: {
customOrder: string[];
}
propertyOrder
: {
customOrder: string[]
customOrder
: ["name", "version", "description"],
},
});
  • sortCollections - (Not yet implemented) Enforces that collection fields (e.g. dependencies, files) are sorted.
Made with ❤️‍🔥 around the world by the Flint team and contributors.