File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,8 @@ The default configuration is:
90
90
* ` everything-else ` is a special group that match all the methods that do not match any of the other groups.
91
91
* ` render ` is referring to the ` render ` method.
92
92
* ` type-annotations ` . This group is not specified by default, but can be used to enforce flow annotations to be at the top.
93
+ * ` getters ` This group is not specified by default, but can be used to enforce class getters positioning.
94
+ * ` setters ` This group is not specified by default, but can be used to enforce class setters positioning.
93
95
94
96
You can override this configuration to match your needs.
95
97
Original file line number Diff line number Diff line change @@ -136,6 +136,24 @@ module.exports = {
136
136
}
137
137
}
138
138
139
+ if ( method . getter ) {
140
+ for ( i = 0 , j = methodsOrder . length ; i < j ; i ++ ) {
141
+ if ( methodsOrder [ i ] === 'getters' ) {
142
+ indexes . push ( i ) ;
143
+ break ;
144
+ }
145
+ }
146
+ }
147
+
148
+ if ( method . setter ) {
149
+ for ( i = 0 , j = methodsOrder . length ; i < j ; i ++ ) {
150
+ if ( methodsOrder [ i ] === 'setters' ) {
151
+ indexes . push ( i ) ;
152
+ break ;
153
+ }
154
+ }
155
+ }
156
+
139
157
if ( method . typeAnnotation ) {
140
158
for ( i = 0 , j = methodsOrder . length ; i < j ; i ++ ) {
141
159
if ( methodsOrder [ i ] === 'type-annotations' ) {
@@ -363,6 +381,8 @@ module.exports = {
363
381
function checkPropsOrder ( properties ) {
364
382
const propertiesInfos = properties . map ( node => ( {
365
383
name : getPropertyName ( node ) ,
384
+ getter : node . kind === 'get' ,
385
+ setter : node . kind === 'set' ,
366
386
static : node . static ,
367
387
typeAnnotation : ! ! node . typeAnnotation && node . value === null
368
388
} ) ) ;
You can’t perform that action at this time.
0 commit comments