@4c/import-sort

4.3.6 • Public • Published

@4c/import-sort

An import-sort style config and custom parser for Javascript and Typescript (using babel).

Install

yarn add -D @4c/import-sort

Configuration

In a package.json:

{
  "importSort": {
    ".js": {
      "parser": "@4c/import-sort/parser",
      "style": "@4c/import-sort"
    },
    ".ts, .tsx": {
      "parser": "@4c/import-sort/parser-ts",
      "style": "@4c/import-sort"
    }
  }
}

Style

Imports are sorted into three groups: third party code, local code, styles and assets

import fs from 'fs'; // Node core modules first
import pick from 'lodash/pick'; // third party deps
import Env from '@4c/env'; // scoped

import Foo from '../Foo'; // local, in shared.
import Bar from './Bar';
import Baz from './Baz';

import styles from 'styles.scss'; // style imports

/@4c/import-sort/

    Package Sidebar

    Install

    npm i @4c/import-sort

    Weekly Downloads

    2

    Version

    4.3.6

    License

    MIT

    Unpacked Size

    22.4 kB

    Total Files

    13

    Last publish

    Collaborators

    • stephen_liu
    • monastic.panic
    • sloria