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
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl Linter {
let should_run_on_jest_node =
ctx_host.plugins().has_test() && ctx_host.frameworks().is_test();

if path.ends_with(".d.ts") {
if path.to_str().is_some_and(|str| str.ends_with(".d.ts")) {
return ctx_host.take_diagnostics();
}

Expand Down
20 changes: 11 additions & 9 deletions crates/oxc_linter/src/rules/jsdoc/check_tag_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ fn test() {
),
];

let dts_pass = vec![
let _dts_pass: Vec<(&'static str, Option<serde_json::Value>, Option<serde_json::Value>)> = vec![
(
"
/** @default 0 */
Expand Down Expand Up @@ -1158,18 +1158,20 @@ fn test() {
None,
),
];
let dts_fail = vec![(
"
let _dts_fail: Vec<(&'static str, Option<serde_json::Value>, Option<serde_json::Value>)> =
vec![(
"
/** @typoo {string} (fail: invalid name) */
let a;
",
None,
None,
)];
None,
None,
)];

Tester::new(CheckTagNames::NAME, CheckTagNames::PLUGIN, pass, fail).test_and_snapshot();
// TODO: re-enable here when we officially support linting `.d.ts` files
// Currently only 1 snapshot can be saved under a rule name
Tester::new(CheckTagNames::NAME, CheckTagNames::PLUGIN, dts_pass, dts_fail)
.change_rule_path("test.d.ts")
.test();
// Tester::new(CheckTagNames::NAME, CheckTagNames::PLUGIN, dts_pass, dts_fail)
// .change_rule_path("test.d.ts")
// .test();
}
Loading