Skip to content

keyword-spacing else ghost default #12369

@LJNeon

Description

@LJNeon

Tell us about your environment

  • ESLint Version: 6.5.1
  • Node Version: 10.16.3
  • npm Version: 6.9.0

What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:

Configuration
rules: {
  keyword-spacing: ["error", {
    before: false,
    after: true,
    overrides: {
      else: {after: false},
      if: {after: false}
    }
  }],
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

if(false) {
  console.info("will not log");
}else{
  console.info("will log");
}
eslint index.js

What did you expect to happen?
before: false should set it so every keyword requires no spacing before it, as no overrides set it to true.

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

/path/to/my/file/index.js
  3:2  error  Expected space(s) before "else"  keyword-spacing

Although the before property appears to work on every other keyword added to the overrides I've tried (if, for example, works fine using the above config), else for some reason sets it to true. Explicitly setting before: false in the else override appears to be a temporary solution to this bug.

Are you willing to submit a pull request to fix this bug?
I am unsure of how it would be fixed, but I would be willing to submit a PR if I did.

Metadata

Metadata

Assignees

No one assigned

    Labels

    HacktoberfestRecommended issue for those participating in Hacktoberfest https://hacktoberfest.digitalocean.com/acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlyhelp wantedThe team would welcome a contribution from the community for this issueruleRelates to ESLint's core rules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions