Skip to content

[babel 8] Align allow* parser options with ESLint behavior#13921

Merged
nicolo-ribaudo merged 2 commits into
babel:mainfrom
nicolo-ribaudo:allowSuperOutsideMethod-fix
Nov 4, 2021
Merged

[babel 8] Align allow* parser options with ESLint behavior#13921
nicolo-ribaudo merged 2 commits into
babel:mainfrom
nicolo-ribaudo:allowSuperOutsideMethod-fix

Conversation

@nicolo-ribaudo

@nicolo-ribaudo nicolo-ribaudo commented Nov 2, 2021

Copy link
Copy Markdown
Member
Q                       A
Fixed Issues? Fixes #13903
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link babel/website#2765
Any Dependency Changes?
License MIT
  • The @babel/eslint-parser allowImportExportEverywhere option is removed; users can pass it to babelOptions.parserOpts.
  • allowSuperOutsideMethod is disabled.
  • allowReturnOutsideFunction is inferred from ecmaFeatures.globalReturn. We already use it in other places

I added different non-babel-8 tests to validate the current behavior.

parseAndAssertSame('function F() { import a from "a"; }');
}).toThrow(
new SyntaxError(
"'import' and 'export' may only appear at the top level",

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.

This was a bad test: this error was thrown by espree, not by our parser.

@babel-bot

babel-bot commented Nov 2, 2021

Copy link
Copy Markdown
Collaborator

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

@codesandbox-ci

codesandbox-ci Bot commented Nov 2, 2021

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 3a1f251:

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

@nicolo-ribaudo
nicolo-ribaudo force-pushed the allowSuperOutsideMethod-fix branch from 07118aa to d227b9f Compare November 3, 2021 18:34
@nicolo-ribaudo

Copy link
Copy Markdown
Member Author

CI failure fixed by #13923

- The `@babel/eslint-parser` `allowImportExportEverywhere` option is removed; users can pass it to `parserOpts`
- `allowSuperOutsideMethod` is disabled
- `allowReturnOutsideFunction` is inferred from `ecmaFeatures.globalReturn`
@nicolo-ribaudo
nicolo-ribaudo force-pushed the allowSuperOutsideMethod-fix branch from d227b9f to 3a1f251 Compare November 4, 2021 00:16
@nicolo-ribaudo
nicolo-ribaudo merged commit de28707 into babel:main Nov 4, 2021
@nicolo-ribaudo
nicolo-ribaudo deleted the allowSuperOutsideMethod-fix branch November 4, 2021 06:56
@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 Feb 4, 2022
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 4, 2022
@nicolo-ribaudo nicolo-ribaudo added this to the v8.0.0 milestone Aug 8, 2023
@nicolo-ribaudo nicolo-ribaudo added PR: Breaking Change 💥 A type of pull request used for our changelog categories for next major release and removed babel 8 labels Aug 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: eslint outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Breaking Change 💥 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.

[Bug]: super() in class methods is not reported by @babel/eslint-parser

4 participants