Skip to content

Commit cfa2176

Browse files
committed
refactor: moves options to types file
1 parent 0df348f commit cfa2176

File tree

2 files changed

+39
-39
lines changed

2 files changed

+39
-39
lines changed

rules/sort-objects.ts

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

33
import type { SortingNodeWithDependencies } from '../utils/sort-nodes-by-dependencies'
4+
import type { Options } from './sort-objects/types'
45

56
import {
67
buildUseConfigurationIfJsonSchema,
@@ -47,52 +48,13 @@ import { complete } from '../utils/complete'
4748
import { pairwise } from '../utils/pairwise'
4849
import { matches } from '../utils/matches'
4950

50-
type Options = Partial<{
51-
partitionByComment:
52-
| {
53-
block?: string[] | boolean | string
54-
line?: string[] | boolean | string
55-
}
56-
| string[]
57-
| boolean
58-
| string
59-
useConfigurationIf: {
60-
callingFunctionNamePattern?: string
61-
allNamesMatchPattern?: string
62-
}
63-
groups: (
64-
| { newlinesBetween: 'ignore' | 'always' | 'never' }
65-
| Group[]
66-
| Group
67-
)[]
68-
type: 'alphabetical' | 'line-length' | 'unsorted' | 'natural' | 'custom'
69-
destructuredObjects: { groups: boolean } | boolean
70-
customGroups: Record<string, string[] | string>
71-
newlinesBetween: 'ignore' | 'always' | 'never'
72-
specialCharacters: 'remove' | 'trim' | 'keep'
73-
locales: NonNullable<Intl.LocalesArgument>
74-
partitionByNewLine: boolean
75-
objectDeclarations: boolean
76-
styledComponents: boolean
77-
/**
78-
* @deprecated for {@link `destructuredObjects`} and {@link `objectDeclarations`}
79-
*/
80-
destructureOnly: boolean
81-
ignorePattern: string[]
82-
order: 'desc' | 'asc'
83-
ignoreCase: boolean
84-
alphabet: string
85-
}>[]
86-
8751
type MESSAGE_ID =
8852
| 'missedSpacingBetweenObjectMembers'
8953
| 'unexpectedObjectsDependencyOrder'
9054
| 'extraSpacingBetweenObjectMembers'
9155
| 'unexpectedObjectsGroupOrder'
9256
| 'unexpectedObjectsOrder'
9357

94-
type Group = 'multiline' | 'unknown' | 'method' | string
95-
9658
let defaultOptions: Required<Options[0]> = {
9759
partitionByNewLine: false,
9860
partitionByComment: false,

rules/sort-objects/types.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
useConfigurationIf: {
11+
callingFunctionNamePattern?: string
12+
allNamesMatchPattern?: string
13+
}
14+
groups: (
15+
| { newlinesBetween: 'ignore' | 'always' | 'never' }
16+
| Group[]
17+
| Group
18+
)[]
19+
type: 'alphabetical' | 'line-length' | 'unsorted' | 'natural' | 'custom'
20+
destructuredObjects: { groups: boolean } | boolean
21+
customGroups: Record<string, string[] | string>
22+
newlinesBetween: 'ignore' | 'always' | 'never'
23+
specialCharacters: 'remove' | 'trim' | 'keep'
24+
locales: NonNullable<Intl.LocalesArgument>
25+
partitionByNewLine: boolean
26+
objectDeclarations: boolean
27+
styledComponents: boolean
28+
/**
29+
* @deprecated for {@link `destructuredObjects`} and {@link `objectDeclarations`}
30+
*/
31+
destructureOnly: boolean
32+
ignorePattern: string[]
33+
order: 'desc' | 'asc'
34+
ignoreCase: boolean
35+
alphabet: string
36+
}>[]
37+
38+
type Group = 'multiline' | 'unknown' | 'method' | string

0 commit comments

Comments
 (0)