Editor config
Because we want to provide a great editing experience that complements your other editors we have put deep thought into providing a great code formatting experience.
General Configuration
We support the following key editorconfig properties out of the box. This means we are a good OSS citizen for more than just TypeScript.
end_of_line
:lf
|crlf
|os
(Default. This is recommended for git reasons 🌹)indent_size
::number
(Default:2
)indent_style
:tab
|space
(Default:space
)trim_trailing_whitespace
::boolean
(Default:false
)insert_final_newline
::boolean
(Default:false
)tab_width
::number
(Defaults toindent_size
)
Note :
tab_width
is only relevant if you usetab
s (which we don't recommend you use anyways).
Just create an .editorconfig
file in the root of your project. Here is a sample:
root = true
[*.{js,jsx,ts,tsx}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
root = true
stops editorconfig from search further up the directory for any other.editorconfig
files that might match.
TypeScript Formatting Configuration
For TypeScript specific stuff you can use the formatCodeOptions
key in tsconfig.json
.