Skip to content

Commit 6f7ceb8

Browse files
author
Adam Drago
committed
docs: Add explanation and example to README
1 parent 677498b commit 6f7ceb8

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
11
# import-sort-style-atdrago
22

33
Adam's personal style for [import-sort](https://github.com/renke/import-sort).
4+
5+
Sorts imports with side effects first, then node modules, installed modules, absolute modules, and finally relative modules. Everything is sorted alphabetically (unicode), and relative modules are sorted from farthest to closest (i.e., number of dots), and then alphabetically.
6+
7+
Example:
8+
9+
```ts
10+
// Modules with side effects
11+
import 'some-module-with-side-effects';
12+
13+
// Node modules
14+
import { Server } from 'http';
15+
16+
// Installed modules
17+
import { Express } from 'express';
18+
import winston from 'winston';
19+
20+
// Absolute modules
21+
import Process from 'lib/Process';
22+
import { getEnv } from 'utils/getEnv';
23+
24+
// Relative modules
25+
import configureExpress from './configureExpress';
26+
import configureKafka from './configureKafka';
27+
import configureLogging from './configureLogging';
28+
import configureMetrics from './configureMetrics';
29+
import configureMongoose from './configureMongoose';
30+
```

0 commit comments

Comments
 (0)