@elgato/prettier-config
v0.3.3
Published
Prettier configuration used by Elgato projects.
Readme
@elgato/prettier-config
Prettier configuration used by Elgato projects.
Usage
- Install
@elgato/prettier-config.
npm i @elgato/prettier-config --save-dev- Edit your
package.jsonto reference the configuration.
"prettier": "@elgato/prettier-config"Configuration
Prettier
| Option | Value |
| ---------------------------------------------------------------------- | --------------------------------------------------- |
| endOfLine | lf |
| printWidth | 120 |
| singleQuote | ❌ Prefer double |
| semi | ✅ Prefer semicolons |
| tabWidth | 4 (2 for .yaml, .yml) |
| useTabs | ✅ Except .json, .jsonc, .md, .yaml, .yml |
| trailingComma | All, except .jsonc |
Multiline arrays
| Option | Value |
| --------------------------------------------------------------------------------------------------------------------------- | ----------- |
| multilineArraysWrapThreshold | -1 (manual) |
Sort imports
| Option | Value |
| ------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| importOrder | Third-party modules first. |
| importOrderSeparation | ✅ |
| importOrderSortSpecifiers | ✅ |
| importOrderCaseInsensitive | ✅ |
| importOrderParserPlugins | TypeScript, decoratorAutoAccessors, explicitResourceManagement |
Overrides
Overriding configuration can be achieved by removing the prettier entry from package.json, in favour of a .prettierrc.js file. For example, to prefer spaces over tabs:
module.exports = {
...require("@elgato/prettier-config"),
tabWidth: 2,
useTabs: false,
};Recognitions
This project wishes to express thanks to those who work on Prettier, and Prettier plugins, with particular thanks to:
- prettier and prettier-vscode, from the prettier team.
- prettier-plugin-multiline-arrays, from electrovir.
- prettier-plugin-sort-imports from the Trivago team.
