🔧 This rule is automatically fixable by the --fix
CLI option.
The grouping order is as follows:
- Unassigned imports (only grouped, existing order is preserved)
- Node/Bun standard modules (protocol is ignored when sorting)
- Framework modules (see below)
- External modules
- Internal modules (see below)
- Explicitly local modules (paths starting with a dot segment)
- Style imports
The framework and internal groups can be configured by passing a RegEx string to the different plugin setting. This allows the rule itself to be implemented by a shared config, while individual projects can determine what constitutes an “internal” module.
For example:
export default [
{
settings: {
// Group official React packages together.
'import-sorting/framework-patterns': /^react(\/|-dom|-router|$)/.source,
// Group aliased imports together.
'import-sorting/internal-patterns': /^~/.source,
},
rules: {
'import-sorting/order': 'error',
},
},
]