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

Solve deprecated warning using / for division outside of calc() #976

Merged
merged 4 commits into from
Dec 19, 2021
Merged

Solve deprecated warning using / for division outside of calc() #976

merged 4 commits into from
Dec 19, 2021

Conversation

hans2103
Copy link
Contributor

Description

This PR will solve the Deprecated Warning created by Dart Sass

Screenshots (if appropriate)

Deprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div(-$choices-button-offset, 2) or calc(-$choices-button-offset / 2)

More info and automated migrator: https://sass-lang.com/d/slash-div

    ╷
129 │     margin-right: -$choices-button-offset/2;
    │                   ^^^^^^^^^^^^^^^^^^^^^^^^^
    ╵
    node_modules/choices.js/src/styles/choices.scss 129:19                @import

Types of changes

To solve the deprecated warning using / for division outside of calc() you can use math.div instead.
BUT... does math.div have a widespread support?
Dunno... on the other hand.... the multiplier * does have a widespread support.

SO instead of replacing / by math.div I propose to replace it by *
There are only five places in the code where the division is used and the numbers are simple

  • replace /2 by * .5

  • replace /4 by * .25

  • Chore (tooling change or documentation change)

  • Refactor (non-breaking change which maintains existing functionality)

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

There is no need to change the documentation

@mtriff
Copy link
Member

mtriff commented Dec 15, 2021

Thanks for this! I agree your approach seems the most straightforward. Can you add the leading zeroes to .5 and .25? We should add stylelint to automatically detect and fix that, but for now...

@mtriff mtriff mentioned this pull request Dec 15, 2021
8 tasks
@hans2103
Copy link
Contributor Author

@mtriff leading zeroes have been added.

@mtriff
Copy link
Member

mtriff commented Dec 19, 2021

Looks great, thanks!

@mtriff mtriff merged commit 046afbb into Choices-js:master Dec 19, 2021
@mtriff mtriff added the chore Pull request that does not change core code label Dec 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull request that does not change core code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants