Skip to content

Feature: Sort imports by specifiers #560

@blakegearin

Description

@blakegearin

Describe the rule

I feel like I must be missing this somewhere in the settings or past issues. I'd like to sort my imports by specifiers (export names) instead of the paths they're coming from.

Code example

import { B } from 'y'
import { Y } from 'b'
import { b } from 'z'
import { y } from 'b'

import A from 'z.js'
import Z from 'a.js'
import a from 'y.js'
import z from 'b.js'
import type { Response, Request } from 'express'

import bodyParser from 'body-parser'
import defaultsDeep from 'lodash/defaultsDeep'
import express from 'express'
import fs from 'node:fs/promises'
import map from 'lodash/map'
import mongoose from 'mongoose'
import passport from 'passport'
import path from 'node:path'
import session from 'express-session'

import User from '~/models/User'
import authRoutes from '~/routes/auth'
import initializePassport from '~/config/passport'
import logger from '~/middleware/logger'

import dbConfig from './db'

Additional comments

No response

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions