One feature of VSCode is its editor capability to organize and clean imports in javascript and typescript files upon saving ( "source.organizeImports": true
).
Inquiry
Is there a way to trigger this action on a file using the command line?
Something along the lines of:
tslint --fix [apply ordered-imports rule] file1 file2
However, it appears that tslint has its own implementation for "ordered-imports."
My Research Findings
From what I have gathered, this functionality initiates a call to the organizeImports
function within typescript's codebase.
This function is part of TypeScript's Language Service, but I am unsure how to initiate a language service daemon and engage with it.
Considering the code within this function, there may be a method to call it synchronously from a TypeScript script, but I am yet to come across an example illustrating how to configure the objects and variables needed to utilize this function effectively.