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

block-spacing errors on multi line blocks #8743

Closed
ben-page opened this issue Jun 15, 2017 · 1 comment
Closed

block-spacing errors on multi line blocks #8743

ben-page opened this issue Jun 15, 2017 · 1 comment
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 documentation Relates to ESLint's documentation rule Relates to ESLint's core rules

Comments

@ben-page
Copy link

Tell us about your environment

  • ESLint Version: 4.0.0
  • Node Version: 8.1.2
  • npm Version: 4.6.1

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

Please show your full configuration:

.eslintrc.js

module.exports = {
    'parserOptions': {
        'ecmaVersion': 2017
    },
    'env': {
        'node': true,
        'es6': true
    },
    'root': true,
    'extends': 'eslint:recommended',
    'rules': {
        'block-spacing': 'error',
		
        //turn off other rules to make output clean
        'max-statements-per-line': 'off',
        'no-unused-vars': 'off'
    }
};

What did you do? Please include the actual source code causing the issue.
The docs describe the block-spacing rule as "Disallow or enforce spaces inside of single line blocks". However, the rule is not limited to single line blocks. It is applied multi line blocks as well.

For example, both functions below trigger the block-spacing rule.

'use strict';
function test() {let i = 0;
    return i;
}

function test2() {//comment
    return 0;
}

What did you expect to happen?
no errors from block-spacing rule

What actually happened? Please include the actual, raw output from ESLint.
2:17 error Requires a space after '{' block-spacing
6:18 error Requires a space after '{' block-spacing

✖ 2 problems (2 errors, 0 warnings)
2 errors, 0 warnings potentially fixable with the --fix option.

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jun 15, 2017
@platinumazure
Copy link
Member

This is a documentation problem. Instead of saying single-line blocks, it should say between an open block token and the next token on the same line (or close block token and previous token on the same line).

@platinumazure platinumazure added accepted There is consensus among the team that this change meets the criteria for inclusion documentation Relates to ESLint's documentation rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Jun 15, 2017
VictorHom added a commit to VictorHom/eslint that referenced this issue Oct 1, 2017
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Apr 10, 2018
@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 Apr 10, 2018
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 documentation Relates to ESLint's documentation rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

3 participants