EmmanuelDemey / eslint-plugin-angular

ESLint plugin for AngularJS applications
https://www.npmjs.com/package/eslint-plugin-angular
618 stars 131 forks source link

typecheck-number to general #562

Open marcus13371337 opened 6 years ago

marcus13371337 commented 6 years ago

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'

EmmanuelDemey commented 6 years ago

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

marcus13371337 commented 6 years ago

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 :)

EmmanuelDemey commented 6 years ago

Could you send a PR with a failing test ?