daidodo / format-imports-vscode

Format imports and exports for JavaScript and TypeScript in VS Code.
https://marketplace.visualstudio.com/items?itemName=dozerg.tsimportsorter
MIT License
62 stars 5 forks source link

Sort unassigned imports inline with assigned #97

Closed acroyear closed 1 year ago

acroyear commented 1 year ago

I may have the wrong vocabulary, but my problem is this

I have

import { useState, useEffect, useCallback, useMemo, useRef } from 'preact/hooks';
import 'ojs/ojcheckboxset';
import { ojCheckboxset } from 'ojs/ojcheckboxset';
import { ExtendGlobalProps, PropertyChanged } from 'ojs/ojvcomponent';
import { h, RenderableProps, JSX } from 'preact';

applying my groups, I get

import 'ojs/ojcheckboxset';
import { JSX, RenderableProps, h } from 'preact';
import { useCallback, useMemo } from 'preact/hooks';
import { ExtendGlobalProps, PropertyChanged } from 'ojs/ojvcomponent';
import { ojCheckboxset } from 'ojs/ojcheckboxset';

what I want is for that top item to be inline with the rest of ojs entries

import { JSX, RenderableProps, h } from 'preact';
import { useCallback, useMemo } from 'preact/hooks';
import { ExtendGlobalProps, PropertyChanged } from 'ojs/ojvcomponent';
import 'ojs/ojcheckboxset';
import { ojCheckboxset } from 'ojs/ojcheckboxset';

Is there a setting to make this possible?

acroyear commented 1 year ago

Unassigned imports are ignored, as the order they are imported in may be important.

from eslint-plugin-import/order

that's the word, Unassigned. In our case, the order doesn't matter so we'd like them inline with their assigned imports.

daidodo commented 1 year ago

Sorry for the late response!

Please refer to https://github.com/daidodo/format-imports/wiki/Grouping-Rules. I think you might need a group for all ojs imports (flags: "all"), and define its order among other groups.

acroyear commented 1 year ago

that got it (sorry, hadn't looked at that inbox in a while). thank you.