beautifier/js-beautify

Option unescape_strings can produce invalid string literals making JS invalid/uninterpretable

Open

#2,141 opened on 2023年3月17日

GitHub で見る
 (9 comments) (0 reactions) (0 assignees)JavaScript (1,460 forks)batch import
good first issuelanguage: javascripttype: bug

Repository metrics

Stars
 (8,342 stars)
PR merge metrics
 (平均マージ 51d 1h) (30d で 16 merged PRs)

説明

Description

Option unescape_strings can produce invalid string literals making JS invalid/uninterpretable

Input

The code looked like this before beautification:

        function () {
          i.exports = "\t\n\x0B\f\r   ᠎              \u2028\u2029\ufeff"
        }()

Expected Output

The code should have looked like this after beautification: code that does not contain invalid string literals

Actual Output

The code actually looked like this after beautification:

        function () {
          i.exports = "\t\n\x0B\f\r   ᠎              

"
        }()

Steps to Reproduce

Environment

OS: Firefox/Win10

Settings

{
        "unescape_strings": true,
}

コントリビューターガイド