ember-learn / ember-jsonapi-docs

fixes up the ember docs generated by YUIDoc to be in JSONAPI format + some other niceties
9 stars 11 forks source link

fix mixed logical operators to make standardjs happy #45

Closed jenweber closed 6 years ago

jenweber commented 6 years ago

Address CI test failure introduced at https://github.com/ember-learn/ember-jsonapi-docs/pull/42 Unblocks CI for https://github.com/ember-learn/ember-jsonapi-docs/pull/44

StandardJS does not allow mixed && and || without parens. Please check my logic:

false && true  || true      // returns true
false && (true || true)     // returns false

So I wrapped the && operators in parens:

let included = ((classes.hasOwnProperty(className) &&
                  !classes[className].hasOwnProperty('static') &&
                  classes[className].hasOwnProperty('file')) ||
                  !classes.hasOwnProperty(className))

MDN reference

sivakumar-kailasam commented 6 years ago

May be time to switch away from standard.js and use the ember rules

jenweber commented 6 years ago

@sivakumar-kailasam By Ember rules, do you mean ESlint?

sivakumar-kailasam commented 6 years ago

Yep, in addition may be add ember-best-practices.

sivakumar-kailasam commented 6 years ago

Oh didn't realise this is the jsonapi-docs repo, thought it was the ember app 😅