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:
9090* ` everything-else ` is a special group that match all the methods that do not match any of the other groups.
9191* ` render ` is referring to the ` render ` method.
9292* ` 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.
9395
9496You can override this configuration to match your needs.
9597
Original file line number Diff line number Diff line change @@ -136,6 +136,24 @@ module.exports = {
136136 }
137137 }
138138
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+
139157 if ( method . typeAnnotation ) {
140158 for ( i = 0 , j = methodsOrder . length ; i < j ; i ++ ) {
141159 if ( methodsOrder [ i ] === 'type-annotations' ) {
@@ -363,6 +381,8 @@ module.exports = {
363381 function checkPropsOrder ( properties ) {
364382 const propertiesInfos = properties . map ( node => ( {
365383 name : getPropertyName ( node ) ,
384+ getter : node . kind === 'get' ,
385+ setter : node . kind === 'set' ,
366386 static : node . static ,
367387 typeAnnotation : ! ! node . typeAnnotation && node . value === null
368388 } ) ) ;
You can’t perform that action at this time.
0 commit comments