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.

padded-blocks rule - add a multi-line option to this rule

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? Potentially fewer warning depending on the situation.

How will the change be implemented? (New option, new default behavior, etc.)? Added an option to padded-blocks to specify a minimum number of lines required before the rule takes affect.

Please provide some example code that this change will affect:

Currently in JSCS, we have the rule of requirePaddingNewlinesInBlocks. The equivalent rule in seems to be padded-blocks in ESLINT. However, there is no way to specify a minimum number of lines required before the rule takes affect. So here is the problem:

Using JSCS, I can specify `“requirePaddingNewlinesInBlocks”: 1" and the following are valid for this rule:

function foo() { // valid since more than 1 line between the blocks is required to throw an error
  return bar();
}
function foo() { // valid

  dobar();
  return bar();

}

Using ESLINT with the rule "padded-blocks": [2, "always"]

function foo() { // not valid according to ESLINT
  return bar();
}
function foo() { // valid

  dobar();
  return bar();

}

What does the rule currently do for this code? The rule currently causes a linting error whenever padding is not around the blocks. So I would like to specify a rule like this:

"padded-blocks": [2, "always"]

So that we have an equivalent for the JSCS rule. Note: PolyJuice currently translate the rule as "padded-blocks": [2, "always"].

What will the rule do after it’s changed?

In the example above, the linting error for the ESLINT example will be removed.

Issue Analytics

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

github_iconTop GitHub Comments

6reactions
not-an-aardvarkcommented, Dec 15, 2016

How about minLines?

5reactions
platinumazurecommented, Dec 15, 2016

(Noting that this is related to, but hopefully not a duplicate of, #7356. I had recommended in chat that this could probably be done as an atomic proposal rather than waiting for #7356 to get moving. If anyone on the core team disagrees, I apologize for causing any confusion.)

Hi @sscaff1, thanks for the issue.

I think this behavior should definitely be behind a new option. Maybe something like this? "padded-blocks": [2, { "withMoreLinesThan": 1 }] (But please let’s find a better option name)

Read more comments on GitHub >

github_iconTop Results From Across the Web

lines-between-class-members - Pluggable JavaScript Linter
This rule has a string option and an object option. String option: "always" (default) require an empty line after class members; "never" disallows...
Read more >
Multi-line regular expression rules - SolarWinds THWACK
One area that I'm having trouble with is creating regular expressions for multiple config line items that will allow me to search for...
Read more >
Changelog - JavaScript Standard Style
When you upgrade, consider running standard --fix to automatically format your code to match the current set of rules. Changed features. Update eslint...
Read more >
tslint-eslint-rules | Yarn - Package Manager
ESLint rules for TSLint. Improve your TSLint with the missing ESLint Rules. You want to code in TypeScript but miss all the rules...
Read more >
Spark Read multiline (multiple line) CSV File
Spark CSV Data source API supports to read a multiline (records having new line character) CSV file by using spark.read.option("multiLine",
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