This repository was archived by the owner on Mar 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +53
-1
lines changed
src/rules/typescript-eslint Expand file tree Collapse file tree 3 files changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ module.exports = defineConfig({
104
104
'multiline' ,
105
105
'nashorn' ,
106
106
'nocheck' ,
107
+ 'nullish' ,
107
108
'phantomjs' ,
108
109
'pragma' ,
109
110
'prototypejs' ,
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import type { NoInferrableTypesRule } from './no-inferrable-types';
7
7
import type { NoParameterPropertiesRule } from './no-parameter-properties' ;
8
8
import type { NoUnsafeAssignmentRule } from './no-unsafe-assignment' ;
9
9
import type { NoUnusedVarsRule } from './no-unused-vars' ;
10
+ import type { PreferNullishCoalescingRule } from './prefer-nullish-coalescing' ;
10
11
11
12
/**
12
13
* All @typescript-eslint rules.
@@ -19,4 +20,5 @@ export type TypeScriptEslintRules = BanTsCommentRule &
19
20
NoInferrableTypesRule &
20
21
NoParameterPropertiesRule &
21
22
NoUnsafeAssignmentRule &
22
- NoUnusedVarsRule ;
23
+ NoUnusedVarsRule &
24
+ PreferNullishCoalescingRule ;
Original file line number Diff line number Diff line change
1
+ import type { RuleConfig } from '../rule-config' ;
2
+
3
+ /**
4
+ * Option.
5
+ */
6
+ export type PreferNullishCoalescingOption = {
7
+ /**
8
+ * Setting this option to `true` (the default) will cause the rule to ignore any cases that are located within a conditional test.
9
+ *
10
+ * @default true
11
+ *
12
+ * @see [ignoreConditionalTests](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md#ignoreconditionaltests)
13
+ */
14
+ ignoreConditionalTests ?: boolean ;
15
+ /**
16
+ * Setting this option to `true` (the default) will cause the rule to ignore any logical or expressions that are part of a mixed logical expression (with `&&`).
17
+ *
18
+ * @default true
19
+ *
20
+ * @see [ignoreMixedLogicalExpressions](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md#ignoremixedlogicalexpressions)
21
+ */
22
+ ignoreMixedLogicalExpressions ?: boolean ;
23
+ } ;
24
+
25
+ /**
26
+ * Options.
27
+ */
28
+ export type PreferNullishCoalescingOptions = [ PreferNullishCoalescingOption ?] ;
29
+
30
+ /**
31
+ * Enforce the usage of the nullish coalescing operator instead of logical chaining.
32
+ *
33
+ * @see [prefer-nullish-coalescing](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md)
34
+ */
35
+ export type PreferNullishCoalescingRuleConfig = RuleConfig < PreferNullishCoalescingOptions > ;
36
+
37
+ /**
38
+ * Enforce the usage of the nullish coalescing operator instead of logical chaining.
39
+ *
40
+ * @see [prefer-nullish-coalescing](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md)
41
+ */
42
+ export interface PreferNullishCoalescingRule {
43
+ /**
44
+ * Enforce the usage of the nullish coalescing operator instead of logical chaining.
45
+ *
46
+ * @see [prefer-nullish-coalescing](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md)
47
+ */
48
+ '@typescript-eslint/prefer-nullish-coalescing' : PreferNullishCoalescingRuleConfig ;
49
+ }
You can’t perform that action at this time.
0 commit comments