Skip to content

Commit d3be692

Browse files
committed
chore(linter/no-non-null-asserted-optional-chain): make fixer a suggestion not a fix (#13644)
while this wouldn't change the runtime behaviour, it would cause user's typecheck workflows to fail hence it's unsafe to unconditionally apply.
1 parent 93da5bc commit d3be692

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

crates/oxc_language_server/src/snapshots/fixtures_linter_issue_9958@issue.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ related_information[1].location.range: Range { start: Position { line: 11, chara
2828
severity: Some(Error)
2929
source: Some("oxc")
3030
tags: None
31-
fixed: Single(FixedContent { message: Some("Delete this code."), code: "", range: Range { start: Position { line: 11, character: 21 }, end: Position { line: 11, character: 22 } } })
31+
fixed: None
3232

3333

3434
code: "None"

crates/oxc_linter/src/rules/typescript/no_non_null_asserted_optional_chain.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ declare_oxc_lint!(
5757
NoNonNullAssertedOptionalChain,
5858
typescript,
5959
correctness,
60-
fix
60+
suggestion
6161
);
6262

6363
impl Rule for NoNonNullAssertedOptionalChain {
@@ -111,8 +111,7 @@ impl Rule for NoNonNullAssertedOptionalChain {
111111
Span::sized(chain_span_end, 1),
112112
Span::sized(non_null_end, 1),
113113
);
114-
// ctx.diagnostic(diagnostic);
115-
ctx.diagnostic_with_fix(diagnostic, |fixer| {
114+
ctx.diagnostic_with_suggestion(diagnostic, |fixer| {
116115
fixer.delete_range(Span::sized(non_null_end, 1))
117116
});
118117
}

0 commit comments

Comments
 (0)