Support tsconfig.json paths and baseUrl automatically
See original GitHub issueIt would be cool if the plugin could automatically detect tsconfig.json to see which first party imports you have, such as web/components/foo
. Then those could be moved into the “absolute imports” group, instead of ending up in the (third party) “packages” group.
One idea is to use https://github.com/dividab/tsconfig-paths. Need to check that it actually supports baseUrl, though.
Another idea is to try to require("typescript")
. If it’s there, use it to resolve the config.
The initial idea comes from: https://github.com/lydell/eslint-plugin-simple-import-sort/issues/18#issuecomment-532097832
Edit: This is a light-weight package that can do the hard work for us: https://github.com/privatenumber/get-tsconfig
Issue Analytics
- State:
- Created 4 years ago
- Reactions:15
- Comments:25 (13 by maintainers)
Top Results From Across the Web
TSConfig Reference - Docs on every TSConfig option
Default: The longest common path of all non-declaration input files. If composite is set, the default is instead the directory containing the tsconfig.json...
Read more >Paths and baseUrl in tsconfig.json - Medhat Dawoud
The solution is very easy, just open your tsconfig.json in your application and add 2 more properties in case you did't find them...
Read more >Angular 10 - baseUrl and paths aren't working - Stack Overflow
Essentially, I'd like to be able to do import { SomeService } from 'services/some.service' . However, no matter what I specify in my...
Read more >Typescript: How to auto import with absolute paths if baseUrl ...
In my tsconfig.json I have set a base url: "baseUrl": "src/app", I want the IDE to auto import modules as...
Read more >Typescript paths with ts-node, ts-node-dev and Jest | Medium
To achieve the non-relative import mentioned above, tsconfig.json could look like this: From the TypeScript docs: baseUrl: Specify the base directory to resolve ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yesss great idea, works perfect
and then
You can see here the config file https://github.com/reflexology/client-V2/blob/master/.eslintrc.js
Yes it does! By showing me how complex that would be, that would motivate adding the automatic tsconfig.json thing.