ESLint plugin to help enforce a configurable order for import statements
Add support for classifying type imports as an entirely separate group, if desired.
From the docs:
type
groupTypeScript has what are called type imports, e.g.,
import type { ImportantType } from './thing';
If you would like to treat these type imports as a completely separate group (instead of sorted according to the file it was imported from), add a type
group to your groups
list.
With the type
group:
/* eslint import-helpers/order-imports: ["error", {"groups": ['sibling', 'module', 'type']}] */
import foo from './foo';
import fs from 'fs';
import path from 'path';
import type { ImportantType } from './sibling';
Without the type
group:
/* eslint import-helpers/order-imports: ["error", {"groups": ['sibling', 'module']}] */
import foo from './foo';
import type { ImportantType } from './sibling';
import fs from 'fs';
import path from 'path';
v1.1.0 is a quick update to support ESLint 7. There shouldn't be any breaking changes.
Adds support for ESLint v6 in the peer dependency.
Fixes module
regular expression: https://github.com/Tibfib/eslint-plugin-import-helpers/issues/10
v1.0 has been released! I've cleaned up the plugin a bit, added (some) typescript definitions to the plugin, and tweaked some configuration.
The guide for migrating from v0.14 to v1 can be found in the import-rules docs: order-imports
. It should be a quick migration.
NPM: https://www.npmjs.com/package/eslint-plugin-import-helpers/v/1.0.0