Skip to content

[babel 8] Report a SyntaxError for } and > in JSX text#12451

Merged
nicolo-ribaudo merged 1 commit into
babel:mainfrom
nicolo-ribaudo:breaking/disallow-in-jsx
Dec 28, 2020
Merged

[babel 8] Report a SyntaxError for } and > in JSX text#12451
nicolo-ribaudo merged 1 commit into
babel:mainfrom
nicolo-ribaudo:breaking/disallow-in-jsx

Conversation

@nicolo-ribaudo

@nicolo-ribaudo nicolo-ribaudo commented Dec 5, 2020

Copy link
Copy Markdown
Member
Q                       A
Fixed Issues? Fixes #11042
Backport #11046
Patch: Bug Fix? Yes
Major: Breaking Change? Yes
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This PR is moving #11046 from babel-8-dev to main. The only change is that I made the error recoverable (just by deleting throw in front of this.raise).

cherry-pick  babel#11046

Co-Authored-By: Kai Cataldo <[email protected]>
Co-Authored-By: Nicolò Ribaudo <[email protected]>
@babel-bot

Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/34166/

}
/* falls through */

default:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make prepublish-build generates this code:

        case 62:
        case 125:

        default:

while BABEL_8_BREAKING=true make prepublish-build generates this: (with the first commit of #12447 that fixes the boolean logic in the build process)

        case 62:
        case 125:
          {
            const htmlEntity = ch === 125 ? "&rbrace;" : "&gt;";
            const char = this.input[this.state.pos];
            this.raise(this.state.pos, `Unexpected token \`${char}\`. Did you mean \`${htmlEntity}\` or \`{'${char}'}\`?`);
          }

        default:

@nicolo-ribaudo nicolo-ribaudo changed the title Report a SyntaxError for } and > in JSX text [babel 8] Report a SyntaxError for } and > in JSX text Dec 5, 2020
@codesandbox-ci

codesandbox-ci Bot commented Dec 5, 2020

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 3b3688d:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@nicolo-ribaudo nicolo-ribaudo added this to the Babel 8.0 milestone Dec 5, 2020
@nicolo-ribaudo
nicolo-ribaudo merged commit fbef603 into babel:main Dec 28, 2020
@nicolo-ribaudo
nicolo-ribaudo deleted the breaking/disallow-in-jsx branch December 28, 2020 18:04
@TrySound

Copy link
Copy Markdown
Contributor

Does this mean users can optionally enable new syntax?

@nicolo-ribaudo

Copy link
Copy Markdown
Member Author

No, at the moment we strip away the flag at build time.
Our priority now is to move things from the next-8-dev branch to main, then we'll decide if we prefer to release a beta version or to leave the flag in the released distribution.

@github-actions github-actions Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Mar 30, 2021
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 30, 2021
@nicolo-ribaudo nicolo-ribaudo added babel 8 PR: Spec Compliance (next major) 👓 A type of pull request used for our changelog categories for next major release and removed babel-8-dev → main babel 8 labels Aug 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Spec Compliance (next major) 👓 A type of pull request used for our changelog categories for next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: throw syntax error for } and > in JSX text.

7 participants