Skip to content

Commit a2b8d79

Browse files
committed
refactor(sort-maps): extracts types
1 parent a6e1daf commit a2b8d79

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

rules/sort-maps.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { TSESTree } from '@typescript-eslint/types'
22

33
import type { SortingNode } from '../types/sorting-node'
4+
import type { Options } from './sort-maps/types'
45

56
import {
67
partitionByCommentJsonSchema,
@@ -30,26 +31,6 @@ import { sortNodes } from '../utils/sort-nodes'
3031
import { complete } from '../utils/complete'
3132
import { pairwise } from '../utils/pairwise'
3233

33-
type Options = [
34-
Partial<{
35-
partitionByComment:
36-
| {
37-
block?: string[] | boolean | string
38-
line?: string[] | boolean | string
39-
}
40-
| string[]
41-
| boolean
42-
| string
43-
type: 'alphabetical' | 'line-length' | 'natural' | 'custom'
44-
specialCharacters: 'remove' | 'trim' | 'keep'
45-
locales: NonNullable<Intl.LocalesArgument>
46-
partitionByNewLine: boolean
47-
order: 'desc' | 'asc'
48-
ignoreCase: boolean
49-
alphabet: string
50-
}>,
51-
]
52-
5334
type MESSAGE_ID = 'unexpectedMapElementsOrder'
5435

5536
let defaultOptions: Required<Options[0]> = {

rules/sort-maps/types.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export type Options = Partial<{
2+
partitionByComment:
3+
| {
4+
block?: string[] | boolean | string
5+
line?: string[] | boolean | string
6+
}
7+
| string[]
8+
| boolean
9+
| string
10+
type: 'alphabetical' | 'line-length' | 'natural' | 'custom'
11+
specialCharacters: 'remove' | 'trim' | 'keep'
12+
locales: NonNullable<Intl.LocalesArgument>
13+
partitionByNewLine: boolean
14+
order: 'desc' | 'asc'
15+
ignoreCase: boolean
16+
alphabet: string
17+
}>[]

0 commit comments

Comments
 (0)