kupibilet-frontend / eslint-config-kupibilet

ESLint config for kupibilet.ru teams
https://github.com/kupibilet-frontend/eslint-config-kupibilet
3 stars 0 forks source link

Add `no-implicit-coercion` and `no-new-wrappers` #35

Closed nezed closed 6 years ago

nezed commented 6 years ago

https://eslint.org/docs/rules/no-implicit-coercion

Bad:

const a = !!b

Good:

const a = Boolean(b)

https://eslint.org/docs/rules/no-new-wrappers

Bad:

const a = new Boolean(b)

Good:

const a = Boolean(b)
nezed commented 6 years ago

no-implicit-coercion with string: true:

Bad:

const a = '' + 123

Good:

const n = 123

const a = `${n}`
const b = n.toString()
const c = String(n)