File tree Expand file tree Collapse file tree 1 file changed +46
-6
lines changed Expand file tree Collapse file tree 1 file changed +46
-6
lines changed Original file line number Diff line number Diff line change 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+ ```
You can’t perform that action at this time.
0 commit comments