question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"lines-around-comment" and "padded-blocks" will be conflict

See original GitHub issue

What version of ESLint are you using? 2.13.0

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

Please show your full configuration:

{
    "root": true,
    "extends": "airbnb",
    "env": {
        "browser": true,
        "node": true
    },
    "rules": {
        "lines-around-comment": [2, { "beforeBlockComment": true, "beforeLineComment": true }],
        "padded-blocks": [2, "never"]
    }
}

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

if (!accountInfo) {

    // xxxxxxx
    console.log('xxx');
}

What actually happened? Please include the actual, raw output from ESLint. if i add the blank line before the comment, eslint show padded-blocks Block must not be padded by blank lines. but if i remove it, eslint show lines-around-comment Expected line before comment

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
mysticateacommented, Jun 25, 2016

Personally, I’d like lines-around-comment to ignore comments at the head of a block and the last of a block. The behavior is same as newline-after-var and newline-before-return.

Specifically, if the previous token of a comment is an open brace, the rule don’t check lines followed by the comment. And if the next token of a comment is a close brace, the rule don’t check lines preceded by the comment. Those are checked by padded-block.

1reaction
kaicataldocommented, Jan 8, 2017

I’m going to close this as I believe this is covered by lines-around-comment’s allowBlockStart and allowBlockEnd options and there hasn’t been any activity in quite a long time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Eslint configuration for padded-blocks and lines-around ...
Issues related to the rules "lines-around-comment" and "padded-blocks" conflicting with each other should be settled by now.
Read more >
PR Rejection Reasons -- Hexo and ESLint Case Studies
project pr_id user URL Sentiment Reas... eslint/eslint 13251 revelt https://github.com/eslint/eslint/pull/13251 Neutral Close... eslint/eslint 13213 aladdin‑add https://github.com/eslint/eslint/pull/13213 Positive PR c... eslint/eslint 13150 rajat1saxena https://github.com/eslint/eslint/pull/13150 Positive PR c......
Read more >
Code Issues - Embold Help Center
When a system is expected to behave in a certain way and it fails to meet the result, the issue occurs. Similarly, any...
Read more >
fluid-eslint | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
node_modules/eslint/CHANGELOG.md · master - PLMlab
dd1e9f4 Fix: revert changes to key-spacing due to regression (#12598) ... a23d197 New: add allowSingleLineBlocks opt. to padded-blocks rule ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found