Skip to content

🐛 Formatter rejects surrogate code point escape sequences in string literals #10110

@aplefull

Description

@aplefull

Environment information

Details
CLI:
  Version:                      2.4.13
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:                    unset
  BIOME_LOG_PREFIX_NAME:             unset
  BIOME_LOG_LEVEL:                   unset
  BIOME_LOG_KIND:                    unset
  BIOME_CONFIG_PATH:                 unset
  BIOME_THREADS:                     unset
  BIOME_WATCHER_KIND:                unset
  BIOME_WATCHER_POLLING_INTERVAL:    unset
  NO_COLOR:                     unset
  TERM:                         xterm-256color
  JS_RUNTIME_VERSION:           v24.8.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       Loaded successfully
  Path:                         biome.json
  Formatter enabled:            true
  Linter enabled:               true
  Assist enabled:               true
  VCS enabled:                  false
  HTML full support enabled:    unset

Workspace:
  Open Documents:               0

What happened?

Biome aborts formatting due to parsing errors:

const a = "\u{daff}\u{dfff}";
const b = "\u{D83D}\u{DE0A}";
✖ invalid codepoint for unicode escape
  
  > 1 │ const a = "\u{daff}\u{dfff}";
      │               ^^^^
    2 │ const b = "\u{D83D}\u{DE0A}";
    3 │ 

Playground url

Expected result

Biome should format the file. This code runs in all major JS engines and Prettier is able to format it.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

Labels

A-ParserArea: parserL-JavaScriptLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bug

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions