eslint: "space-before-blocks" not working correctly

Tell us about your environment

  • ESLint Version: v7.6.0 (Currently used)
  • Node Version: v12.16.2
  • npm Version: v6.14.4

What parser (default, Babel-ESLint, etc.) are you using? @typescript-eslint/parser

Please show your full configuration:

Configuration
"space-before-blocks": [
      "error",
      "always"
    ],

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

cacheSkillRights(skillId: string, skillRights: SkillRights): void{
    this.skillRightsCache[skillId] = cloneDeep(skillRights);
  }

What did you expect to happen? Eslint raise ‘space-before-blocks’ error as there are no space after void and before ‘{’

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

Are you willing to submit a pull request to fix this bug? No

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 16 (12 by maintainers)

Commits related to this issue

Most upvoted comments

This isn’t technically a bug, the rule works fine with JS code.

Core rules may or may not work well with TS code. Most of the rules work perfectly well, those that have some complex issues with TS code are usually extended in the typescript plugin.

The idea here is to just slightly change the logic where it doesn’t affect JS code and in a way that doesn’t look unreasonable for JS code, but will make the rule work well with TS code. We used to make such small changes before.