Skip to content

Commit cac06e2

Browse files
committed
chore(linter): Update the file extensions allowed for detection as a jest file. (#15742)
Jest 30 adds all of these: https://jestjs.io/docs/upgrading-to-jest30#support-for-mts-and-cts-file-extensions This `is_jest_file` method is only used in the no-export rule, I'm unsure if it's really worth keeping around in general, but if it is we should keep it up-to-date.
1 parent 5a66558 commit cac06e2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

crates/oxc_linter/src/utils/jest.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,13 @@ pub fn is_jest_file(ctx: &LintContext) -> bool {
9393
}
9494

9595
let file_path = ctx.file_path().to_string_lossy();
96-
["spec.js", "spec.jsx", "spec.ts", "spec.tsx", "test.js", "test.jsx", "test.ts", "test.tsx"]
97-
.iter()
98-
.any(|ext| file_path.ends_with(ext))
96+
[
97+
"spec.js", "spec.jsx", "spec.ts", "spec.tsx", "spec.mjs", "spec.cjs", "spec.mts",
98+
"spec.cts", "test.js", "test.jsx", "test.ts", "test.tsx", "test.mjs", "test.cjs",
99+
"test.mts", "test.cts",
100+
]
101+
.iter()
102+
.any(|ext| file_path.ends_with(ext))
99103
}
100104

101105
pub fn is_type_of_jest_fn_call<'a>(

0 commit comments

Comments
 (0)