Skip to content

Commit 41aa993

Browse files
committed
refactor: add defaultOptions
1 parent c5b3d13 commit 41aa993

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/rules/sort-imports/sort-imports.rule.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ import {
1010
} from './sort-imports.utils';
1111
import { Type } from './type.enum';
1212

13+
const defaultOptions = {
14+
special: ['react'],
15+
order: [Type.special, Type.namespace, Type.default, Type.defaultObj, Type.obj, Type.none],
16+
};
17+
1318
export const sortImportsRule: Rule.RuleModule = {
1419
meta: {
1520
type: 'layout',
@@ -40,15 +45,11 @@ export const sortImportsRule: Rule.RuleModule = {
4045
additionalProperties: false,
4146
},
4247
],
43-
defaultOptions: [
44-
{
45-
special: ['react'],
46-
order: [Type.special, Type.namespace, Type.default, Type.defaultObj, Type.obj, Type.none],
47-
},
48-
],
48+
defaultOptions: [defaultOptions],
4949
},
5050
create: (context) => {
51-
const { special: stringSpecial = [], order = [] } = context.options[0] as Options;
51+
const { special: stringSpecial = defaultOptions.special, order = defaultOptions.order } =
52+
(context.options[0] as Options) ?? {};
5253

5354
const special = parseStringSpecial(stringSpecial);
5455

0 commit comments

Comments
 (0)