Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

ordered-imports: don't remove linebreaks if text contains non-whitespace characters #4583

Merged
merged 2 commits into from
Mar 22, 2019

Conversation

lukeautry
Copy link
Contributor

@lukeautry lukeautry commented Mar 18, 2019

PR checklist

Overview of change:

Existing replacement code deletes lines around import declarations if they contain any line break. This means it deletes actual code in the case where a fragment of text has both line breaks and characters.

An ideal fix would be to keep the (previously deleted) code as close to the import it depends on...assuming it depends on an import at all. Of course, this ramps up the complexity, because any given line of code could use a combination of imports.

This fix results in the code just appearing below the import blocks in the order they were processed.

CHANGELOG.md entry:

[bugfix] fix linebreak handling in ordered-imports

@palantirtech
Copy link
Member

Thanks for your interest in palantir/tslint, @lukeautry! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@lukeautry lukeautry changed the title ordered-imports: don't remove text containers linebreaks and text ordered-imports: don't remove linebreaks if text contains non-whitespace characters Mar 18, 2019
Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM until options 1 or 2 from the linked issue can be worked on. /cc @adidahiya

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

Successfully merging this pull request may close these issues.

4 participants