Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Dec 28, 2020

Conversation

nicolo-ribaudo
Copy link
Member

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

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 <kai@kaicataldo.com>
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
@babel-bot
Copy link
Collaborator

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

);
}
/* falls through */

default:
Copy link
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
Copy link

codesandbox-ci bot commented Dec 5, 2020

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
Contributor

Does this mean users can optionally enable new syntax?

@nicolo-ribaudo
Copy link
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