npm

import-sort-style-pietile

1.2.0 • Public • Published

import-sort-style-pietile

Simple and meaningful imports order style for import-sort. Works great with JavaScript and TypeScript.

Usage

  1. Install packages:

    • import-sort: yarn add --dev import-sort
    • parser either JavaScript or _TypeScript: yarn add --dev import-sort-parser-babylon or yarn add --dev import-sort-parser-typescript
    • this style: yarn add --dev import-sort-style-pietile
  2. Setup config:

    {
      ".js, .jsx": {
        "parser": "babylon",
        "style": "pietile"
      },
      ".ts, .tsx": {
        "parser": "typescript",
        "style": "pietile"
      }
    }
  3. Sort imports either from CLI or with Editor plugin (VSCode for example)

Result

// Modules without members. Don't sort them as the order can be important.
import 'babel-polyfill';

// React module is special due to JSX requirement
import React from 'react';

// Modules from Node.js library
import { readFile, writeFile } from 'fs';
import * as path from 'path';

// Installed modules
import moment from 'moment';

// Project modules external to the current file
import Controller from '../../lib/Controller';
import RedButton from '../Buttons/RedButton';

// Project modules internal to the current file
import AwesomeComponent from './AwesomeComponent';

// Resources
import icon from './icon.png';

Why is this name?

https://mrsharpoblunto.github.io/foswig.js/

Package Sidebar

Install

npm i import-sort-style-pietile

Weekly Downloads

1,957

Version

1.2.0

License

ISC

Unpacked Size

4.92 kB

Total Files

5

Last publish

Collaborators

  • vshab