Navigation Menu

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

Update: curly should check consequent if statements #12947

Merged
merged 1 commit into from Jun 13, 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

This bug fix produces more warnings.

Tell us about your environment

  • ESLint Version: v7.0.0-alpha.1
  • 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
    }
};

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

Demo Link (v.6.8.0)

/* eslint curly: ["error", "multi"] */

if (a)
    if (b) {
        foo();
    }

if (a)
    if (b)
        foo();
    else {
        bar();
    } 

if (a)
    if (b)
        foo();
    else if (c) {
        bar();
    }

What did you expect to happen?

3 errors.

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

No errors.

The whole chain is ignored if it happens to be in another if's consequent.

What changes did you make? (Give an overview)

Fixed the IfStatement visitor to skip only those if statements that are alternate of another if (because they were already processed as a chain), but not if statements that are consequent of another if.

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 evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Feb 21, 2020
@kaicataldo kaicataldo added the enhancement This change enhances an existing feature of ESLint label Mar 17, 2020
@kaicataldo kaicataldo added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jun 13, 2020
@kaicataldo kaicataldo merged commit 13999d2 into master Jun 13, 2020
@kaicataldo kaicataldo deleted the curly-consequentif branch June 13, 2020 00:06
@kaicataldo
Copy link
Member

LGTM, thanks!

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Dec 11, 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 Dec 11, 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 enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants