Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newline-after-import: Proposal to add "number of newlines" option #514

Closed
sompylasar opened this issue Aug 23, 2016 · 2 comments · Fixed by #1933
Closed

newline-after-import: Proposal to add "number of newlines" option #514

sompylasar opened this issue Aug 23, 2016 · 2 comments · Fixed by #1933

Comments

@sompylasar
Copy link
Contributor

Would be useful to enforce the following style:

import 'a';
import 'b';

import Bar from 'bar';
import Baz from 'baz';


/**
 * ^^^^ 2 lines between the imports block and the rest ^^^^
 */
class Foo extends Bar {
}

@jfmengels
Copy link
Collaborator

Sounds good to me.

Currently, the rule only checks whether there is an empty line after the import/require statements. Do we want to check whether there is exactly N empty lines after the statements? I'd personally like that, and maybe by default it should only allow exactly 1 empty line.

@golopot
Copy link
Contributor

golopot commented Apr 21, 2019

The current option is {count: number}. So how about {count: number, exact: boolean}?

ljharb pushed a commit to anikethsaha/eslint-plugin-import that referenced this issue May 14, 2021
reosarevok pushed a commit to reosarevok/eslint-plugin-import that referenced this issue Sep 14, 2023
ljharb pushed a commit to anikethsaha/eslint-plugin-import that referenced this issue Sep 14, 2023
Fixes import-js#1901. Fixes import-js#514.

Co-authored-by: Anix <anik220798@gmail.com>
Co-authored-by: reosarevok <reosarevok@metabrainz.org>
reosarevok pushed a commit to reosarevok/eslint-plugin-import that referenced this issue Sep 15, 2023
@ljharb ljharb closed this as completed in 8705121 Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants