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

Rule proposal: Enforce imports be placed at the top of the file #253

Closed
sindresorhus opened this issue Apr 21, 2016 · 7 comments
Closed

Comments

@sindresorhus
Copy link

Moved from jfmengels/eslint-plugin-import-order#11.

Imports are hoisted to the top anyways. So better to be explicit about it.

Should either ignore require or have an option to ignore it, as require is often used inline and is not hoisted.

@sindresorhus
Copy link
Author

Sorry, I missed the imports-first rule...

@benmosher
Copy link
Member

Do you envision this as an option on the order rule?

@benmosher
Copy link
Member

Ah, lol, right. I also forgot that one. 😅

@jfmengels jfmengels reopened this Apr 21, 2016
@benmosher
Copy link
Member

I wouldn't be opposed to moving this into order. The existing rule is sort of a half-measure version of order anyway, could deprecate and drop the next time ESLint bumps major.

@sindresorhus
Copy link
Author

I don't see how import-first is relevant to ordering though. It's just about enforcing imports at the top, in any order.

@benmosher
Copy link
Member

I was thinking that if they are most frequently used together, it might be simpler to make it a single rule.

That's fair, though. Could move the opposite direction and take the absolute-first bit out of import-first, too.

On Apr 21, 2016, at 21:17, Sindre Sorhus <notifications@git.luolix.topmailto:notifications@github.com> wrote:

I don't see how import-first is relevant to ordering though. It's just about enforcing imports at the top, in any order.

You are receiving this because you commented.
Reply to this email directly or view it on GitHubhttps://github.com//issues/253#issuecomment-213195129

@sindresorhus
Copy link
Author

Could move the opposite direction and take the absolute-first bit out of import-first, too.

👍 Agreed. It doesn't fit there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants