2.2.0 • Published 6 months ago

eslint-plugin-import-sorting v2.2.0

Weekly downloads
-
License
-
Repository
github
Last release
6 months ago

eslint-plugin-import-sorting

Enforce a convention in the order of import statements, inspired by isort’s grouping style:

  1. Node standard modules
  2. Framework modules
  3. External modules
  4. Internal modules
  5. Explicitly local modules

This plugin includes an additional group for “style” imports where the import source ends in .css or other style format. Imports are sorted alphabetically, except for local modules, which are sorted by the number of . segements in the path first, then alphabetically.

Usage

Install the plugin, and ESLint if it is not already.

npm install --save-dev eslint eslint-plugin-import-sorting

Include the plugin in the plugins key of your ESLint config and enable the rules.

// eslint.config.js

import importSortingPlugin from 'eslint-plugin-import-sorting'

export default [
	{
		plugins: {
			'import-sorting': importSortingPlugin,
		},
		rules: {
			'import-sorting/order': 'error',
		},
	},
]

🔧 Automatically fixable by the --fix CLI option.

NameDescription🔧
orderConsistently order import statements.🔧
specifier-orderConsistently order named import specifiers.🔧
2.2.0

6 months ago

2.1.1

7 months ago

2.1.0

7 months ago

1.2.2

10 months ago

2.0.0

10 months ago

1.2.1

10 months ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

2 years ago

0.0.0

2 years ago