Skip to content

fix(components/packages): replace-deprecated-css-vars-and-classes should not modify SCSS variables#4348

Merged
johnhwhite merged 2 commits intomainfrom
replace-deprecated-css-vars-and-classes-not-scss-variables
Mar 31, 2026
Merged

fix(components/packages): replace-deprecated-css-vars-and-classes should not modify SCSS variables#4348
johnhwhite merged 2 commits intomainfrom
replace-deprecated-css-vars-and-classes-not-scss-variables

Conversation

@johnhwhite
Copy link
Copy Markdown
Member

@johnhwhite johnhwhite commented Mar 31, 2026

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed an issue in the migration schematic where SCSS variables with names similar to deprecated CSS classes were being incorrectly replaced. The tool now properly distinguishes between CSS class selectors and SCSS variable declarations, including in interpolation and namespaced contexts, while still correctly replacing the deprecated CSS classes themselves.

@johnhwhite johnhwhite added the risk level (author): 1 No additional bugs expected from this change label Mar 31, 2026
@johnhwhite johnhwhite temporarily deployed to e2e-team-members March 31, 2026 13:56 — with GitHub Actions Inactive
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fe9ddd35-c019-4ef4-85f5-a9ef2948a378

📥 Commits

Reviewing files that changed from the base of the PR and between eae6f18 and 70f30e3.

📒 Files selected for processing (2)
  • libs/components/packages/src/schematics/migrations/update-14/replace-deprecated-css-vars-and-classes/replace-deprecated-css-vars-and-classes.spec.ts
  • libs/components/packages/src/schematics/migrations/update-14/replace-deprecated-css-vars-and-classes/replace-deprecated-css-vars-and-classes.ts

📝 Walkthrough

Walkthrough

A schematic migration for deprecated CSS variables is enhanced by adding comprehensive test coverage for SCSS variable handling and updating the replacement regex to include $ in its negative lookbehind, preventing unwanted replacements of SCSS variables that share name substrings with deprecated CSS classes.

Changes

Cohort / File(s) Summary
Test Coverage
libs/components/packages/src/schematics/migrations/update-14/replace-deprecated-css-vars-and-classes/replace-deprecated-css-vars-and-classes.spec.ts
Added comprehensive test cases validating that SCSS variable declarations and usages ($sky-old-class, #{$sky-old-class}, module.$sky-old-class) are not replaced while CSS selectors (.sky-old-class) continue to be correctly replaced.
Regex Boundary Logic
libs/components/packages/src/schematics/migrations/update-14/replace-deprecated-css-vars-and-classes/replace-deprecated-css-vars-and-classes.ts
Updated negative lookbehind in replacement regex from (?<![\w-]) to (?<![\w$-]) to prevent matching deprecated names preceded by $, ensuring SCSS variables are excluded from replacement operations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Poem

🐰 A pattern refined, so precise and so keen,
SCSS variables spared from the schematic's screen,
Dollar signs guarded by lookbehind's might,
CSS selectors replaced, but SCSS stays tight!
Tests bloom like carrots, preventing mistakes,
One gentle change all the difference makes. 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: fixing the schematic to prevent modifications to SCSS variables, which aligns with the core changes in both the test and implementation files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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 replace-deprecated-css-vars-and-classes-not-scss-variables

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Mar 31, 2026

View your CI Pipeline Execution ↗ for commit 41bce10

Command Status Duration Result
nx affected --target lint test posttest --confi... ✅ Succeeded <1s View ↗
nx affected --target build postbuild lint test ... ✅ Succeeded 6s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-31 16:42:56 UTC

@blackbaud-sky-build-user
Copy link
Copy Markdown
Collaborator

Storybook preview

Component Storybooks:

  • (no component storybooks affected in this pr)

Apps:

@johnhwhite johnhwhite enabled auto-merge (squash) March 31, 2026 16:37
@johnhwhite johnhwhite temporarily deployed to e2e-team-members March 31, 2026 16:37 — with GitHub Actions Inactive
@johnhwhite johnhwhite merged commit c9f95e7 into main Mar 31, 2026
24 checks passed
@johnhwhite johnhwhite deleted the replace-deprecated-css-vars-and-classes-not-scss-variables branch March 31, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk level (author): 1 No additional bugs expected from this change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants