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.

Rule option proposal: multi-case for padding-line-between-statements

See original GitHub issue

The version of ESLint you are using. 5.10.0

The problem you want to solve.

Currently, the rule padding-line-between-statements can’t tell the difference between case and multi-case (stacked empty case statements that fall through to the next case block).

For example, if you take the following snippet through ESLint:

switch ( current_argv ) {

  case "-v":
  case "--version":
    console.log( 5 );
    break;

}

No matter what configuration I use, I can’t seem to get padding-line-between-statements to require a newline before and after case blocks, but never between case statements in a multi-case block (above).

Your take on the correct solution to problem.

A new STATEMENT_TYPE called multi-case to account for this:

{
  "rules": {
    "padding-line-between-statements": [ "error",
        { "blankLine": "always", "prev": "*", "next": "multi-case" },
        { "blankLine": "never", "prev": "multi-case", "next": "case" },
    ],
  }
}

Are you willing to submit a pull request to implement this change?

Haven’t hacked on ESLint before, but over the coming weekend, I’ll check to see if I can do this. If I can, and no ones implemented it by then, I’ll give it a go 😄

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
platinumazurecommented, Dec 23, 2018

@futagoza I would have loved that as well, but our process for accepting rule change proposals requires 1 team member to champion the proposal and 3 other team members to 👍 it, and none of that had happened before my previous comment.

I’ll try to work with the team to get this in before the next release.

1reaction
platinumazurecommented, Dec 22, 2018

Hi @futagoza, looks like this slipped through the cracks. Sorry about that!

I’ll support this proposal.

Read more comments on GitHub >

github_iconTop Results From Across the Web

padding-line-between-statements - Pluggable JavaScript Linter
This rule requires or disallows blank lines between the given 2 kinds of statements. Properly blank lines help developers to understand the code....
Read more >
padding-line-between-statements | typescript-eslint
This rule extends the base eslint/padding-line-between-statements rule. It adds support for TypeScript constructs such as interface and type .
Read more >
CUDA C++ Best Practices Guide
This Best Practices Guide is a manual to help developers obtain the best performance from NVIDIA ® CUDA ® GPUs. It presents established...
Read more >
RFC 3550: RTP: A Transport Protocol for Real-Time Applications
RFC 3550 RTP July 2003 2.1 Simple Multicast Audio Conference A working group of ... Many of these rules make use of the...
Read more >
Troubleshoot Common L2L and Remote Access IPsec VPN ...
Cisco ASA 5500 Series Security Appliance. Cisco PIX 500 Series Security Appliance. Cisco IOS. The information in this document was created from the...
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