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

Update ordered-imports rule: add default grouping #3138

Merged
merged 1 commit into from Sep 8, 2017

Conversation

eriktim
Copy link
Contributor

@eriktim eriktim commented Aug 17, 2017

PR checklist

  • Addresses an existing issue: #0000
  • New feature, bugfix, or enhancement
    • Includes tests
  • Documentation update

Overview of change:

Added an extra options to ordered-imports to enforce grouping by libraries, parent directories & the current directory.

Is there anything you'd like reviewers to focus on?

Should the grouping fix clear the sorting fixes?

CHANGELOG.md entry:

[new-rule-option] "grouped-imports" for ordered-imports rule

@eriktim eriktim mentioned this pull request Aug 17, 2017
4 tasks
@eriktim
Copy link
Contributor Author

eriktim commented Sep 8, 2017

@adidahiya @ajafff what's the status on this?

@@ -372,6 +498,11 @@ function removeQuotes(value: string): string {
return value;
}

function getSortedImportDeclarationsAsText(importDeclarations: ImportDeclaration[]): string {
const sortedDeclarations = sortByKey(importDeclarations.slice(), (x) => x.sourcePath);
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to pass a slice. The function creates a new array anyway

@adidahiya adidahiya merged commit 9d4e445 into palantir:master Sep 8, 2017
@dirkluijk
Copy link

Love it, thanks.

HyphnKnight pushed a commit to HyphnKnight/tslint that referenced this pull request Apr 9, 2018
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.

None yet

4 participants