Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ use crate::{
};

fn no_extra_non_null_assertion_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("extra non-null assertion").with_label(span)
OxcDiagnostic::warn("extra non-null assertion")
.with_help("Remove the redundant non-null assertion operator (`!`).")
.with_note("The non-null assertion operator in TypeScript, written as `!`, tells the compiler that an expression is definitely not `null` or `undefined` at that point. Chaining multiple non-null assertions on the same expression does not provide any additional safety and is redundant.")
.with_label(span)
}

#[derive(Debug, Default, Clone)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,57 +7,77 @@ source: crates/oxc_linter/src/tester.rs
1 │ const foo: { bar: number } | null = null; const bar = foo!!!.bar;
· ▲
╰────
help: Remove the redundant non-null assertion operator (`!`).
note: The non-null assertion operator in TypeScript, written as `!`, tells the compiler that an expression is definitely not `null` or `undefined` at that point. Chaining multiple non-null assertions on the same expression does not provide any additional safety and is redundant.

⚠ typescript-eslint(no-extra-non-null-assertion): extra non-null assertion
╭─[no_extra_non_null_assertion.tsx:1:58]
1 │ const foo: { bar: number } | null = null; const bar = foo!!!.bar;
· ▲
╰────
help: Remove the redundant non-null assertion operator (`!`).
note: The non-null assertion operator in TypeScript, written as `!`, tells the compiler that an expression is definitely not `null` or `undefined` at that point. Chaining multiple non-null assertions on the same expression does not provide any additional safety and is redundant.

⚠ typescript-eslint(no-extra-non-null-assertion): extra non-null assertion
╭─[no_extra_non_null_assertion.tsx:1:58]
1 │ const foo: { bar: number } | null = null; const bar = foo!!.bar;
· ▲
╰────
help: Remove the redundant non-null assertion operator (`!`).
note: The non-null assertion operator in TypeScript, written as `!`, tells the compiler that an expression is definitely not `null` or `undefined` at that point. Chaining multiple non-null assertions on the same expression does not provide any additional safety and is redundant.

⚠ typescript-eslint(no-extra-non-null-assertion): extra non-null assertion
╭─[no_extra_non_null_assertion.tsx:1:62]
1 │ function foo(bar: number | undefined) { const a: number = bar!!; }
· ▲
╰────
help: Remove the redundant non-null assertion operator (`!`).
note: The non-null assertion operator in TypeScript, written as `!`, tells the compiler that an expression is definitely not `null` or `undefined` at that point. Chaining multiple non-null assertions on the same expression does not provide any additional safety and is redundant.

⚠ typescript-eslint(no-extra-non-null-assertion): extra non-null assertion
╭─[no_extra_non_null_assertion.tsx:1:47]
1 │ function foo(bar?: { n: number }) { return bar!?.n; }
· ▲
╰────
help: Remove the redundant non-null assertion operator (`!`).
note: The non-null assertion operator in TypeScript, written as `!`, tells the compiler that an expression is definitely not `null` or `undefined` at that point. Chaining multiple non-null assertions on the same expression does not provide any additional safety and is redundant.

⚠ typescript-eslint(no-extra-non-null-assertion): extra non-null assertion
╭─[no_extra_non_null_assertion.tsx:1:47]
1 │ function foo(bar?: { n: number }) { return bar!?.(); }
· ▲
╰────
help: Remove the redundant non-null assertion operator (`!`).
note: The non-null assertion operator in TypeScript, written as `!`, tells the compiler that an expression is definitely not `null` or `undefined` at that point. Chaining multiple non-null assertions on the same expression does not provide any additional safety and is redundant.

⚠ typescript-eslint(no-extra-non-null-assertion): extra non-null assertion
╭─[no_extra_non_null_assertion.tsx:1:59]
1 │ const foo: { bar: number } | null = null; const bar = (foo!)!.bar;
· ▲
╰────
help: Remove the redundant non-null assertion operator (`!`).
note: The non-null assertion operator in TypeScript, written as `!`, tells the compiler that an expression is definitely not `null` or `undefined` at that point. Chaining multiple non-null assertions on the same expression does not provide any additional safety and is redundant.

⚠ typescript-eslint(no-extra-non-null-assertion): extra non-null assertion
╭─[no_extra_non_null_assertion.tsx:1:48]
1 │ function foo(bar?: { n: number }) { return (bar!)?.n; }
· ▲
╰────
help: Remove the redundant non-null assertion operator (`!`).
note: The non-null assertion operator in TypeScript, written as `!`, tells the compiler that an expression is definitely not `null` or `undefined` at that point. Chaining multiple non-null assertions on the same expression does not provide any additional safety and is redundant.

⚠ typescript-eslint(no-extra-non-null-assertion): extra non-null assertion
╭─[no_extra_non_null_assertion.tsx:1:49]
1 │ function foo(bar?: { n: number }) { return (bar)!?.n; }
· ▲
╰────
help: Remove the redundant non-null assertion operator (`!`).
note: The non-null assertion operator in TypeScript, written as `!`, tells the compiler that an expression is definitely not `null` or `undefined` at that point. Chaining multiple non-null assertions on the same expression does not provide any additional safety and is redundant.

⚠ typescript-eslint(no-extra-non-null-assertion): extra non-null assertion
╭─[no_extra_non_null_assertion.tsx:1:48]
1 │ function foo(bar?: { n: number }) { return (bar!)?.(); }
· ▲
╰────
help: Remove the redundant non-null assertion operator (`!`).
note: The non-null assertion operator in TypeScript, written as `!`, tells the compiler that an expression is definitely not `null` or `undefined` at that point. Chaining multiple non-null assertions on the same expression does not provide any additional safety and is redundant.
Loading