File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
crates/biome_service/src/workspace Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @biomejs/biome " : patch
3+ ---
4+
5+ Fixed [ #4665 ] ( https://github.com/biomejs/biome/issues/4665 ) : the LSP previously
6+ identified ` .cjs ` files as ESM files, making rules like ` noRedundantUseStrict `
7+ reports incorrectly valid ` "use strict" ` directives.
Original file line number Diff line number Diff line change @@ -347,13 +347,19 @@ impl WorkspaceServer {
347347 let mut source = document_file_source. unwrap_or ( DocumentFileSource :: from_path ( & path) ) ;
348348
349349 if let DocumentFileSource :: Js ( js) = & mut source {
350- if path. extension ( ) . is_some_and ( |extension| extension == "js" ) {
351- let manifest = self . project_layout . find_node_manifest_for_path ( & path) ;
352- if let Some ( ( _, manifest) ) = manifest {
353- if manifest. r#type == Some ( PackageType :: CommonJs ) {
354- js. set_module_kind ( ModuleKind :: Script ) ;
350+ match path. extension ( ) {
351+ Some ( "js" ) => {
352+ let manifest = self . project_layout . find_node_manifest_for_path ( & path) ;
353+ if let Some ( ( _, manifest) ) = manifest {
354+ if manifest. r#type == Some ( PackageType :: CommonJs ) {
355+ js. set_module_kind ( ModuleKind :: Script ) ;
356+ }
355357 }
356358 }
359+ Some ( "cjs" ) => {
360+ js. set_module_kind ( ModuleKind :: Script ) ;
361+ }
362+ _ => { }
357363 }
358364 }
359365
You can’t perform that action at this time.
0 commit comments