Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 790 Bytes

File metadata and controls

26 lines (20 loc) · 790 Bytes

import-sorting/order

🔧 This rule is automatically fixable by the --fix CLI option.

Enforce a convention in the order of import statements.

Settings

The framework and first-party 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 a “first-party” module.

For example:

settings: {
	// Group official React packages together.
	'import-sorting/known-framework': /^react(\/|-dom|-router|$)/.source,
	// Group aliased imports together.
	'import-sorting/known-first-party': /^~/.source,
},
rules: {
	'import-sorting/order': 'error',
},