Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typecheck-number to general #562

Open
marcus13371337 opened this issue Nov 20, 2018 · 3 comments
Open

typecheck-number to general #562

marcus13371337 opened this issue Nov 20, 2018 · 3 comments

Comments

@marcus13371337
Copy link

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
Copy link
Owner

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
Copy link
Author

marcus13371337 commented Nov 20, 2018

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
Copy link
Owner

Could you send a PR with a failing test ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants