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.

Multiline expressions in padding-line-between-statements rule

See original GitHub issue

Tell us about your environment

  • ESLint Version: 4.9.0
  • Node Version: 6.11.3
  • npm Version: 3.10.10

What parser (default, Babel-ESLint, etc.) are you using? AirBnb Please show your full configuration:

Configuration
{
    "parserOptions": {
        "ecmaVersion": 6,
        "sourceType": "script"
    },
    "env": {
        "node": true
    },
    "extends": "airbnb-base",
    "rules": {
        "arrow-parens": ["error", "always"],
        "comma-dangle": ["error", "never"],
        "consistent-return": "off",
        "indent": ["error", 2],
        "max-len": ["error", 200],
        "no-multiple-empty-lines": ["error", {"max": 1, "maxEOF": 1}],
        "no-plusplus": "off",
        "no-underscore-dangle": ["off"],
        "no-use-before-define": ["error", { "functions": false }],
        "object-shorthand": ["off"],
        "padding-line-between-statements": ["error", 
            {"blankLine": "always", "prev": "block", "next": "*"},
            {"blankLine": "always", "prev": "function", "next": "*"},
            {"blankLine": "always", "prev": "block", "next":"*"},
            {"blankLine": "always", "prev": ["cjs-export"], "next": "*"},
            {"blankLine": "always", "prev": ["*"], "next": "cjs-export"}
        ],
        "strict": ["error", "global"]
    }
}

What did you do? Please include the actual source code causing the issue. Would it be or is it already possible to distinguish multiline from single line expressions in the padding-line-between-statements rule? For example:

Distinguish this:

someArray.forEach((x) => doSomething(x));

From this:

someArray.forEach((x) => {
  doSomething(x);
  doAnotherThing(x);
});

What did you expect to happen? I would like to be able to identify multiline expressions in order to enforce blank lines between them and certain other statements.

What actually happened? Please include the actual, raw output from ESLint. No ability to distinguish multi line expressions from single line expressions.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
aladdin-addcommented, Dec 30, 2017

great! I’ll champion this, marked as accepted.

1reaction
not-an-aardvarkcommented, Oct 29, 2017

It looks like this was also proposed in https://github.com/eslint/eslint/pull/8668 but no one on the team ended up championing the proposal. We can see if anyone is interested in supporting it this time around.

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 - Rules - ESLint
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 . How to Use​ ....
Read more >
vue/padding-line-between-tags
Rule Details #. This rule requires or disallows newlines between sibling HTML tags.
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 >

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