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

Update: add allowSeparatedGroups option to sort-imports (fixes #12951) #13455

Merged
merged 1 commit into from Jul 7, 2020

Conversation

mdjermanovic
Copy link
Member

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[X] Changes an existing rule

fixes #12951

What changes did you make? (Give an overview)

Added allowSeparatedGroups option to the sort-imports rule.

Examples of correct code for this rule with the { "allowSeparatedGroups": true } option:

/*eslint sort-imports: ["error", { "allowSeparatedGroups": true }]*/

import b from 'foo.js';
import c from 'bar.js';

import a from 'baz.js';
/*eslint sort-imports: ["error", { "allowSeparatedGroups": true }]*/

import b from 'foo.js';
import c from 'bar.js';
// comment
import a from 'baz.js';
/*eslint sort-imports: ["error", { "allowSeparatedGroups": true }]*/

import b from 'foo.js';
import c from 'bar.js';
quux();
import a from 'baz.js';

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

@mdjermanovic mdjermanovic added enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion labels Jul 3, 2020
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@nzakas nzakas merged commit 0af1d28 into master Jul 7, 2020
@nzakas nzakas deleted the issue12951 branch July 7, 2020 20:26
@joshuapinter
Copy link

So funny. Was trying to set this option and got the following error:

Error: .eslintrc.json:
	Configuration for rule "sort-imports" is invalid:
	Value {"allowSeparatedGroups":true,"ignoreCase":true,"ignoreDeclarationSort":false,"ignoreMemberSort":false} should NOT have additional properties.

Only to search around a bit and find this:

image

I love it when things you want show up just in time.

For those wondering, this landed in version 7.5.0.

Cheers! 🙏

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jan 4, 2021
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jan 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[sort-imports] Allow the users to group their imports in a simple way
4 participants