Option to tolerate single lines with padded blocks
See original GitHub issueWhat 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:
- Created 7 years ago
- Reactions:6
- Comments:31 (25 by maintainers)
Top 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 >
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 Free
Top 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
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?
I know this has been accepted a while back, but I have a new proposal for this. How about deprecating existing
blocks
,classes
andswitches
options, and addingexceptions
option of type Array, that acceptsASTNode|"single"|"block"
? That should cover all JSCS cases, and bring this rule inline with other rules we have.