Surrounding minus operator is not taken into account when migrating division operator
Closed this issue · 2 comments
patrikjuvonen commented
Not sure if this should be a migration issue or a dart-sass issue, I would like dart-sass to change this behavior and allow minus operator to be present before a function invocation, but meanwhile, this tool presents an issue.
Before migration:
@use 'sass:math';
body {
font-size: -(1/2);
}
After migration:
@use 'sass:math';
body {
font-size: -math.div(1, 2);
}
Error:
echo "@use 'sass:math'; body {font-size: -math.div(1, 2)}" | npx sass --stdin
Error: There is no module with the namespace "-math".
╷
1 │ @use 'sass:math'; body {font-size: -math.div(1, 2)}
│ ^^^^^^^^^^^^^^^
╵
- 1:36 root stylesheet
Expected migration:
@use 'sass:math';
body {
font-size: -(math.div(1, 2));
}
Expected result:
body {
font-size: -0.5;
}
Additionally I'm aware you can just use -1 / 2, but this issue is about surrounding the content using minus operator. I see a few of those cases during migration and it's just inconvenient to have to go fix those. Whether this issue is within the scope of the migration tool is up to you of course.
jathak commented
This is definitely a bug in the migrator. I'll look into it now
patrikjuvonen commented
Great, thanks!