Skip to content

Commit 6dde5d0

Browse files
JoshuaKGoldbergdanvk
authored andcommitted
chore: enable prefer-nullish-coalescing internally (typescript-eslint#7955)
* chore: enable prefer-nullish-calescing internally * A couple complaints * One last complaint * Enable ignoreConditionalTests
1 parent 03866c1 commit 6dde5d0

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

.eslintrc.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ module.exports = {
5151
// make sure we're not leveraging any deprecated APIs
5252
'deprecation/deprecation': 'error',
5353

54-
// TODO(#7338): Investigate enabling these soon ✨
55-
'@typescript-eslint/prefer-nullish-coalescing': 'off',
56-
5754
// TODO(#7130): Investigate changing these in or removing these from presets
5855
'@typescript-eslint/no-confusing-void-expression': 'off',
5956
'@typescript-eslint/prefer-string-starts-ends-with': 'off',
@@ -109,6 +106,13 @@ module.exports = {
109106
'error',
110107
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_' },
111108
],
109+
'@typescript-eslint/prefer-nullish-coalescing': [
110+
'error',
111+
{
112+
ignoreConditionalTests: true,
113+
ignorePrimitives: true,
114+
},
115+
],
112116

113117
//
114118
// Internal repo rules

packages/eslint-plugin/src/rules/padding-line-between-statements.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ function verifyForAlways(
476476
}
477477
return true;
478478
},
479-
}) || nextNode;
479+
}) ?? nextNode;
480480
const insertText = isTokenOnSameLine(prevToken, nextToken)
481481
? '\n\n'
482482
: '\n';

packages/eslint-plugin/src/rules/unified-signatures.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ export default createRule<Options, MessageIds>({
369369
}
370370

371371
return typeContainsTypeParameter(
372-
(type as Partial<TSESTree.TSTypeAnnotation>).typeAnnotation ||
372+
(type as Partial<TSESTree.TSTypeAnnotation>).typeAnnotation ??
373373
(type as TSESTree.TSArrayType).elementType,
374374
);
375375
}
@@ -523,7 +523,7 @@ export default createRule<Options, MessageIds>({
523523
key ??= getOverloadKey(signature);
524524
if (
525525
currentScope &&
526-
(containingNode || signature).parent === currentScope.parent
526+
(containingNode ?? signature).parent === currentScope.parent
527527
) {
528528
const overloads = currentScope.overloads.get(key);
529529
if (overloads !== undefined) {

packages/rule-tester/src/utils/getRuleOptionsSchema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ export function getRuleOptionsSchema(
3333
}
3434

3535
// Given a full schema, leave it alone
36-
return schema || null;
36+
return schema ?? null;
3737
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy