beautifier/js-beautify

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

Ouverte

#2 141 ouverte le 17 mars 2023

 (9 commentaires) (0 réaction) (0 personne assignée)JavaScript (1 460 forks)batch import
good first issuelanguage: javascripttype: bug

Métriques du dépôt

Stars
 (8 342 étoiles)
Métriques de merge PR
 (Merge moyen 51j 1h) (16 PRs mergées en 30 j)

Description

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,
}

Guide contributeur