Skip to content

natural order

Moritz Jacobs edited this page Sep 18, 2020 · 2 revisions

natural-order

This rule is fixable ✓
This rule is optional!

Why?/How?/Examples

Scripts can be sorted in what we consider a "natural order", so pre*/post* hooks are grouped with their callers – the rest is alphabetical:

{
	"prebuild": "foo",
	"build": "foo",
	"build:cleanup": "bar",
	"postbuild": "foo",
	"publish": "ok",
	"prepublishOnly": "else",
	"pretest": "baz",
	"test": "jest",
	"test:lint": "baz",
	"posttest": "baz",
	"update": "foo",
	"update:dependencies": "updtr",
	"update:typings": "something"
}

Important 🚨

For this optional rule to work, you must turn it on and disable alphabetic-order in your config:

{
	"strict": true,
	"rules": {
		"alphabetic-order": false,
		"natural-order": true
	}
}


scriptlint status
npm version badge
dependency badge
Issue badge
CI badge

Clone this wiki locally