Ant-design: Code convention for antd

Created on 22 Mar 2016  ·  4Comments  ·  Source: ant-design/ant-design

Thanks to @waywardmonkeys, antd's code style is more consistent now :-)

And I think we had better to write those code convention in a document, so others can refer to it (as a complement or ESLint). I had created a wiki.

Maybe we could discuss code convention in this issue, and update the wiki when we draw a conclusion.

cc @afc163 @yiminghe
Maybe @hotoo is interested in this :-)

Note: antd's code style should be super set of eslint-config-airbnb.

🗣 Discussion

Most helpful comment

// Good
Button.propTypes = {
  type: PropTypes.string,
}
// Bad
Button.propTypes = {
  type: PropTypes.string,
};

自从写js后看到分号总觉得不自在。。。

All 4 comments

We can discuss questions like this:

I think PropTypes.string is better than React.PropTypes.string, for it's more concise.

// Good
Button.propTypes = {
  type: PropTypes.string,
};

// Bad
Button.propTypes = {
  type: React.PropTypes.string,
};
// Good
Button.propTypes = {
  type: PropTypes.string,
}
// Bad
Button.propTypes = {
  type: PropTypes.string,
};

自从写js后看到分号总觉得不自在。。。

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AhmedSayed77 picture AhmedSayed77  ·  3Comments

alanwei0 picture alanwei0  ·  3Comments

tianyacsdn picture tianyacsdn  ·  3Comments

plandem picture plandem  ·  3Comments

ericdai picture ericdai  ·  3Comments