Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Jul 23, 2022
1 parent 3b36d89 commit 67e7ab5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
11 changes: 3 additions & 8 deletions packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts
Expand Up @@ -179,14 +179,9 @@ export default util.createRule<Options, MessageIds>({
}

const isFixable = ((): boolean => {
// it is fixable if we check for both null and undefined
if (hasUndefinedCheck && hasNullCheck) {
return true;
}

// it is not fixable if it has neither a null nor undefined check
if (!hasUndefinedCheck && !hasNullCheck) {
return false;
// it is fixable if we check for both null and undefined, or not if neither
if (hasUndefinedCheck === hasNullCheck) {
return hasUndefinedCheck;
}

// it is fixable if we loosely check for either null or undefined
Expand Down
16 changes: 0 additions & 16 deletions packages/eslint-plugin/src/util/isNodeEqual.ts
@@ -1,20 +1,4 @@
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
/*
* Supported:
* Identifier Literal MemberExpression ThisExpression
* TSNamedTupleMember TSNamespaceExportDeclaration TSNeverKeyword
* TSNonNullExpression TSNullKeyword TSNumberKeyword TSObjectKeyword
* TSOptionalType TSParameterProperty TSPrivateKeyword TSPropertySignature
* TSProtectedKeyword TSPublicKeyword TSQualifiedName TSReadonlyKeyword
* TSRestType TSStaticKeyword TSStringKeyword TSSymbolKeyword
* TSTemplateLiteralType TSThisType TSTupleType TSTypeAliasDeclaration
* TSTypeAnnotation TSTypeAssertion TSTypeLiteral TSTypeOperator
* TSTypeParameter TSTypeParameterDeclaration TSTypeParameterInstantiation
* TSTypePredicate TSTypeQuery TSTypeReference TSUndefinedKeyword TSUnionType
* TSUnknownKeyword TSVoidKeyword UnaryExpression UpdateExpression
* VariableDeclaration VariableDeclarator WhileStatement WithStatement
* YieldExpression
*/

export function isNodeEqual(a: TSESTree.Node, b: TSESTree.Node): boolean {
if (a.type !== b.type) {
Expand Down

0 comments on commit 67e7ab5

Please sign in to comment.