Skip to content

💅 Improve noSyncScripts rule #8144

@THernandez03

Description

@THernandez03

Environment information

» npx @biomejs/biome rage --linter
CLI:
  Version:                      2.3.6
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  BIOME_THREADS:                unset
  NO_COLOR:                     unset
  TERM:                         xterm-256color
  JS_RUNTIME_VERSION:           v25.2.1
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         npm/11.6.2

Biome Configuration:
  Status:                       Loaded successfully
  Path:                         biome.jsonc
  Formatter enabled:            true
  Linter enabled:               true
  Assist enabled:               true
  VCS enabled:                  false

Linter:
  JavaScript enabled:           unset
  JSON enabled:                 unset
  CSS enabled:                  unset
  GraphQL enabled:              unset
  Recommended:                  false
  Enabled rules:
    nursery/noSyncScripts

Workspace:
  Open Documents:               0

Rule name

noSyncScripts

Playground link

https://github.com/THernandez03/biome-noSyncScripts

Why This is Incorrect

Module Scripts Are Already Deferred

According to the MDN Web Docs - JavaScript Modules:

3. Modules are deferred automatically

Modules are automatically executed in defer mode. This means that:

  • Module scripts are downloaded in parallel to parsing the HTML
  • Module scripts are executed after the document has been parsed
  • The relative order of multiple module scripts is preserved

Expected result

The noSyncScripts rule should be updated to:

  1. Skip validation for <script> tags with type="module"
  2. Only flag classic <script> tags without defer or async attributes
  3. Optionally provide an informational message explaining that module scripts are already deferred

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-Needs responseStatus: await response from OPS-Needs triageStatus: this issue needs to be triaged

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions