question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Separate named import sorting from sort-imports

See original GitHub issue

using eslint 3.11.1 I would like to enforce sorting of named imports.

I would not like to enforce sorting of imports.

Bad

import whatever from 'whatever';
import {foo, bar} from 'baz';

Good:

import whatever from 'whatever';
import {bar, foo} from 'baz;

I can currently validate the order of the named imports but only if I turn on validating the imports entirely. I would like to adjust these independently.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:7
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
not-an-aardvarkcommented, Jul 11, 2017

Thanks for your interest in improving ESLint. Unfortunately, it looks like this issue didn’t get enough support from the team and so I’m closing it. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach consensus after a long time tend to never do it, and as such, we close those issues. This doesn’t mean the idea isn’t interesting, just that it’s not something the team can commit to.

1reaction
kirkstrobeckcommented, Mar 4, 2017

sort-imports

I’d like to just sort my imports as a standard alpha sort in Sublime text.

import * as f from 'foo';
import * as g from 'foo';
import a from 'foo';
import { b, c } from 'foo';
import { d, e } from 'foo';

If I add a line of whitespace for any reason, then it would understand there are distinct alpha groupings.

import * as f from 'foo';
import { b, c } from 'foo';

import * as g from 'foo';
import a from 'foo';
import { d, e } from 'foo';

sort-imports-by-members

http://eslint.org/docs/rules/sort-imports#membersyntaxsortorder would apply.


Currently this rule makes too many assumptions by requiring type sort.


Optionally, if the rule remained as-is, then an "off" option for memberSyntaxSortOrder would be excellent as it’s siblings can be toggled.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sort-imports - ESLint - Pluggable JavaScript Linter
This rule checks all import declarations and verifies that all imports are first sorted by the used member syntax and then alphabetically by...
Read more >
How to quickly configure ESLint for import sorting
sort-imports offers a way to alphabetically organize the imports using ... We can first differentiate the groups of our imports and split ......
Read more >
Split'n'Sort Imports - Visual Studio Marketplace
Extension for Visual Studio Code - An opinionated extension to split and sort imports into one export per import.
Read more >
Use isort to sort your Python module imports automatically
The isort module will solve this problem for you! isort is a Python library to sort imports alphabetically, and automatically separated into sections...
Read more >
What's the correct way to sort Python `import x` and `from x ...
related third party imports; local application/library specific imports. However, it does not mention anything how the two different ways of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found