Skip to content

PLASMA-7448: Fix package.json formatting and lockfile update workflow#2872

Merged
Yeti-or merged 1 commit into
devfrom
chore/fix-package-formatting
Jun 16, 2026
Merged

PLASMA-7448: Fix package.json formatting and lockfile update workflow#2872
Yeti-or merged 1 commit into
devfrom
chore/fix-package-formatting

Conversation

@Yeti-or

@Yeti-or Yeti-or commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Core

Repo tooling

  • prettier:
    • tabWidth: 2 + parser: json override для package.json;
    • package-lock.json остаётся в .prettierignore
  • lint-staged:
    • миграция на lint-staged.config.cjs,
    • пропуск package-lock.json,
    • удалён legacy git add
  • EditorConfig:
    • indent_size = 2 для package.json / package-lock.json
  • npm-скрипты update:package-locks / :root / :lerna / :scope - зеркало CI update-package-lock action
  • CONTRIBUTING: раздел про обновление lock-файлов и анти-паттерны (cd 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 вместо удаления одной зависимости).

Целевое поведение:

  • TS/JS/MD → 4 пробела (как было)
  • 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.0

Summary by CodeRabbit

  • Chores

    • Updated code formatting and linting configuration rules to ensure consistent code quality across the repository
    • Added new automation scripts for managing and updating package lock files across the project workspace
    • Reorganized development tool configurations to improve build and test workflow efficiency
  • Documentation

    • Added comprehensive guidelines for contributors on properly updating package lock files when modifying project dependencies

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Prettier formatting is enabled for package.json files by updating .prettierignore (now excludes only package-lock.json), adding a .prettierrc overrides block, and an .editorconfig indent rule. The old .lintstagedrc is replaced by lint-staged.config.cjs, which filters package-lock.json out of JSON formatting. Four update:package-locks npm scripts are added along with a new CONTRIBUTING.md section documenting lock-file update procedures.

Changes

package.json Prettier formatting and lock-file tooling

Layer / File(s) Summary
Prettier and EditorConfig rules for package.json
.editorconfig, .prettierignore, .prettierrc
indent_size=2 override added for package.json/package-lock.json in EditorConfig; .prettierignore narrowed to exclude only package-lock.json; .prettierrc gains an overrides block applying the json parser and tabWidth: 2 to package.json files.
lint-staged config migration with package-lock.json exclusion
.lintstagedrc, lint-staged.config.cjs
Static .lintstagedrc is removed; new lint-staged.config.cjs replaces it with a callback-based JSON glob handler that filters out package-lock.json before running Prettier.
Lock-file update scripts and contributor documentation
package.json, CONTRIBUTING.md
Four update:package-locks scripts added for root, lerna workspace, and scoped regeneration. CONTRIBUTING.md gains a section describing when lock files must be updated, which scripts to use, and what to avoid.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hoppity-hop through the JSON lanes,
Prettier now combs through package.json manes!
Lock files stay wild, npm owns their style,
New scripts keep the workspace fresh all the while.
Commit with care, check the diff with a glance —
This rabbit approves of this tidy dance! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: fixing package.json formatting and establishing a proper lockfile update workflow across multiple configuration files and tooling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/fix-package-formatting

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

Theme Builder app deployed!

https://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-2872/

@Yeti-or

Yeti-or commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

@Yakutoc Yakutoc added the changelog-skip Exclude pull request changes from changelog label Jun 16, 2026
@Yakutoc Yakutoc changed the title chore: fix package.json formatting and lockfile update workflow sdds-infra: Fix package.json formatting and lockfile update workflow Jun 16, 2026
@Yakutoc Yakutoc removed the request for review from neretin-trike June 16, 2026 07:35
@Yakutoc Yakutoc changed the title sdds-infra: Fix package.json formatting and lockfile update workflow PLASMA-7448: Fix package.json formatting and lockfile update workflow Jun 16, 2026
Comment thread package.json
"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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Дважды update:package-locks:root

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут сделано также как в 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 на что-то по новее или в целом что-то улучшить в районе управления монорепы, но не в рамках этой задачи

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хотя бы просто перейти на workspace + lerna@latest

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8809dc1 and 83763f5.

📒 Files selected for processing (7)
  • .editorconfig
  • .lintstagedrc
  • .prettierignore
  • .prettierrc
  • CONTRIBUTING.md
  • lint-staged.config.cjs
  • package.json
💤 Files with no reviewable changes (1)
  • .lintstagedrc

Comment thread lint-staged.config.cjs Outdated
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>
@Yeti-or Yeti-or force-pushed the chore/fix-package-formatting branch from 83763f5 to 8fba639 Compare June 16, 2026 10:30
@Yeti-or Yeti-or enabled auto-merge June 16, 2026 11:12
@Yeti-or Yeti-or added this pull request to the merge queue Jun 16, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 16, 2026
@Yeti-or Yeti-or added this pull request to the merge queue Jun 16, 2026
Merged via the queue into dev with commit 3dadbd4 Jun 16, 2026
21 checks passed
@Yeti-or Yeti-or deleted the chore/fix-package-formatting branch June 16, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-skip Exclude pull request changes from changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants