Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/prettier-config #268

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file added .yarn/cache/fsevents-patch-19706e7e35-9.zip
Binary file not shown.
Binary file added .yarn/cache/fsevents-patch-afc6995412-9.zip
Binary file not shown.
28 changes: 28 additions & 0 deletions config/prettier/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# @atls/config-prettier

Наш кастомный конфиг `Prettier` с плагином для сортировки импортов (пока не умеет выравнивать
`from` между группам импортов).

## Инструкция по применению (проверено на IDE JetBrains от 2023.2.5)

1. Установить в корне проекта
- `@atls/config-prettier`
- `prettier` (протестировано на 3.1.0)
2. Анплаг конфига `yarn unplug @atls/config-prettier`
3. В корневом `package.json` прописать
```json
...
"license": "BSD-3-Clause"
"prettier": "@atls/config-prettier",
...
```

Для IDE от JetBrains можно выставить форматирование при сохранение либо по комбинации
- **macOS**: Cmd + Option + L
- **Linux/Windows**: Ctrl + Alt + L

## Внимание

**IDE Jetbrains** более ранних версий не умеют работать с конфигом prettier из Yarn PnP.
Протестировано на 2022.2.5. `prettier` не увидит правил нашего конфига и будет форматировать по
умолчанию (напр. `""` вместо наших `''`)
2 changes: 1 addition & 1 deletion config/prettier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dist"
],
"scripts": {
"build": "yarn library build && node -e 'const fs = require(\"fs\"); const config = require(\"./dist/index.js\"); fs.writeFileSync(\"./dist/.prettierrc\", JSON.stringify(config, null, 2))'",
"build": "yarn library build",
"prepack": "yarn run build",
"postpack": "rm -rf dist"
},
Expand Down
2 changes: 1 addition & 1 deletion config/prettier/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
module.exports = {
semi: false,
singleQuote: true,
tabWidth: 2,
Expand Down
Loading