Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-beautiful-sort

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-beautiful-sort - npm Package Compare versions

Comparing version 1.0.7 to 2.0.0

dist/index.d.ts

83

package.json
{
"name": "eslint-plugin-beautiful-sort",
"version": "1.0.7",
"description": "eslint plugin for import sort",
"main": "src/index.js",
"dependencies": {},
"devDependencies": {
"@types/eslint": "^7.2.6",
"eslint": "^7.16.0",
"jest": "^26.6.3"
},
"version": "2.0.0",
"description": "eslint plugin for imports sort by their type",
"main": "dist/index.js",
"type": "commonjs",
"author": "https://github.com/Allohamora",
"license": "MIT",
"scripts": {
"test": "jest"
"test": "jest",
"build": "rimraf dist && tsc --project tsconfig.build.json",
"prepare": "husky install",
"format": "prettier .",
"format:fix": "prettier --write .",
"release": "standard-version --tag-prefix=",
"release:minor": "standard-version --release-as minor --tag-prefix=",
"release:patch": "standard-version --release-as patch --tag-prefix=",
"release:major": "standard-version --release-as major --tag-prefix=",
"lint": "eslint \"src/**/*.ts\"",
"lint:fix": "eslint \"src/**/*.ts\" --fix",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Allohamora/eslint-plugin-beautiful-sort.git"
"devDependencies": {
"@commitlint/cli": "^16.1.0",
"@commitlint/config-conventional": "^16.0.0",
"@types/eslint": "^8.4.1",
"@types/jest": "^27.4.0",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-beautiful-sort": "^1.0.7",
"eslint-plugin-prettier": "^4.0.0",
"husky": "^7.0.4",
"jest": "^27.4.7",
"lint-staged": "^12.3.3",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"standard-version": "^9.3.2",
"ts-jest": "^27.1.3",
"typescript": "^4.5.5"
},
"keywords": [
"eslint",
"plugin",
"sort",
"import",
"import-sort"
"imports-sort",
"sort-imports"
],
"author": "https://github.com/Allohamora",
"license": "ISC",
"repository": {
"type": "git",
"url": "git+https://github.com/Allohamora/eslint-plugin-beautiful-sort.git"
},
"bugs": {
"url": "https://github.com/Allohamora/eslint-plugin-beautiful-sort/issues"
},
"homepage": "https://github.com/Allohamora/eslint-plugin-beautiful-sort#readme"
"homepage": "https://github.com/Allohamora/eslint-plugin-beautiful-sort#readme",
"files": [
"dist"
],
"engines": {
"node": "^16.13.2",
"npm": "^8.1.2"
},
"lint-staged": {
"*.{js,json,yml,md}": "prettier --write",
"*.ts": [
"eslint --fix",
"jest --findRelatedTests"
]
},
"standard-version": {
"skip": {
"tag": true
}
}
}
# eslint-plugin-beautiful-sort
eslint plugin for es6 imports sort by order like eslnt/sort-imports with fix option
eslint plugin for imports sort by their type
## Example
From
From:
```js
import './Test.css';
import {a,b,c} from 'a';
import C, {h} from 'j';
import { a, b, c } from 'a';
import C, { h } from 'j';
import A from 'g';

@@ -16,3 +16,3 @@ import * as Meme from 'meme';

```
To
To:
```js

@@ -22,13 +22,21 @@ import React from 'react'; // special

import A from 'g'; // default
import C, {h} from 'j'; // defaultObj
import {a,b,c} from 'a'; // obj
import C, { h } from 'j'; // defaultObj
import { a, b ,c } from 'a'; // obj
import './Test.css'; // none
```
## Requirements
node js: v14.15.1+
## Plugin tested on
```json
{
"node": "^16.13.2",
"npm": "^8.1.2",
"eslint": "^8.8.0"
}
```
## Usage
`npm i -D eslint-plugin-beautiful-sort`
```bash
npm i -D eslint-plugin-beautiful-sort
```

@@ -41,4 +49,4 @@ ```json

"rules": {
"beautiful-sort/import": [2, {
"special": ["react"],
"beautiful-sort/import": ["error", {
"special": ["react"],
"order": ["special", "namespace", "default", "defaultObj", "obj", "none"]

@@ -49,1 +57,17 @@ }]

```
## API
### Special
special is an array of module paths or a string regexp such as ```"/^src/utils/string$"```
### Order
order is an array of [import types](#import-type);
### Import type
import type is a string that specifies one of the following imports:
```js
import React from 'react'; // special
import * as Meme from 'meme'; // namespace
import A from 'g'; // default
import C, { h } from 'j'; // defaultObj
import { a, b ,c } from 'a'; // obj
import './Test.css'; // none
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc