Skip to content

Latest commit

 

History

History
91 lines (62 loc) · 1.41 KB

javascriptCode.md

File metadata and controls

91 lines (62 loc) · 1.41 KB

<   JavaScript Code Conventions

 


File Names

  • Postfix the names of index files with the name of its parent directory
// incorrect
src/
  components/
    MyComponent/
      index.js // <--
      MyComponent.js
      styles.js
// correct
src/
  components/
    MyComponent/
      indexMyComponent.js // <--
      MyComponent.js
      styles.js

Back to the top

 

Comments

  • Use TODO + initials comments to label any code as not production ready
// incorrect
const denomination = {
  currencyCode: 'USD' // Yikes!! this should definitely be changed
}

// correct
const denomination = {
  currencyCode: 'USD' // Todo: Replace hard coded currencies with library -paulvp
}
  • Break more than double nested array dereferences into multiple lines
// incorrect

// correct
  • Break more than double nested or function calls into multiple lines
// incorrect

// correct

Back to the top

 

Exports

  • Only use named exports
// incorrect
export default class FullWalletListRow extends Component<OwnProps> {
// correct
export class FullWalletListRow extends Component<OwnProps> {

Back to the top