-
-
Notifications
You must be signed in to change notification settings - Fork 420
no-instanceof-builtin-object: Rename to no-instanceof-builtins and use suggestions for unsafe cases
#2537
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
no-instanceof-builtin-object: Rename to no-instanceof-builtins and use suggestions for unsafe cases
#2537
Conversation
|
I reminded it in that PR, I thought you knew, after all, there are very few such cases. After all, the package import { isNumber } from '@sindresorhus/is';
isNumber(new Number(123)) // false |
|
BTW, All of primitive wrappers did not have a safe fix. If this is unacceptable, we should change the auto-fix to suggestions String// ❌
'abc' instanceof String; // false
typeof 'abc' === 'string'; // trueNumber// ❌
123 instanceof Number; // false
typeof 123 === 'number'; // trueBoolean// ❌
true instanceof Boolean; // false
typeof true === 'boolean'; // trueBigInt// ❌
123n instanceof BigInt; // false
typeof 123n === 'bigint'; // trueSymbol// ❌
Symbol('[[test]]') instanceof Symbol; // false
typeof Symbol('[[test]]') === 'symbol'; // true |
I forgot that |
# Conflicts: # readme.md
|
We already have a rule named |
The name seems more consistent |
no-instanceof-builtin-object: Use suggestion for primitive wrappersno-instanceof-builtin-object: Rename to no-instanceof-builtins and use suggestions for unsafe cases
|
Merge conflict |
This is a major version bump, but the changelog at https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v57.0.0 doesn't indicate any breaking changes that should impact us. However, we do replace the deprecated `no-instanceof-array` rule with the new `no-instanceof-builtins` rule. Note that the changelog calls this rule `no-instanceof-builtin-object`, but it got renamed in sindresorhus/eslint-plugin-unicorn#2537.
This is a major version bump, but the changelog at https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v57.0.0 doesn't indicate any breaking changes that should impact us. However, we do replace the deprecated `no-instanceof-array` rule with the new `no-instanceof-builtins` rule. Note that the changelog calls this rule `no-instanceof-builtin-object`, but it got renamed in sindresorhus/eslint-plugin-unicorn#2537.
It's not safe to fix
Sorry that I missed this in #2523, cc @axetroy