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

Selectively silence deprecations and fix missed warnings #4985

Merged
merged 4 commits into from
May 22, 2024

Conversation

36degrees
Copy link
Member

Silencing all logs means that we may miss:

  • any deprecations from Sass that we can fix now without breaking support for LibSass and Ruby Sass
  • tests that need updating because of our own deprecations (like the recent deprecation of importing using the all entrypoints!)

Instead we can use the new silenceDeprecations option introduced in Sass 1.74.0 and silence just the deprecations we know we can’t do anything about.

Fix the deprecation warnings that we can now see 🎉

Copy link

github-actions bot commented May 17, 2024

📋 Stats

File sizes

File Size
dist/govuk-frontend-development.min.css 113.37 KiB
dist/govuk-frontend-development.min.js 42.34 KiB
packages/govuk-frontend/dist/govuk/all.bundle.js 88.16 KiB
packages/govuk-frontend/dist/govuk/all.bundle.mjs 82.83 KiB
packages/govuk-frontend/dist/govuk/all.mjs 981 B
packages/govuk-frontend/dist/govuk/govuk-frontend-component.mjs 359 B
packages/govuk-frontend/dist/govuk/govuk-frontend.min.css 113.36 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend.min.js 42.33 KiB
packages/govuk-frontend/dist/govuk/i18n.mjs 5.55 KiB
packages/govuk-frontend/dist/govuk/init.mjs 4.86 KiB

Modules

File Size (bundled) Size (minified)
all.mjs 78.45 KiB 40.31 KiB
accordion.mjs 22.71 KiB 12.85 KiB
button.mjs 5.98 KiB 2.69 KiB
character-count.mjs 22.4 KiB 9.92 KiB
checkboxes.mjs 5.83 KiB 2.83 KiB
error-summary.mjs 7.89 KiB 3.46 KiB
exit-this-page.mjs 17.1 KiB 9.26 KiB
header.mjs 4.46 KiB 2.6 KiB
notification-banner.mjs 6.26 KiB 2.62 KiB
password-input.mjs 15.15 KiB 7.25 KiB
radios.mjs 4.83 KiB 2.38 KiB
skip-link.mjs 4.39 KiB 2.18 KiB
tabs.mjs 10.13 KiB 6.11 KiB

View stats and visualisations on the review app


Action run for 3738efa

We want to be able to use `silenceDeprecations`, which is only available in 1.74.0 and above [1].

[1]: https://sass-lang.com/documentation/js-api/interfaces/options/#silenceDeprecations
Silencing all logs means that we may miss:

- any deprecations from Sass that we can fix now without breaking support for LibSass and Ruby Sass
- tests that need updating because of our own deprecations

Instead we can use the new `silenceDeprecations` feature introduced in Sass 1.74.0 and silence just the deprecations we know we can’t do anything about.
We need to pass `sassConfig` which configures Sass to use the mockWarnFunction for the expected warnings, silencing them.
@36degrees 36degrees force-pushed the better-silenced-deprecations branch from 23f202b to 3738efa Compare May 17, 2024 10:07
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-4985 May 17, 2024 10:07 Inactive
@@ -18,7 +18,7 @@ const sassPaths = [
async function compileSassFile(path, options = {}) {
return compileAsync(path, {
loadPaths: sassPaths,
logger: Logger.silent,
silenceDeprecations: ['slash-div'],
Copy link
Contributor

Choose a reason for hiding this comment

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

@36degrees Really glad this is out now, I had my eyes on this 🙌

Remember I had to write my own logger for Sass builds? Can probably whip that out now too

It's suppressing these two currently:

suppressed: [
  'Using / for division is deprecated and will be removed in Dart Sass 2.0.0.',
  'Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.'
]

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the heads up! 🙌🏻

I'll raise an issue as something to do in a follow up PR.

Copy link
Member

@romaricpascal romaricpascal left a comment

Choose a reason for hiding this comment

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

That silenceDeprecations is quite handy 🙌🏻 Thanks for tidying up the tests 😊

@36degrees 36degrees merged commit 5531c99 into main May 22, 2024
48 checks passed
@36degrees 36degrees deleted the better-silenced-deprecations branch May 22, 2024 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done 🏁
Development

Successfully merging this pull request may close these issues.

None yet

4 participants