eslint-plugin-angular icon indicating copy to clipboard operation
eslint-plugin-angular copied to clipboard

typecheck-number to general

Open marcus13371337 opened this issue 7 years ago • 3 comments

The typecheck-number rule is reacting to my code, when I'm checking if a input tag is of type number. type === 'number'

Should only react on: typeof type === 'number'

marcus13371337 avatar Nov 20 '18 11:11 marcus13371337

That's normal.

If the developer use the next snippet, ESLint should throw an error

const type = typeof variable
type === 'number'

https://github.com/Gillespie59/eslint-plugin-angular/blob/master/test/typecheck-number.js#L37

EmmanuelDemey avatar Nov 20 '18 15:11 EmmanuelDemey

No because now I use it like this:

let input = document.findByClassName('my-input')
let type = input.attrs.type
if(type === 'number') return true

I don't want to use angular.isNumber() here :)

marcus13371337 avatar Nov 20 '18 15:11 marcus13371337

Could you send a PR with a failing test ?

EmmanuelDemey avatar Nov 21 '18 15:11 EmmanuelDemey