@@ -72,35 +72,37 @@ interface BaseOptions {
7272
7373let pluginName = 'perfectionist'
7474
75+ export let rules = {
76+ 'sort-variable-declarations' : sortVariableDeclarations ,
77+ 'sort-intersection-types' : sortIntersectionTypes ,
78+ 'sort-import-attributes' : sortImportAttributes ,
79+ 'sort-export-attributes' : sortExportAttributes ,
80+ 'sort-heritage-clauses' : sortHeritageClauses ,
81+ 'sort-array-includes' : sortArrayIncludes ,
82+ 'sort-named-imports' : sortNamedImports ,
83+ 'sort-named-exports' : sortNamedExports ,
84+ 'sort-object-types' : sortObjectTypes ,
85+ 'sort-union-types' : sortUnionTypes ,
86+ 'sort-switch-case' : sortSwitchCase ,
87+ 'sort-decorators' : sortDecorators ,
88+ 'sort-interfaces' : sortInterfaces ,
89+ 'sort-jsx-props' : sortJsxProps ,
90+ 'sort-modules' : sortModules ,
91+ 'sort-classes' : sortClasses ,
92+ 'sort-imports' : sortImports ,
93+ 'sort-exports' : sortExports ,
94+ 'sort-objects' : sortObjects ,
95+ 'sort-enums' : sortEnums ,
96+ 'sort-sets' : sortSets ,
97+ 'sort-maps' : sortMaps ,
98+ }
99+
75100let plugin = {
76- rules : {
77- 'sort-variable-declarations' : sortVariableDeclarations ,
78- 'sort-intersection-types' : sortIntersectionTypes ,
79- 'sort-import-attributes' : sortImportAttributes ,
80- 'sort-export-attributes' : sortExportAttributes ,
81- 'sort-heritage-clauses' : sortHeritageClauses ,
82- 'sort-array-includes' : sortArrayIncludes ,
83- 'sort-named-imports' : sortNamedImports ,
84- 'sort-named-exports' : sortNamedExports ,
85- 'sort-object-types' : sortObjectTypes ,
86- 'sort-union-types' : sortUnionTypes ,
87- 'sort-switch-case' : sortSwitchCase ,
88- 'sort-decorators' : sortDecorators ,
89- 'sort-interfaces' : sortInterfaces ,
90- 'sort-jsx-props' : sortJsxProps ,
91- 'sort-modules' : sortModules ,
92- 'sort-classes' : sortClasses ,
93- 'sort-imports' : sortImports ,
94- 'sort-exports' : sortExports ,
95- 'sort-objects' : sortObjects ,
96- 'sort-enums' : sortEnums ,
97- 'sort-sets' : sortSets ,
98- 'sort-maps' : sortMaps ,
99- } ,
100101 meta : {
101102 version : packageVersion ,
102103 name : packageName ,
103104 } ,
105+ rules,
104106} as unknown as ESLint . Plugin
105107
106108function getRules ( options : BaseOptions ) : Linter . RulesRecord {
@@ -128,40 +130,42 @@ function createLegacyConfig(options: BaseOptions): Linter.LegacyConfig {
128130 }
129131}
130132
133+ export let configs = {
134+ 'recommended-alphabetical-legacy' : createLegacyConfig ( {
135+ type : 'alphabetical' ,
136+ order : 'asc' ,
137+ } ) ,
138+ 'recommended-line-length-legacy' : createLegacyConfig ( {
139+ type : 'line-length' ,
140+ order : 'desc' ,
141+ } ) ,
142+ 'recommended-natural-legacy' : createLegacyConfig ( {
143+ type : 'natural' ,
144+ order : 'asc' ,
145+ } ) ,
146+ 'recommended-custom-legacy' : createLegacyConfig ( {
147+ type : 'custom' ,
148+ order : 'asc' ,
149+ } ) ,
150+ 'recommended-alphabetical' : createConfig ( {
151+ type : 'alphabetical' ,
152+ order : 'asc' ,
153+ } ) ,
154+ 'recommended-line-length' : createConfig ( {
155+ type : 'line-length' ,
156+ order : 'desc' ,
157+ } ) ,
158+ 'recommended-natural' : createConfig ( {
159+ type : 'natural' ,
160+ order : 'asc' ,
161+ } ) ,
162+ 'recommended-custom' : createConfig ( {
163+ type : 'custom' ,
164+ order : 'asc' ,
165+ } ) ,
166+ }
167+
131168export default {
132169 ...plugin ,
133- configs : {
134- 'recommended-alphabetical-legacy' : createLegacyConfig ( {
135- type : 'alphabetical' ,
136- order : 'asc' ,
137- } ) ,
138- 'recommended-line-length-legacy' : createLegacyConfig ( {
139- type : 'line-length' ,
140- order : 'desc' ,
141- } ) ,
142- 'recommended-natural-legacy' : createLegacyConfig ( {
143- type : 'natural' ,
144- order : 'asc' ,
145- } ) ,
146- 'recommended-custom-legacy' : createLegacyConfig ( {
147- type : 'custom' ,
148- order : 'asc' ,
149- } ) ,
150- 'recommended-alphabetical' : createConfig ( {
151- type : 'alphabetical' ,
152- order : 'asc' ,
153- } ) ,
154- 'recommended-line-length' : createConfig ( {
155- type : 'line-length' ,
156- order : 'desc' ,
157- } ) ,
158- 'recommended-natural' : createConfig ( {
159- type : 'natural' ,
160- order : 'asc' ,
161- } ) ,
162- 'recommended-custom' : createConfig ( {
163- type : 'custom' ,
164- order : 'asc' ,
165- } ) ,
166- } ,
170+ configs,
167171} as PluginConfig
0 commit comments