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.

Is there any way around having no-multiple-empty-lines and newline-after-import together?

See original GitHub issue

I’d like to have 2 spaces between imports, but for the rest of my sources, only allow a max of 1.

        "import/newline-after-import": [
            "error",
            {
                count: 2,
            },
        ],
        "no-multiple-empty-lines": [
            "error",
            {
                max: 1,
            }
        ],

Unfortunately these get in a bit of a scuffle 😆

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
armano2commented, Feb 13, 2020

this is not an issue with rule itself but rather with your configuration no-multiple-empty-lines is configured in this case to allow only 1 line between statements but you are enforcing 2 empty lines after import, rules does not know about other rules (they are isolated) as they should be.

both of those conditions can’t be valid at same time


{
  "import/newline-after-import": ["error", { "count": 2 }],
  "no-multiple-empty-lines": ["error", { "max": 2 }]
}

or

{
  "import/newline-after-import": ["error", { "count": 1 }],
  "no-multiple-empty-lines": ["error", { "max": 1 }]
}
3reactions
flying-sheepcommented, Oct 18, 2020

highly unidiomatic

Hahaha it’s just empty lines. I don’t think I’ve ever seen a strong opinion about those before now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there any way around having no-multiple-empty-lines and ...
I'd like to have 2 spaces between imports, but for the rest of my sources, only allow a max of 1. "import/newline-after-import": [...
Read more >
Changelog - JavaScript Standard Style
This major release fully focuses on getting in sync with the wider ESLint ... Disallow any imports that come after non-import statements (import/first)...
Read more >
@thibaudcolas/eslint-plugin-cookbook - Package Manager
config: now exports only the recommended config, Prettier-compatible. There is no reason to have separate config since it no longer mandates Prettier usage....
Read more >
Eslint rule to put a new line inside import - Stack Overflow
I was looking for such a rule for both import and export declaration. As a result I've made a plugin with autofix. So...
Read more >
no-multiple-empty-lines - ESLint - Pluggable JavaScript Linter
Rule Details. This rule aims to reduce the scrolling required when reading through your code. It will warn when the maximum amount of...
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