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

Improve get-position to properly handle block comments and multi-line braces #15

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

nickyhajal
Copy link

Here's a pull request that should resolve #14 as well as #10. It also detects flow type import type definitions, and places other imports above those (so the order is external imports -> local imports -> type imports)

To do this it adds a few methods to get-position:

isComment, isTypeDefinition and isInBracketOrComment.

There's some added complexity in the main get-position function to track the context that the current line is part of (if it is within a block comment or a bracket), plus some additional logic to handle those conditions.

I think I've handled most of the edge cases but please test and let me know if it needs any further improvements!

@nickyhajal nickyhajal changed the title Types Improve get-position to properly handle block comments and multi-line braces Sep 28, 2017
@kparkov kparkov requested review from kparkov and removed request for kparkov November 26, 2018 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues with node_modules path and import placement
1 participant