coderaiser / putout

🐊 Pluggable and configurable JavaScript Linter, code transformer and formatter, drop-in ESLint superpower replacement 💪 with built-in support for js, jsx, typescript, flow, markdown, yaml and json. Write declarative codemods in a simplest possible way 😏
https://putout.cloudcmd.io/
MIT License
705 stars 40 forks source link

[types/convert-typeof-to-is-type]: Rule does not fix negated assertions #162

Closed ElPrudi closed 1 year ago

ElPrudi commented 1 year ago

While this rule wonderfully finds all:

if (typeof x === 'number')

it can not find:

if (typeof x !== 'number')
if (!(typeof x === 'number'))

Which should be corrected to:

if (!isNumber(x))
if (!isNumber(x))
coderaiser commented 1 year ago

Nice idea! Just landed 🎉. Is it works for you?

Checkout in 🐊Putout Editor.

I already have benefits from this https://github.com/coderaiser/putout/commit/3b595a812ff9f73a596545b6d3b8e3f4e30c86fa 🥳

ElPrudi commented 1 year ago

Can confirm, it works! Thank you very much :)