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

Fix: no-extra-parens export default sequence expression false positive #13096

Merged
merged 1 commit into from Apr 6, 2020

Conversation

mdjermanovic
Copy link
Member

Prerequisites checklist

  • I have read the contributing guidelines.
  • The team has reached consensus on the changes proposed in this pull request. If not, I understand that the evaluation process will begin with this pull request and won't be merged until the team has reached consensus.

What is the purpose of this pull request? (put an "X" next to an item)

[X] Bug fix

Tell us about your environment

  • ESLint Version: v7.0.0-alpha.2
  • Node Version: v12.14.0
  • npm Version: v6.13.4

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

Configuration
module.exports = {
    parserOptions: {
        ecmaVersion: 2015,
        sourceType: "module"
    }
};

What did you do? Please include the actual source code causing the issue.

Online Demo Link (v6.8.0)

/* eslint no-extra-parens: "error"*/

export default (a, b);

What did you expect to happen?

No errors.

ExportDeclaration allows only HoistableDeclaration, ClassDeclaration or AssignmentExpression after export default.

a, b is neither of them, it's Expression.

What actually happened? Please include the actual, raw output from ESLint.

Autofix to:

/* eslint no-extra-parens: "error"*/

export default a, b;

Parsing error on the fixed code:

  3:17  error  Parsing error: Unexpected token ,

What changes did you make? (Give an overview)

Added precedence check for ExportDefaultDeclaration's declaration node.

Is there anything you'd like reviewers to focus on?

@mdjermanovic mdjermanovic added bug ESLint is working incorrectly rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion labels Mar 25, 2020
Copy link
Member

@yeonjuan yeonjuan left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

Copy link
Member

@kaicataldo kaicataldo left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@kaicataldo kaicataldo merged commit 301b450 into master Apr 6, 2020
@kaicataldo kaicataldo deleted the noextraparens-exportsequence branch April 6, 2020 21:18
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Oct 4, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Oct 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants