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

Add importOrderCaseInsensitive option #69

Merged
merged 1 commit into from
Aug 26, 2021

Conversation

timiles
Copy link
Contributor

@timiles timiles commented Aug 8, 2021

Case-insensitive option for ordering imports.

Example problem: with no import order specified, importing siblings "ThingsList" and "ThingView". I would like for them to listed in that order, as "s" comes before "V". But due to case sensitivity, upper case "V" actually comes before lower case "s", so we get:

import ThingView from './ThingView';
import ThingsList from './ThingsList';

This PR gives me the option to have:

import ThingsList from './ThingsList';
import ThingView from './ThingView';

@timiles timiles mentioned this pull request Aug 8, 2021
@timiles timiles force-pushed the import-order-case-insensitive branch 2 times, most recently from 0752fbb to 79aa2b6 Compare August 12, 2021 13:19
@ayusharma
Copy link
Collaborator

HI @timiles , Thank you so much for the PR 🎉. We will include these changes in the new major release.

@ayusharma ayusharma added the v3 label Aug 17, 2021
@ayusharma ayusharma requested review from byara and ayusharma and removed request for byara August 17, 2021 12:17
@ayusharma ayusharma changed the base branch from master to v3.x August 17, 2021 14:37
@@ -25,7 +25,10 @@ export const getSortedNodes = (
nodes: ImportDeclaration[],
order: PrettierOptions['importOrder'],
importOrderSeparation: boolean,
importOrderCaseInsensitive: boolean,
Copy link
Collaborator

Choose a reason for hiding this comment

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

As this function receives four arguments now, it would be better to convert arguments to an object.

export const getSortedNodes = ({
      nodes: ImportDeclaration[],
      order: PrettierOptions['importOrder'],
      importOrderSeparation: boolean,
      importOrderCaseInsensitive: boolean}
    ) => {}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can make this change next chance I get, it would also help fix the failing tests too (sorry, I thought they all passed before I pushed!)

@ayusharma
Copy link
Collaborator

@timiles there are some failing tests. Just a minor change to fix.

@timiles timiles force-pushed the import-order-case-insensitive branch from 79aa2b6 to c121c87 Compare August 18, 2021 16:34
@timiles
Copy link
Contributor Author

timiles commented Aug 18, 2021

@ayusharma tests are fixed 👍

@ayusharma ayusharma merged commit ffad4bd into trivago:v3.x Aug 26, 2021
@ayusharma
Copy link
Collaborator

Hi @timiles , Thank you so much for your PR. Please respond to the notification here. #118

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

Successfully merging this pull request may close these issues.

2 participants