"lines-around-comment" and "padded-blocks" will be conflict
See original GitHub issueWhat 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:
- Created 7 years ago
- Reactions:1
- Comments:8 (7 by maintainers)
Top 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 >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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 asnewline-after-var
andnewline-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
.I’m going to close this as I believe this is covered by
lines-around-comment
’sallowBlockStart
andallowBlockEnd
options and there hasn’t been any activity in quite a long time.