# import-sort-style-ct

> An import-sort style that groups and sorts by module, prioritizing React modules

Latest version **1.1.7** (published 2020-02-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install import-sort-style-ct
pnpm add import-sort-style-ct
yarn add import-sort-style-ct
bun add import-sort-style-ct
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.7 |
| Published | 2020-02-12 |
| First published | 2020-01-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Daniel Schmidt |
| Maintainers | thebuilder |

## Links

- npm: https://www.npmjs.com/package/import-sort-style-ct
- Repository: https://github.com/charlie-tango/import-sort-style-ct
- npm.io page: https://npm.io/package/import-sort-style-ct

## Dependencies (1)

- [read-pkg-up](https://npm.io/package/read-pkg-up.md) ^7.0.1

## Recent versions

- 1.1.7 (latest) — 2020-02-12
- 1.1.6 — 2020-02-01
- 1.1.5 — 2020-01-22
- 1.1.4 — 2020-01-22
- 1.1.3 — 2020-01-22
- 1.1.2 — 2020-01-22
- 1.1.1 — 2020-01-22
- 1.0.0 — 2020-01-22

## README

# import-sort-style-ct

A style for [import-sort](https://github.com/renke/import-sort) we use at
[Charlie Tango](https://www.charlietango.dk). It's based on the default module
sorting.

- React imports are placed first.
- Node.js and NPM modules are grouped without a separator.

## Installation

Add the package to the project:

```sh
yarn add prettier import sort-style-ct
```

Create the [import-sort](https://github.com/renke/import-sort) configuration, so
it uses the `ct` style. This can be done inside the `package.json`:

```json
{
  "importSort": {
    ".js, .jsx, .ts, .tsx": {
      "style": "ct",
      "parser": "typescript"
    }
  }
}
```

Install
[prettier-plugin-import-sort](https://github.com/ggascoigne/prettier-plugin-import-sort),
and Prettier will ensure the imports are sorted whenever it runs on a file.

```sh
yarn add prettier prettier-plugin-import-sort
```

### Example sorting

```js
// Absolute modules with side effects (not sorted because order may matter)
import 'a';
import 'c';
import 'b';

// Relative modules with side effects (not sorted because order may matter)
import './a';
import './c';
import './b';

// React modules, pulled up from other node modules
import React from 'react';
import ReactDOM from 'react-dom';
import propTypes from 'prop-types';
// Modules from the Node.js "standard" library sorted by name
import { readFile, writeFile } from 'fs';
import * as path from 'path';
// Third-party modules sorted by name
import aa from 'aa';
import bb from 'bb';
import cc from 'cc';

// First-party modules sorted by "relative depth" and then by name
import aaa from '../../aaa';
import bbb from '../../bbb';
import aaaa from '../aaaa';
import bbbb from '../bbbb';
import aaaaa from './aaaaa';
import bbbbb from './bbbbb';
```

---
_Source: https://npm.io/package/import-sort-style-ct · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
