Skip to content

Commit 4528a2e

Browse files
committed
chore(linter): enable lint rules on .d.ts files (oxc-project#12339)
1 parent 652c038 commit 4528a2e

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

crates/oxc_linter/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,6 @@ impl Linter {
143143
let should_run_on_jest_node =
144144
ctx_host.plugins().has_test() && ctx_host.frameworks().is_test();
145145

146-
if path.to_str().is_some_and(|str| str.ends_with(".d.ts")) {
147-
return ctx_host.take_diagnostics();
148-
}
149-
150146
// IMPORTANT: We have two branches here for performance reasons:
151147
//
152148
// 1) Branch where we iterate over each node, then each rule

crates/oxc_linter/src/rules/jsdoc/check_tag_names.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ fn test() {
10941094
),
10951095
];
10961096

1097-
let _dts_pass: Vec<(&'static str, Option<serde_json::Value>, Option<serde_json::Value>)> = vec![
1097+
let dts_pass: Vec<(&'static str, Option<serde_json::Value>, Option<serde_json::Value>)> = vec![
10981098
(
10991099
"
11001100
/** @default 0 */
@@ -1158,7 +1158,7 @@ fn test() {
11581158
None,
11591159
),
11601160
];
1161-
let _dts_fail: Vec<(&'static str, Option<serde_json::Value>, Option<serde_json::Value>)> =
1161+
let dts_fail: Vec<(&'static str, Option<serde_json::Value>, Option<serde_json::Value>)> =
11621162
vec![(
11631163
"
11641164
/** @typoo {string} (fail: invalid name) */
@@ -1169,9 +1169,8 @@ fn test() {
11691169
)];
11701170

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

0 commit comments

Comments
 (0)