Skip to content

Coding Standards

Émilie Martin edited this page Mar 31, 2020 · 4 revisions

Front-End

  • Imports are sorted alphabetically
  • Imports related to library imports, project file imports, and style sheet imports are separated by an empty line
  • Functional components are prioritized over class components
  • An empty line separates the imports from the exported default function
  • Class names (found in the HTML elements of the return() statement) are kebab-cased
  • 2-space tabbing
  • When writing functions, the opening curly brace is on the same line as the function name and arguments
function fctName() {  
  function description  
}

The same is applied to if/else statements, try/catch blocks, as well as multi-line return statements

  • Comments are written above or after the targeted code (if the space allows for it to be on the same line)

Back-End

  • Imports are sorted alphabetically and separated by category by a comment (Spring Boot, project, etc.)
  • Imports are associated by category and each category is separated by an empty line
  • Functions are camelCased
  • 4-space tabbing
  • When writing functions, the opening and closing curly brackets are the only character comprising their line
function fctName ()   
{  
  function description  
}

The same is applied to if/else statements, try/catch blocks, as well as multi-line return statements. If a line of code precedes or follows the if/else or try/catch block, then white lines are added to distinguish the block (unless it comprises the only body of the function).

  • Comments are written above or after the targeted code (if the space allows for it to be on the same line)
  • URIs are written according to this convention: resource/functionality(purpose)/specification(parameter) and should be devoid of any verbs

Clone this wiki locally