Skip to content

Commit d81a5c8

Browse files
committed
fix(ordering): changed default groups to not contain unknown
1 parent 4827e72 commit d81a5c8

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

Diff for: docs/rules/order.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ How groups are defined, and the order to respect. `groups` must be an array of `
8686
// Then the rest: internal and external type
8787
]
8888
```
89-
The default value is `["builtin", "external", "unknown", "parent", "sibling", "index"]`.
89+
The default value is `["builtin", "external", "parent", "sibling", "index"]`.
9090

9191
You can set the options like this:
9292

Diff for: src/rules/order.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import importType from '../core/importType'
44
import isStaticRequire from '../core/staticRequire'
55
import docsUrl from '../docsUrl'
66

7-
const defaultGroups = ['builtin', 'external', 'unknown', 'parent', 'sibling', 'index']
7+
const defaultGroups = ['builtin', 'external', 'parent', 'sibling', 'index']
88

99
// REPORTING AND FIXING
1010

Diff for: tests/src/rules/order.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,19 @@ ruleTester.run('order', rule, {
164164
var index = require('./');
165165
`,
166166
}),
167-
// Using unknown import types (e.g. using an resolver alias via babel)
167+
// Addijg unknown import types (e.g. using an resolver alias via babel) to the groups.
168168
test({
169169
code: `
170170
import fs from 'fs';
171171
import { Input } from '-/components/Input';
172172
import { Button } from '-/components/Button';
173173
import { add } from './helper';`,
174+
options: [{
175+
groups: ['builtin', 'external', 'unknown', 'parent', 'sibling', 'index'],
176+
}],
174177
}),
175178
// Using unknown import types (e.g. using an resolver alias via babel) with
176-
// a custom group list.
179+
// an alternative custom group list.
177180
test({
178181
code: `
179182
import { Input } from '-/components/Input';
@@ -197,6 +200,7 @@ ruleTester.run('order', rule, {
197200
options: [
198201
{
199202
'newlines-between': 'always',
203+
groups: ['builtin', 'external', 'unknown', 'parent', 'sibling', 'index'],
200204
},
201205
],
202206
}),
@@ -933,6 +937,11 @@ ruleTester.run('order', rule, {
933937
import { Button } from '-/components/Button';
934938
import { add } from './helper';
935939
`,
940+
options: [
941+
{
942+
groups: ['builtin', 'external', 'unknown', 'parent', 'sibling', 'index'],
943+
},
944+
],
936945
errors: [
937946
{
938947
line: 4,
@@ -958,6 +967,7 @@ ruleTester.run('order', rule, {
958967
`,
959968
options: [
960969
{
970+
groups: ['builtin', 'external', 'unknown', 'parent', 'sibling', 'index'],
961971
'newlines-between': 'always',
962972
},
963973
],

0 commit comments

Comments
 (0)