Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 suspicious/noRedundantUseStrict is reported for .cjs files #362

Open
1 of 3 tasks
risu729 opened this issue Sep 23, 2024 · 1 comment
Open
1 of 3 tasks

🐛 suspicious/noRedundantUseStrict is reported for .cjs files #362

risu729 opened this issue Sep 23, 2024 · 1 comment
Labels

Comments

@risu729
Copy link

risu729 commented Sep 23, 2024

VS Code version

1.94.0-insider

Extension version

2.3.0

Biome version

1.9.2

Operating system

  • Windows
  • macOS
  • Linux

Description

The extension reports an error for use strict directive in .cjs files with suspicious/noRedundantUseStrict.

Steps to reproduce

  1. Create a file with .cjs exntension.
  2. Add use strict directive.
  3. Error is shown as a problem.

Expected behavior

No errors are shown as documents says.

Instead, .cjs files are considered “scripts” and the directive "use strict" is accepted and advised.

Does this issue occur when using the CLI directly?

No

Link to a minimal reproduction

https://github.com/risu729/biome-repro-1727086476220

Logs

CLI:
  Version:                      1.9.2
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v22.9.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/10.8.3"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 true

Workspace:
  Open Documents:               0

Discovering running Biome servers...

Running Biome Server: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i The client isn't connected to any server but rage discovered this running Biome server.

Server:
  Version:                      1.9.2
  Name:                         biome_lsp
  CPU Architecture:             x86_64
  OS:                           linux

Workspace:
  Open Documents:               0

Other Active Server Workspaces:

Workspace:
  Open Documents:               2
  Client Name:                  Visual Studio Code - Insiders
  Client Version:               1.94.0-insider

Biome Server Log:

! Please review the content of the log file before sharing it publicly as it may contain sensitive information:
  * Path names that may reveal your name, a project name, or the name of your employer.
  * Source code

┐biome_cli::commands::daemon::Running Server{pid=9130}
├─ INFO biome_cli::service::unix Trying to connect to socket /home/risu/.cache/biome/biome-socket-1.9.2
├─ INFO biome_lsp::server Starting Biome Language Server...
├─ WARN biome_lsp::server The Biome Server was initialized with the deprecated `root_path` parameter: this is not supported, use `root_uri` instead
├─ INFO biome_lsp::server Attempting to load the configuration from 'biome.json' file
├─ INFO biome_lsp::session Detected workspace folder.
├─ INFO biome_lsp::session Attempt to load the configuration file in Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/home/risu/github/use-strict-biome/biome-repro-1727086476220", query: None, fragment: None }
└─┐biome_fs::fs::os::OsFileSystem::open_with_options{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/biome.json", options=OpenOptions { read: true, write: false, truncate: false, create: false, create_new: false }}
┌─┘
└─┐biome_fs::fs::os::OsFile::read_to_string{}
┌─┘
└─┐biome_json_parser::parse{}
┌─┘
├─ INFO biome_lsp::session Configuration loaded successfully from disk.
├─ INFO biome_lsp::session Update workspace settings.
├─ DEBUG biome_service::workspace::server Compare the current project with the new one None Some("/home/risu/github/use-strict-biome/biome-repro-1727086476220") true
└─┐biome_fs::fs::os::OsFileSystem::open_with_options{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/package.json", options=OpenOptions { read: true, write: false, truncate: false, create: false, create_new: false }}
┌─┘
└─┐biome_fs::fs::os::OsFile::read_to_string{}
┌─┘
└─┐biome_json_parser::parse{}
┌─┘
└─┐biome_lsp::handlers::text_document::did_open{text_document_uri=file:///home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs, text_document_language_id=javascript}
  └─┐biome_service::file_handlers::try_from_language_id{language_id="javascript"}
  ┌─┘
  └─┐biome_service::file_handlers::try_from_path{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    └─┐biome_service::file_handlers::try_from_well_known{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    ┌─┘
    └─┐biome_service::file_handlers::try_from_extension{extension="cjs"}
    ┌─┘
  ┌─┘
  └─┐biome_service::file_handlers::try_from_path{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    └─┐biome_service::file_handlers::try_from_well_known{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    ┌─┘
    └─┐biome_service::file_handlers::try_from_extension{extension="cjs"}
    ┌─┘
  ┌─┘
  ├─ DEBUG biome_service::workspace::server File capabilities: Js(JsFileSource { language: JavaScript, variant: Jsx, module_kind: Module, version: ES2022, embedding_kind: None }) BiomePath { path: "/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs", kind: FileKinds(BitFlags<FileKind>(0b10000, Handleable)), was_written: false }
  └─┐biome_service::file_handlers::try_from_path{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    └─┐biome_service::file_handlers::try_from_well_known{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    ┌─┘
    └─┐biome_service::file_handlers::try_from_extension{extension="cjs"}
    ┌─┘
  ┌─┘
  └─┐biome_service::file_handlers::try_from_path{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    └─┐biome_service::file_handlers::try_from_well_known{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    ┌─┘
    └─┐biome_service::file_handlers::try_from_extension{extension="cjs"}
    ┌─┘
  ┌─┘
  ├─ DEBUG biome_service::workspace The file has the following feature sets: 
  │ {Format: Supported, Search: Supported, Assists: Supported, Lint: Supported, OrganizeImports: Supported}
  └─┐biome_service::file_handlers::try_from_path{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    └─┐biome_service::file_handlers::try_from_well_known{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    ┌─┘
    └─┐biome_service::file_handlers::try_from_extension{extension="cjs"}
    ┌─┘
  ┌─┘
  ├─ DEBUG biome_service::workspace::server File capabilities: Js(JsFileSource { language: JavaScript, variant: Jsx, module_kind: Module, version: ES2022, embedding_kind: None }) BiomePath { path: "/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs", kind: FileKinds(BitFlags<FileKind>(0b10000, Handleable)), was_written: false }
  └─┐biome_service::file_handlers::try_from_path{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    └─┐biome_service::file_handlers::try_from_well_known{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    ┌─┘
    └─┐biome_service::file_handlers::try_from_extension{extension="cjs"}
    ┌─┘
  ┌─┘
  └─┐biome_js_parser::parse::parse{}
  ┌─┘
  └─┐biome_service::file_handlers::try_from_path{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    └─┐biome_service::file_handlers::try_from_well_known{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    ┌─┘
    └─┐biome_service::file_handlers::try_from_extension{extension="cjs"}
    ┌─┘
  ┌─┘
  ├─ DEBUG biome_service::workspace::server File capabilities: Js(JsFileSource { language: JavaScript, variant: Jsx, module_kind: Module, version: ES2022, embedding_kind: None }) BiomePath { path: "/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs", kind: FileKinds(BitFlags<FileKind>(0b10000, Handleable)), was_written: false }
  └─┐biome_service::file_handlers::try_from_path{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    └─┐biome_service::file_handlers::try_from_well_known{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
    ┌─┘
    └─┐biome_service::file_handlers::try_from_extension{extension="cjs"}
    ┌─┘
  ┌─┘
  └─┐biome_service::workspace::server::Pulling diagnostics{categories=RuleCategories(BitFlags<Categories>(0b111, Syntax | Lint | Action))}
    └─┐biome_service::file_handlers::try_from_path{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
      └─┐biome_service::file_handlers::try_from_well_known{path="/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs"}
      ┌─┘
      └─┐biome_service::file_handlers::try_from_extension{extension="cjs"}
      ┌─┘
    ┌─┘
    └─┐biome_service::file_handlers::javascript::Linting JavaScript file{path=BiomePath { path: "/home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs", kind: FileKinds(BitFlags<FileKind>(0b10000, Handleable)), was_written: false }, language=Js(JsFileSource { language: JavaScript, variant: Jsx, module_kind: Module, version: ES2022, embedding_kind: None })}
      ├─ INFO biome_service::file_handlers::javascript Analyze file /home/risu/github/use-strict-biome/biome-repro-1727086476220/index.cjs
      ├─ DEBUG biome_rowan::ast::batch pushing change...
      ├─ DEBUG biome_rowan::ast::batch pushing change...
    ┌─┘
  ┌─┘
  ├─ INFO biome_service::workspace::server Pulled 1 diagnostic(s)
┌─┘
├─ INFO biome_lsp::session Loaded client configuration: Object {
│     "enabled": Bool(true),
│     "lspBin": String(""),
│     "searchInPath": Bool(true),
│     "rename": Bool(false),
│ }
├─ INFO biome_lsp::session Unregister capabilities "workspace/didChangeConfiguration, textDocument/rangeFormatting, textDocument/onTypeFormatting, textDocument/rename, textDocument/formatting, workspace/didChangeWatchedFiles"
├─ INFO biome_lsp::session Register capabilities "workspace/didChangeConfiguration, textDocument/rangeFormatting, textDocument/onTypeFormatting, textDocument/formatting, workspace/didChangeWatchedFiles"
@risu729 risu729 added the Triage label Sep 23, 2024
@risu729
Copy link
Author

risu729 commented Sep 23, 2024

might be related to #338

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant