Skip to content

Commit eefd818

Browse files
dosmondcamc314
andauthored
fix(linter/explicit-module-boundary-types): add help messages to missing diagnostics (#19736)
Added `.with_help` to the following lint rules at in the typescript `explicit-module-boundary-types.rs` file: - `func_missing_return_type` - `func_missing_argument_type` - `func_argument_is_explicitly_any` Part of #19121 --------- Co-authored-by: Cameron <[email protected]>
1 parent a447840 commit eefd818

File tree

2 files changed

+110
-3
lines changed

2 files changed

+110
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,23 @@ use crate::{
2424
};
2525

2626
fn func_missing_return_type(fn_span: Span) -> OxcDiagnostic {
27-
OxcDiagnostic::warn("Missing return type on function").with_label(fn_span)
27+
OxcDiagnostic::warn("Missing return type on function")
28+
.with_help("Define an explicit return type for the function.")
29+
.with_label(fn_span)
2830
}
2931

3032
fn func_missing_argument_type(param_span: Span) -> OxcDiagnostic {
31-
OxcDiagnostic::warn("Missing argument type on function").with_label(param_span)
33+
OxcDiagnostic::warn("Missing argument type on function")
34+
.with_help("Define an explicit argument type for each argument.")
35+
.with_label(param_span)
3236
}
3337

3438
fn func_argument_is_explicitly_any(param_span: Span) -> OxcDiagnostic {
35-
OxcDiagnostic::warn("Argument is explicitly typed as `any`").with_label(param_span)
39+
OxcDiagnostic::warn("Argument is explicitly typed as `any`")
40+
.with_help(
41+
"Avoid explicit `any` at module boundaries; prefer `unknown` and narrow before use.",
42+
)
43+
.with_label(param_span)
3644
}
3745

3846
#[derive(Debug, Default, Clone, Deserialize)]

0 commit comments

Comments
 (0)