1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
# enforce ordering of meta properties in rule source (meta-property-ordering)
(fixable) The `--fix` option on the [command line](../user-guide/command-line-interface#fix) automatically fixes problems reported by this rule.
This rule enforces that meta properties of a rule are placed in a consistent order.
## Rule Details
### Options
This rule has an array option:
* `['type', 'docs', 'fixable', 'schema', 'messages', 'deprecated', 'replacedBy']` (default): The order that the properties of `meta` should be placed in.
Examples of **incorrect** code for this rule:
```js
/* eslint eslint-plugin/meta-property-ordering: ["error",
["type", "docs", "fixable", "schema", "messages"]
] */
// invalid; wrong order.
module.exports = {
meta: {
docs: "",
type: "problem",
fixable: "code",
},
create() {},
}
// invalid; extra properties must be placed afterwards.
module.exports = {
meta: {
type: "problem",
fooooooooo: "foo",
docs: "",
fixable: "code",
},
create() {},
}
```
Examples of **correct** code for this rule:
```js
/* eslint eslint-plugin/meta-property-ordering: ["error",
["type", "docs", "fixable", "schema", "messages"]
] */
// valid;
module.exports = {
meta: {
type: "bar",
docs: "foo",
messages: ["zoo"],
fooooooooo: "foo",
},
create() {},
}
```
## When Not To Use It
If don't want to enforce ordering of meta properties, you can turn off this rule.
|