Fix Relative Imports to baseUrlAutomatically find and fix all imports in a typescript file to be relative to baseUrl defined in tsconfig.json. SponsorshipBy purchasing Coding Guidelines for React with TypeScript from any Amazon website, you will get a set of guidelines for writing a clean, maintainable, and efficient code. Also you will sponsor me, showing your appreciation for my effort in creating and mentaining this extension. Features
Benefices
UsageFrom a typescript file, using Ctrl+Shift+P (Command Palette), run the command "Fix relative imports to baseUrl defined in tsconfig.json" to fix all (selected) relative imports in it. From any view, using Ctrl+Shift+P (Command Palette), run the command "Fix in all project files the relative imports to baseUrl defined in tsconfig.json" to fix all relative imports found in the specified source folders. The default source folders is only "src" in the root folder of the project. The list of source folders can be changed in Settings in "Fix relative imports to baseUrl: the list of folders to be scanned for relative imports". To make Visual Studio Code suggests you the absolute path relative to baseUrl, you will need to set the in Preferences the "Preferences: Import Module Specifier" for both javascript and typescript to "non-relative". Exampletsconfig.json:
/home/user/prj/a/src/view/common/components/code.tss (before)
/home/user/prj/a/src/view/common/components/code.tss (after)
RequirementsThere are no special requirements. Extension Settings
Known IssuesFor the moment there are no known issues. Change LogSee Change Log here IssuesSubmit an issue if you find any bug or have any request. ContributionFork the repo and submit pull requests. |