Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sergeyshpadyrev/eslint-plugin-beautiful-imports
ESLint plugin for sorting imports in alphabetical order by first word
https://github.com/sergeyshpadyrev/eslint-plugin-beautiful-imports
Last synced: about 2 months ago
JSON representation
ESLint plugin for sorting imports in alphabetical order by first word
- Host: GitHub
- URL: https://github.com/sergeyshpadyrev/eslint-plugin-beautiful-imports
- Owner: sergeyshpadyrev
- License: mit
- Created: 2020-08-18T13:57:41.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-30T07:07:06.000Z (about 4 years ago)
- Last Synced: 2024-07-10T15:32:26.318Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 145 KB
- Stars: 28
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# Beautiful imports
[![npm version](https://img.shields.io/npm/v/eslint-plugin-beautiful-imports)](https://badge.fury.io/js/eslint-plugin-beautiful-imports)
[![License: MIT](https://img.shields.io/npm/l/eslint-plugin-beautiful-imports)](https://opensource.org/licenses/MIT)
![test](https://github.com/sergeyshpadyrev/eslint-plugin-beautiful-imports/workflows/test/badge.svg?branch=master)This plugin sorts imports strictly in alphabetical order by first letter of import statement. It's based on [sort-imports](https://eslint.org/docs/rules/sort-imports) rule but it has a few differences.
It makes your imports look like this:
```js
import 'alice'
import 'bob'
import * as Ant from 'ant'
import * as Bear from 'bear'
import Adam from 'adam'
import { B as A, C } from 'letters'
import David from 'david'
import { E, F as H } from 'other-letters'
```**If this project has helped you out, please support us with a star** 🌟
## Installation
You need [ESLint](https://www.github.com/eslint/eslint) to be installed for this plugin to work
Then install `eslint-plugin-beautiful-imports````
npm install --save eslint-plugin-beautiful-imports
```or
```
yarn add eslint-plugin-beautiful-imports
```Add "beautiful-imports" to the plugins section
```
{"plugins": ["beautiful-imports"]}
```
Add `beautiful-imports/sort-imports` to eslint rules
## Parameters
This plugin has the following parameters:
- allowSeparatedGroups (default: false) - When true the rule checks the sorting of import declaration statements only for those that appear on consecutive lines.
In other words, a blank line or a comment line or line with any other statement after an import declaration statement will reset the sorting of import declaration statements.