Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 940 Bytes

File metadata and controls

47 lines (34 loc) · 940 Bytes

Strings

Quotes

Use double quotes for all strings. ESLint will enforce this. If you're using a generator (like ember generate route index) you can run npm run lint:js -- --fix after the generator to convert any single quotes to doubles

Good

let name = "Bob Dobalina"

Bad

let name = 'Bob Dobalina'

Breaking Strings

Don't break long strings onto multiple lines. As Airbnb's style guide says:

Why? Broken strings are painful to work with and make code less searchable.

Good

let message = "Holy cow this is gonna be one heckin' long string fren. I wonder how long we can go without using more doggo talkos

Bad


String Templates

Always use string templates instead of concatenation

Good

let endpoint = `${ENV.apiPrefix}/posts`;

Bad

let endpoint = ENV.apiPrefix + '/posts';