Skip to content

Commit 122fc3b

Browse files
authored
Merge pull request #17 from vitonsky/12-update-readme
Update readme
2 parents 69018f0 + ca80ef3 commit 122fc3b

File tree

1 file changed

+46
-6
lines changed

1 file changed

+46
-6
lines changed

README.md

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,51 @@
1-
Short one paragraph description, which answer to question "what is this?".
1+
Eslint plugin to replace a relative imports, according to `paths` options in `tsconfig.json` or `jsconfig.json`.
22

3-
Detailed description in few paragrapghs about "for what this?" and how it works.
3+
# Setup
44

5-
# Features
5+
Install package with `npm install -D eslint-plugin-paths`, then update eslint config
66

7-
<!-- TODO: info about key features -->
7+
```json
8+
{
9+
"plugins": [
10+
"paths",
11+
],
12+
"rules": {
13+
"paths/aliases": "error"
14+
}
15+
}
16+
```
817

9-
# Usage
18+
# Examples
1019

11-
<!-- TODO: info about how it use -->
20+
If you have `tsconfig.json` with config below
21+
22+
```json
23+
{
24+
"compilerOptions": {
25+
"baseUrl": ".",
26+
"paths": {
27+
"@foo/*": ["src/foo/*"],
28+
"@bar/*": ["src/bar/*"]
29+
}
30+
}
31+
}
32+
```
33+
34+
then code below will be valid
35+
36+
```ts
37+
// src/index.ts
38+
39+
import foo from '@foo';
40+
import barZ from '@bar/x/y/z';
41+
import bazZ from './baz/x/y/z';
42+
```
43+
44+
and this code will be invalid
45+
46+
```ts
47+
// src/index.ts
48+
49+
import foo from './foo';
50+
import barZ from './bar/x/y/z';
51+
```

0 commit comments

Comments
 (0)