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.

Option to tolerate single lines with padded blocks

See original GitHub issue

What rule do you want to change?

“padded-blocks”

Does this change cause the rule to produce more or fewer warnings?

fewer

How will the change be implemented? (New option, new default behavior, etc.)?

New option. Could be similar to { "allExcept": ["singleLine"] } in JSCS (http://jscs.info/rule/requirePaddingNewLinesAfterBlocks)

Please provide some example code that this change will affect:

if (cond) { doSomething(); }

What does the rule currently do for this code?

Warning / Error: “Block must be padded by blank lines.”

What will the rule do after it’s changed?

Emits no warning if using { "allExcept": ["singleLine"] } option

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:31 (25 by maintainers)

github_iconTop GitHub Comments

6reactions
not-an-aardvarkcommented, Nov 6, 2016

This seems like a good idea, but I don’t think allExcept: ["singleLine"] is a good API for it. An array containing a single string seems like an inelegant API to me; I think it would be better to have explicit object options instead.

How about something like this?

rules:
  padded-blocks: [error, always, {allowSingleLineBlocks: true}]
4reactions
ilyavolodincommented, Feb 23, 2017

I know this has been accepted a while back, but I have a new proposal for this. How about deprecating existing blocks, classes and switches options, and adding exceptions option of type Array, that accepts ASTNode|"single"|"block"? That should cover all JSCS cases, and bring this rule inline with other rules we have.

Read more comments on GitHub >

github_iconTop Results From Across the Web

padded-blocks - ESLint - Pluggable JavaScript Linter
This rule enforces consistent empty line padding within blocks. Options. This rule has two options, the first one can be a string option...
Read more >
padded-blocks rule - add a multi-line option to this rule #7775
What rule do you want to change? padded-blocks Does this change cause the rule ... Option to tolerate single lines with padded blocks...
Read more >
what is the name of the eslint rule to prevent empty lines after ...
The rule is "padded-blocks" and not "padding-line-between-statements". More info : https://eslint.org/docs/rules/padded-blocks.
Read more >
require or disallow an empty line between class members ...
This rule improves readability by enforcing lines between class members. It will not check empty lines before the first member and after the...
Read more >
Structural Foam Blocks: 7 Examples on When to Use them
By placing polystyrene below the roadway, frost is unable to penetrate and freeze the subgrade, and the foam blocks stay locked in place....
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