Change import sort order
Closed this issue · 0 comments
gustaveen commented
I don't like the default sort order of the sort-import plugin. I'd prefer the order we have in current repos. Tried to find if we can change setting for the sort-imports extension but couldn't find how you could specify the order. I would love to have this order:
// 1. node "builtin" modules
import fs from 'fs';
import path from 'path';
// 2. "external" modules
import _ from 'lodash';
import chalk from 'chalk';
// 3. "internal" modules
// (if you have configured your path or webpack to handle your internal paths differently)
import foo from 'src/foo';
// 4. modules from a "parent" directory
import foo from '../foo';
import qux from '../../foo/qux';
// 5. "sibling" modules from the same or a sibling's directory
import bar from './bar';
import baz from './bar/baz';
// 6. "index" of the current directory
import main from './';
// 7. "object"-imports (only available in TypeScript)
import log = console.log;
// 8. "type" imports (only available in Flow and TypeScript)
import type { Foo } from 'foo';
If we can't modify it I'd like to use the import/order
eslint plugin instead https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md