TreeviewCopyright © aleen42 all right reserved, powered by aleen42

Commas & Semicolons Back

1. Commas

  • Add one space after each commas.
  • It's recommended that adding commas of each properties, buy I'm familiar with the style that last property does not have the commas.
  • Eslint rules tags: comma-dangle
/**
 * bad
 */
const items = [1,2,3];

/**
 * good
 */
const items = [1, 2, 3];

/**
 * recommended
 */
const obj = {
    name: 'Aleen',
    age: '22',
};

/**
 * familar one
 */
const obj = {
    name: 'Aleen',
    age: '22'
};

2. Semicolons

  • Add semicolons after each statements.
  • Eslint rules tags: semi
/**
 * bad
 */
const i = 1

/**
 * good
 */
const i = 1;

results matching ""

    No results matching ""