-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix sass deprecation warnings #1379
Conversation
Only used in the datepicker.scss file so we don't need to import it everywhere
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
I've got this PR set as a draft. I'd like to do more testing in my local dev environment. To make sure all the styles are working as before. |
@@ -32,7 +32,6 @@ const css = { | |||
scss: { | |||
additionalData: ` | |||
@use 'sass:math'; | |||
@use 'sass:color'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find anywhere this is being used.
@@ -1,3 +1,5 @@ | |||
@use '../provider-variables' as *; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sass preprocessorOptions
in the vite.config.js
file adds @use 'src/scss/provider-variables.scss' as *;
to the top of all our sass files? Or just the ones that are imported via javascript?
Because that didn't happen for these /src/scss/core
sass files. I had to add these here for the $
prefixed variables to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imports never needed this because they were effectively combined into the provider-core file which would have the include but @forward
compiles and namespaces an export rather than putting each partial into the same namespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense 👍
src/scss/provider-variables.scss
Outdated
@@ -6,8 +6,10 @@ | |||
// Main Colors | |||
// ------------------------------------- | |||
|
|||
@use 'sass:map'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh this line should probably be placed above the Main Color
comment...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bah.. I dislike this change to sass.. but we gotta do something.. up for whichever TBH
@@ -1,3 +1,5 @@ | |||
@use '../provider-variables' as *; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imports never needed this because they were effectively combined into the provider-core file which would have the include but @forward
compiles and namespaces an export rather than putting each partial into the same namespace
@import 'core/space'; | ||
@import 'core/text'; | ||
@import 'core/typography'; | ||
@forward 'core/reset'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So.. I'm not certain, but what we might be able to do here is:
@use '../provider-variables' as *;
@use 'core/reset';
...
@use 'core/typography';
@forward 'core/base';
...
@forward 'core/typography';
I think that would put them all in the same namespace and the export them all with the shared namespacing.. but I'm not 💯 on that.
I'm also not sure that it's better..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm interesting, that's worth investigating. Not sure if that will work either, but would be nice if it did!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't get this to work 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one other thought that might be a hair cleaner.. at least for now.. we could make a js file at the very top of index called provider-core-styles.js
.. remove this file and all the _
d file names.. or something and instead of using sass partials just import all of these at the top.. then they'd get the additionalData
and we wouldn't have to add that to the partials.
@use 'sass:math'; | ||
@use 'sass:color'; | ||
@import 'src/scss/provider-variables.scss'; | ||
@use 'src/scss/provider-variables.scss' as *; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible that we should remove this altogether and break up the variables into separate @use
namespaces imports.. at least that seems to be what scss wants us to do.. but.. I dunno.. this pattern of having a few global scss vars hasn't hurt us at all.. and the imports would be everywhere...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So to implement this we'd need to add @use src/scss/provider-variables.scss
in every .scss
file? With relative paths too? Like @use ../../scss/provider-variables.scss
?
When working on this I thought about doing that. But I couldn't figure out another way besides having the @use
in a ton of different files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah.. well I think that's sass intention in deprecating @import
. They want explicit and obvious dependencies.. and for people to only use them when necessary... so they'd probably suggest against using as *
and rather using as colors
or something where the sass ends up color: colors.blue;
In theory I agree... but in practice.. yeah.. it's so many @use when our global "if you see a $variable, you'll find it in our short list of provider-variables.scss" seems to work pretty well for us. The additionalData
was always a little hacky.. but in some ways the more we fight the standard the more hacky our solutions are starting to look.. but as you said.. the alternative is just so much @use
which doesn't really seem to clarify anything IMO. So I dunno. sass sucks.
2542573
to
6cf3ac7
Compare
RoundingWell Care Ops Frontend Run #7171
Run Properties:
|
Project |
RoundingWell Care Ops Frontend
|
Branch Review |
sass-deprecations
|
Run status |
Failed #7171
|
Run duration | 02m 45s |
Commit |
acb9ad814b: Add `return null;`s to our vite plugins
|
Committer | Nick Major |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
1
|
Flaky |
2
|
Pending |
0
|
Skipped |
0
|
Passing |
312
|
View all changes introduced in this branch ↗︎ |
Tests for review
test/integration/forms/form.js • 1 failed test • care-ops-e2e
Test | Artifacts | |
---|---|---|
Noncontext Form > getIcd |
Test Replay
Screenshots
|
forms/form.js • 1 flaky test • care-ops-e2e
Test | Artifacts | |
---|---|---|
Noncontext Form > update patient field |
Test Replay
Screenshots
|
patients/sidebar/filter-sidebar.js • 1 flaky test • care-ops-e2e
Test | Artifacts | |
---|---|---|
filter sidebar > states sorted by sequence value |
Test Replay
Screenshots
|
Pull Request Test Coverage Report for Build 38e295ae-97d7-44e0-b97f-9314043c8c4cDetails
💛 - Coveralls |
ws service supports models now.
Part of the filters work, this can currently always be added
We didn’t ever use this. Likely never will
if a socket just opens by default it’s not an issue.
It reopens during changing tests
…plugin-stylelint npm packages To support vite 6
…external @modyfi/vite-plugin-yaml npm package @modyfi/vite-plugin-yaml npm package is no longer being maintained and is blocking us from moving to vite v6
Temporarily setting `css.preprocessorOptions.scss.api: 'legacy'` for vite 6 to work. We will remove that at a later date when we update sass to use the modern js api
No longer needed
Closing this PR and switching to a new one: #1382. I messed up a rebase. |
Shortcut Story ID: [sc-57510]
Main deprecation updates:
map-get()
tomap.get()
.@import
's to@use
&@forward
instead.