PLASMA-7448: Fix package.json formatting and lockfile update workflow#2872
Conversation
📝 WalkthroughWalkthroughPrettier formatting is enabled for Changespackage.json Prettier formatting and lock-file tooling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Theme Builder app deployed! https://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-2872/ |
| "prepare": "test ! -n \"$CI\" && husky install || echo skip husky", | ||
| "bootstrap": "npx lerna bootstrap", | ||
| "bootstrap:since": "npm run bootstrap -- --since=$(git merge-base --fork-point origin/dev)", | ||
| "update:package-locks": "npm run update:package-locks:root && npm run update:package-locks:lerna && npm run update:package-locks:root", |
There was a problem hiding this comment.
Дважды update:package-locks:root
There was a problem hiding this comment.
Тут сделано также как в CI:
https://github.com/salute-developers/plasma/blob/dev/.github/actions/update-package-lock/action.yml#L39-L42
Я помню что это добавлялось черте когда, из за того что в после lerna clean -y && lerna bootstrap почему-то корневой lock файл тоже менялся, и чтобы это пофиксить еще раз обновляли корневой package-lock;
в целом я бы подумал в сторону того чтобы поменять lerna на что-то по новее или в целом что-то улучшить в районе управления монорепы, но не в рамках этой задачи
There was a problem hiding this comment.
Хотя бы просто перейти на workspace + lerna@latest
f4590d4 to
83763f5
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lint-staged.config.cjs`:
- Around line 8-10: The ternary operator in the return statement is not
formatted according to Prettier's rules. Reformat the return statement with the
ternary expression (format.length check with the prettier command array on the
true branch and empty array on the false branch) to match Prettier's
line-breaking and indentation requirements, either by consolidating it onto
fewer lines or adjusting the indentation and placement of the question mark and
colon operators to align with Prettier's formatting standards.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 67a13fc4-9faa-4df7-99cb-dd9a66963133
📒 Files selected for processing (7)
.editorconfig.lintstagedrc.prettierignore.prettierrcCONTRIBUTING.mdlint-staged.config.cjspackage.json
💤 Files with no reviewable changes (1)
- .lintstagedrc
Align Prettier, lint-staged, and EditorConfig so package.json uses 2-space indent while package-lock.json stays npm-owned. Add update:package-locks scripts mirroring CI and document the workflow in CONTRIBUTING. Co-authored-by: Cursor <cursoragent@cursor.com>
83763f5 to
8fba639
Compare
Core
Repo tooling
tabWidth: 2+parser: jsonoverride дляpackage.json;package-lock.jsonостаётся в.prettierignorelint-staged.config.cjs,package-lock.json,git addindent_size = 2дляpackage.json/package-lock.jsonupdate:package-locks/:root/:lerna/:scope- зеркало CI update-package-lock actioncd packages/foo && npm install)What/why changed
Pre-commit hook через lint-staged применял Prettier с
tabWidth: 4ко всем*.json, включаяpackage.jsonиpackage-lock.json, обходя.prettierignore. Это давало огромные диффы в PR (например, T1 Stream T — ~34k строк в lock вместо удаления одной зависимости).Целевое поведение:
package.json→ Prettier с 2 пробелами (npm-стандарт)package-lock.json→ только npm/lerna, никогда PrettierСвязано с миграцией plasma-hope: #2870. После мержа можно ребейзить #2861 (T1).
Test plan
package.json— pre-commit форматирует с 2 пробелами, lock не трогаетсяtsconfig.json— форматирование с 4 пробеламиnpm run update:package-locksвыполняется без ошибок (локально, при необходимости)📦 Published PR as canary version:
Canary Versions✨ Test out this PR locally via:
npm install @salutejs/plasma-asdk@0.380.1-canary.2872.27611296237.0 npm install @salutejs/plasma-b2c@1.622.1-canary.2872.27611296237.0 npm install @salutejs/plasma-giga@0.349.1-canary.2872.27611296237.0 npm install @salutejs/plasma-homeds@0.349.1-canary.2872.27611296237.0 npm install @salutejs/plasma-new-hope@0.366.1-canary.2872.27611296237.0 npm install @salutejs/plasma-web@1.624.1-canary.2872.27611296237.0 npm install @salutejs/sdds-bizcom@0.354.1-canary.2872.27611296237.0 npm install @salutejs/sdds-cs@0.358.1-canary.2872.27611296237.0 npm install @salutejs/sdds-dfa@0.352.1-canary.2872.27611296237.0 npm install @salutejs/sdds-finai@0.345.1-canary.2872.27611296237.0 npm install @salutejs/sdds-insol@0.349.1-canary.2872.27611296237.0 npm install @salutejs/sdds-netology@0.353.1-canary.2872.27611296237.0 npm install @salutejs/sdds-os@0.24.1-canary.2872.27611296237.0 npm install @salutejs/sdds-platform-ai@0.353.1-canary.2872.27611296237.0 npm install @salutejs/sdds-sbcom@0.354.1-canary.2872.27611296237.0 npm install @salutejs/sdds-scan@0.352.1-canary.2872.27611296237.0 npm install @salutejs/sdds-serv@0.353.1-canary.2872.27611296237.0 npm install @salutejs/sdds-api-tests@0.11.1-canary.2872.27611296237.0 # or yarn add @salutejs/plasma-asdk@0.380.1-canary.2872.27611296237.0 yarn add @salutejs/plasma-b2c@1.622.1-canary.2872.27611296237.0 yarn add @salutejs/plasma-giga@0.349.1-canary.2872.27611296237.0 yarn add @salutejs/plasma-homeds@0.349.1-canary.2872.27611296237.0 yarn add @salutejs/plasma-new-hope@0.366.1-canary.2872.27611296237.0 yarn add @salutejs/plasma-web@1.624.1-canary.2872.27611296237.0 yarn add @salutejs/sdds-bizcom@0.354.1-canary.2872.27611296237.0 yarn add @salutejs/sdds-cs@0.358.1-canary.2872.27611296237.0 yarn add @salutejs/sdds-dfa@0.352.1-canary.2872.27611296237.0 yarn add @salutejs/sdds-finai@0.345.1-canary.2872.27611296237.0 yarn add @salutejs/sdds-insol@0.349.1-canary.2872.27611296237.0 yarn add @salutejs/sdds-netology@0.353.1-canary.2872.27611296237.0 yarn add @salutejs/sdds-os@0.24.1-canary.2872.27611296237.0 yarn add @salutejs/sdds-platform-ai@0.353.1-canary.2872.27611296237.0 yarn add @salutejs/sdds-sbcom@0.354.1-canary.2872.27611296237.0 yarn add @salutejs/sdds-scan@0.352.1-canary.2872.27611296237.0 yarn add @salutejs/sdds-serv@0.353.1-canary.2872.27611296237.0 yarn add @salutejs/sdds-api-tests@0.11.1-canary.2872.27611296237.0Summary by CodeRabbit
Chores
Documentation