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.

Add sort-imports member sorting into a separate option

See original GitHub issue

What rule do you want to change?

sort-imports

Does this change cause the rule to produce more or fewer warnings?

Fewer

How will the change be implemented? (New option, new default behavior, etc.)?

Currently, sort-imports does two checks. One is always on, the other is optional. I would like to only use the optional part.

One part is that it checks the order of import statements. This can’t be turned off. I would like to check this using import/order, which offers more advanced features.

The part of the rule I would like to use, is the sorting of the imported members.

My proposal is to split the distinct memberSort option into a separate rule: sort-import-members.

Please provide some example code that this change will affect:

// Builtins
import { join, resolve } from 'path';

// External
import { map } from 'lodash';

What does the rule currently do for this code?

sort-imports will cause conflicts with import/order, but also make sure import members are sorted nicely.

What will the rule do after it’s changed?

sort-imports should be disabled to prevent conflicts with import/order.

sort-import-members will ensure the imported members are sorted, as sort-imports does now.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
nzakascommented, Dec 20, 2018

@remcohaszing thanks for the ping. Sorry, a lot of team members are taking time off around this time of year, so things can take a bit longer than usual. It looks like enough team members support this change so I’m marking as accepted. The next step is to review the PR.

0reactions
remcohaszingcommented, Dec 20, 2018

Is any action required from me? I thought not, but it’s taking much longer to get merged than I expected.

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 the ... We can also add a few options to ignore letter cases....
Read more >
sort-imports - Visual Studio Marketplace
sort-imports. Sort ES6 imports for JavaScript and TypeScript automatically. Ported from the atom-import-sort package by Renke Grunwald.
Read more >
VS-Code: How to sort imports in specific order to go along with ...
Use the prettier plugin prettier-plugin-import-sort. This plugin needs you to add an order style of your choice with it.
Read more >
How to Sort Imports in React Project - Level Up Coding
I am using VS Code to develop a react project. I have installed the prettier and eslint plugins of VS Code, which will...
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