-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
11 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d657ea5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have thought the
constructor
would be better suited below the static properties, but above the lifecycle methods.d657ea5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we still only check the property name, not the type (static, get, set) issue #100.
Here
statics
only match thestatics
method in ES5 classes.d657ea5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, but we know
defaultProps
,statics
,mixins
, etc. will always be defined asstatic
class properties, no? While it can be argued thatconstructor
is not a React lifecycle method per-se, I think the following would be preferable:This way, this:
feels cleaner than:
d657ea5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I understand. It feels cleaner to me too.
I'm not working in ES6 and I am not very familiar with it yet, but for now I've seen 3 different patterns:
ES6 instance property :
ES6 class method:
ES7 class property:
In second case the method type can be
static
,get
,static get
or none. In third case the property type can bestatic
or none. Thestatic
type does not seems to be mandatory.However, I'd really like to come out with a good default configuration for ES5/ES6 classes, with method type support if needed.