1
+ import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'
1
2
import type { RuleContext } from '@typescript-eslint/utils/ts-eslint'
2
3
import type { TSESTree } from '@typescript-eslint/types'
3
4
@@ -98,30 +99,29 @@ let defaultOptions: Required<Options[0]> = {
98
99
groups : [ ] ,
99
100
}
100
101
102
+ export let jsonSchema : JSONSchema4 = {
103
+ properties : {
104
+ partitionByComment : {
105
+ ...partitionByCommentJsonSchema ,
106
+ description :
107
+ 'Allows you to use comments to separate the union types into logical groups.' ,
108
+ } ,
109
+ partitionByNewLine : partitionByNewLineJsonSchema ,
110
+ specialCharacters : specialCharactersJsonSchema ,
111
+ newlinesBetween : newlinesBetweenJsonSchema ,
112
+ ignoreCase : ignoreCaseJsonSchema ,
113
+ alphabet : alphabetJsonSchema ,
114
+ type : buildTypeJsonSchema ( ) ,
115
+ locales : localesJsonSchema ,
116
+ groups : groupsJsonSchema ,
117
+ order : orderJsonSchema ,
118
+ } ,
119
+ additionalProperties : false ,
120
+ type : 'object' ,
121
+ }
122
+
101
123
export default createEslintRule < Options , MESSAGE_ID > ( {
102
124
meta : {
103
- schema : [
104
- {
105
- properties : {
106
- partitionByComment : {
107
- ...partitionByCommentJsonSchema ,
108
- description :
109
- 'Allows you to use comments to separate the union types into logical groups.' ,
110
- } ,
111
- partitionByNewLine : partitionByNewLineJsonSchema ,
112
- specialCharacters : specialCharactersJsonSchema ,
113
- newlinesBetween : newlinesBetweenJsonSchema ,
114
- ignoreCase : ignoreCaseJsonSchema ,
115
- alphabet : alphabetJsonSchema ,
116
- type : buildTypeJsonSchema ( ) ,
117
- locales : localesJsonSchema ,
118
- groups : groupsJsonSchema ,
119
- order : orderJsonSchema ,
120
- } ,
121
- additionalProperties : false ,
122
- type : 'object' ,
123
- } ,
124
- ] ,
125
125
messages : {
126
126
unexpectedUnionTypesGroupOrder :
127
127
'Expected "{{right}}" ({{rightGroup}}) to come before "{{left}}" ({{leftGroup}}).' ,
@@ -137,6 +137,7 @@ export default createEslintRule<Options, MESSAGE_ID>({
137
137
description : 'Enforce sorted union types.' ,
138
138
recommended : true ,
139
139
} ,
140
+ schema : [ jsonSchema ] ,
140
141
type : 'suggestion' ,
141
142
fixable : 'code' ,
142
143
} ,
0 commit comments