Closed bigandy closed 2 years ago
Hi @bigandy
I can investigate the first option but I'm not sure the second would be possible. I don't remember any extension that allows formatting all the files in a workspace. For that, it would be better to use a npm-script. Something like the approach described in this article using ESLint: https://simondosda.github.io/posts/2021-05-10-eslint-imports.html
Thanks for making this extension, it's awesome. I was able to get it to run on save with https://marketplace.visualstudio.com/items?itemName=fsevenm.run-it-on That being said, it always modifies the file, so it always results in an unsaved file. Is there any way to have this extension do nothing if the imports are already correct?
hey! Thanks for this extension. Upping this topic as it would be great to add it on save. I don't know if it's still in the works. Thanks!
Hi @Kowaio
Yes, it would be a great feature, but in my opinion, only for the active editor (current edited file). Sadly, I don't have too much time to investigate and develop this at the moment, so any help with this would be appreciated. I'm keeping the issue open and tagging it with Help wanted.
Thank you all for using it and the suggestions.
Hello everyone,
Finally, I got some time to develop this feature. It is available in version 1.2.0 via Code Actions.
To enable it (in your VS Code settings):
"editor.codeActionsOnSave": {
"source.removeUnusedImports": true
}
I hope this helps :) Please, leave the extension a rating if you find it useful. It is still unrated.
Hey! Thanks a lot for your work. I'm having a weird message in my vscode project and this does not seem to work because of that :
[BABEL] unknown: Preset your preset requires a filename to be set when babel is called directly,
babel.transform(code, { filename: 'file.ts', presets: [/* your preset */] });
See https://babeljs.io/docs/en/options#filename for more information.
Any ideas? Am i missing something here?
Hey! Thanks a lot for your work. I'm having a weird message in my vscode project and this does not seem to work because of that :
[BABEL] unknown: Preset your preset requires a filename to be set when babel is called directly, babel.transform(code, { filename: 'file.ts', presets: [/* your preset */] }); See https://babeljs.io/docs/en/options#filename for more information.
Any ideas? Am i missing something here?
Hi @Kowaio
I've created a new issue for this, as this one is closed and it doesn't seem to be related to this one. Can you please share more information here about the context in which the error happens? The file that you are editing, etc.
Thanks
I have a couple of questions: