formatjs / formatjs-old

The monorepo home to all of the FormatJS related libraries.
https://formatjs.io/
156 stars 53 forks source link

Special characters in select keys throw in 3.0.0, was fine in 2.1.x and before #164

Closed jcestibariz closed 5 years ago

jcestibariz commented 5 years ago

Which package? intl-messageformat-parser

Describe the bug If a key in a select block contains special characters, like - or /, parse throws SyntaxError: Expected argName but "/" found.

To Reproduce Steps to reproduce the behavior:

  1. Run this in node:
    const parser = require('intl-messageformat-parser');
    parser.parse('{x, select, /a-key {Result}}');
  2. With intl-messageformat-parser@2.1.3 and below it passes
  3. With intl-messageformat-parser@3.0.0 and above it fails

Expected behavior The message should be parsed without errors.

longlho commented 5 years ago

Yeah this is intentional since our parser behaves more closely with ICU messageformat spec now (which excludes special char from placeholder)