2023-10-03 12:38:32 +00:00
|
|
|
# Prettier Config
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
```bash
|
2023-10-06 20:24:30 +00:00
|
|
|
pnpm add -D @nicco.io/prettier
|
2023-10-03 12:38:32 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
// .prettierrc.js
|
|
|
|
|
2023-10-06 20:24:30 +00:00
|
|
|
import config from '@nicco.io/prettier'
|
2023-10-03 12:38:32 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
...config,
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Included
|
|
|
|
|
2023-11-11 11:21:57 +00:00
|
|
|
- [Sort imports](https://github.com/IanVS/prettier-plugin-sort-imports)
|
|
|
|
- [Sort package.json](https://github.com/matzkoh/prettier-plugin-packagejson)
|
2023-10-03 12:38:32 +00:00
|
|
|
- Some custom preference settings
|
2023-11-11 11:21:57 +00:00
|
|
|
|
|
|
|
## Recipes
|
|
|
|
|
|
|
|
### Svelte
|
|
|
|
|
|
|
|
```js
|
|
|
|
// .prettierrc.js
|
|
|
|
import preset from '@nicco.io/prettier'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
...preset,
|
|
|
|
overrides: [{ files: '*.svelte', options: { parser: 'svelte' } }],
|
|
|
|
plugins: [...preset.plugins, 'prettier-plugin-svelte'],
|
|
|
|
}
|
|
|
|
```
|