How to get tslint.config based formatting in VSCode. I tried some extensions and it warns me about code quality, but not format/beautify my code on save
Tslint.config formatting/beautification in VS code
Asked Answered
To format/beautify your code, you might want to use prettier: marketplace.visualstudio.com/… –
Aretta
There is a config option for vscode-tslint tslint.autoFixOnSave
, which will run the fixes for any rules that have fixes.
As suggested above prettier would be a better solution for formatting your code. You'll want to use tslint-config-prettier, to avoid conflicts between them. Allowing prettier to do formatting, and tslint to do any other fixes.
I'm not convinced prettier is better but this is the right answer regardless –
Crime
I don't think this is the right answer. Prettier is not doing anything useful unless unless you want to commit to the style prettier prefers. –
Strident
Is there any CLI command for same as prettier has one for formatting if I've missed auto save on my hundred of files till now –
Chloride
I managed to get it working with tslint for TS and beautify for HTML.
-settings.json file:
add: "editor.formatOnSave": true,
do not have "editor.defaultFormatter"
set. In fact just comment it out.
Then open User Settings -> search for "html format enable". You must uncheck the checkbox.
After that both worked for me on save
© 2022 - 2024 — McMap. All rights reserved.