Formatting of *.ts files?
See original GitHub issue- I have searched through existing issues
Feature Request
Hi, sorry for perhaps a silly mistake on my end, but unless I’m understanding something wrong, formatting of plain .ts files is not supported at the moment (model / service .ts files)? The only way I’ve managed to make it work was to install the prettier vscode plugin, but that would then mess up the html formatting in .vue files. TS code inside .vue files which is inside <script lang="ts">
tag does get formatted without any issues.
Here’s my .vscode/settings.json
{
"editor.insertSpaces": true,
"editor.formatOnSave": true,
"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatter.ts": "prettier",
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
"wrap_attributes": "force-aligned",
"wrap_line_length": 120,
"indent_handlebars": true
},
"cSpell.words": [
"validatable"
],
"editor.tabSize": 2
},
"search.exclude": {
"package-lock.json": true
}
}
.prettierrc
{
"trailingComma": "all",
"jsxBracketSameLine": true,
"printWidth": 120,
"arrowParens": "avoid"
}
.prettierignore
.vscode/*
settings.json
tsconfig.*
tslint.json
.eslintrc.json
.editorconfig
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = double
[*.md]
max_line_length = off
trim_trailing_whitespace = false
tslint.json
{
"defaultSeverity": "warning",
"extends": [
"tslint:recommended"
],
"linterOptions": {
"exclude": [
"node_modules/**",
".vscode/**"
]
},
"rules": {
"no-empty": false,
"quotemark": [
true,
"double"
],
"indent": [
true,
"spaces",
2
],
"interface-name": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"no-consecutive-blank-lines": true,
"eofline": false,
"member-access": [
true,
"no-public"
],
"max-classes-per-file": false,
"arrow-parens": [
true,
"ban-single-arg-parens"
]
}
}
Thank you!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
TypeScript Formatter online to format TS code. - Code Beautify
TypeScript Formatter is easy to use tool to beautify TS code. Copy, Paste, and Format. What can you do with TS Code Formatter?...
Read more >TS File (What It Is & How to Open One) - Lifewire
A file with the .TS file extension is a Video Transport Stream file used to store MPEG-2-compressed video data. They're often seen on...
Read more >Code Style. TypeScript | WebStorm Documentation - JetBrains
Use this page to configure formatting options for TypeScript files. When you change these settings, the Preview pane shows how this will ...
Read more >TypeScript Programming with Visual Studio Code
Formatting. VS Code includes a TypeScript formatter that provides basic code formatting with reasonable defaults. Use the typescript.format.
Read more >Why is Prettier not formating one of the .ts files? - Stack Overflow
Timeout in milliseconds after which the formatting that is run on file save is cancelled. That wasn't enough time for Prettier to format...
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
F1, run this command to open settings.json:
Open settings UI, then
That’s it! Perfect, thanks a lot!
This bit did it, I didn’t think of solving it that way: