Skip to content

Commit 6461e0c

Browse files
committed
Add hasSuggestions property to meta-property-ordering rule
It makes most sense to order the new ESLint 8 property `meta.hasSuggestions` after the related property `meta.fixable`. https://eslint.org/blog/2021/06/whats-coming-in-eslint-8.0.0#rules-with-suggestions-now-require-the-metahassuggestions-property
1 parent b6ce109 commit 6461e0c

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

docs/rules/meta-property-ordering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This rule enforces that meta properties of a rule are placed in a consistent ord
1010

1111
This rule has an array option:
1212

13-
* `['type', 'docs', 'fixable', 'schema', 'messages', 'deprecated', 'replacedBy']` (default): The order that the properties of `meta` should be placed in.
13+
* `['type', 'docs', 'fixable', 'hasSuggestions', 'schema', 'messages', 'deprecated', 'replacedBy']` (default): The order that the properties of `meta` should be placed in.
1414

1515
Examples of **incorrect** code for this rule:
1616

lib/rules/meta-property-ordering.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = {
3030
const info = getRuleInfo(sourceCode);
3131

3232
const message = 'The meta properties should be placed in a consistent order: [{{order}}].';
33-
const order = context.options[0] || ['type', 'docs', 'fixable', 'schema', 'messages'];
33+
const order = context.options[0] || ['type', 'docs', 'fixable', 'hasSuggestions', 'schema', 'messages'];
3434

3535
const orderMap = new Map(order.map((name, i) => [name, i]));
3636

tests/lib/rules/meta-property-ordering.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ ruleTester.run('test-case-property-ordering', rule, {
4646

4747
`
4848
module.exports = {
49-
meta: {
49+
meta: {
5050
type: 'problem',
5151
docs: {},
5252
fixable: 'code',
53+
hasSuggestions: true,
5354
schema: [],
5455
messages: {}
5556
},

0 commit comments

Comments
 (0)