Skip to content

Style for import-sort which is compatible with eslint-plugin-import's import/first rule with absolute-first option

License

Notifications You must be signed in to change notification settings

instaatze/import-sort-style-absolute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

import-sort-style-absolute

Style for the import-sort package which is compatible with eslint-plugin-import's import/first rule with absolute-first option, thus making it compatible with the StandardJS and Airbnb configs. The remaining order is based on the default eslint sort-imports order.

npm npm MIT licensed

Install

Install with npm install import-sort-style-absolute --save-dev

Use with

"importSort": {
    ".js, .jsx, .es6, .es": {
      "parser": "babylon",
      "style": "absolute"
    }
}

in your package.json.

Order

Sorts imports as follows:

ABSOLUTE

NONE

  • import 'foo'

ALL

  • import * as _ from 'bar'
  • import * as Foo from 'bar'
  • import * as foo from 'bar'
  • import _, * as bar from 'baz'
  • import Foo, * as bar from 'baz'
  • import foo, * as bar from 'baz'

MULTIPLE

  • import _, { bar, … } from 'baz'
  • import Foo, { bar, … } from 'baz'
  • import foo, { bar, … } from 'baz'
  • import { _, bar, … } from 'baz'
  • import { Foo, bar, … } from 'baz'
  • import { foo, bar, … } from 'baz'

SINGLE

  • import _ from 'bar'
  • import Foo from 'bar'
  • import foo from 'bar'
BLANK LINE

RELATIVE

NONE

  • import './foo'

ALL

  • import * as _ from './bar'
  • import * as Foo from './bar'
  • import * as foo from './bar'
  • import _, * as bar from './baz'
  • import Foo, * as bar from './baz'
  • import foo, * as bar from './baz'

MULTIPLE

  • import _, { bar, … } from './baz'
  • import Foo, { bar, … } from './baz'
  • import foo, { bar, … } from './baz'
  • import { _, bar, … } from './baz'
  • import { Foo, bar, … } from './baz'
  • import { foo, bar, … } from './baz'

SINGLE

  • import _ from './bar'
  • import Foo from './bar'
  • import foo from './bar'
BLANK LINE

Related

License

MIT © 2017 Alexander Bast

Enjoy!

Releases

No releases published

Packages

No packages published