Fix for issue #4339 false positive deprecation notice for mixins
What:
Fixes issue https://github.com/less/less.js/issues/4339
This Less:
@spacing-top: 4px;
@spacing-bottom: 4px;
@border-width: 4px;
@border-color: #444;
.divider-bottom(
@spacing-top: @spacing-top,
@spacing-bottom: @spacing-bottom,
@border-width: @border-width,
@border-color: @border-color
) {
margin-top: @spacing-top;
margin-bottom: @spacing-bottom;
border-bottom: @border-width solid @border-color;
}
div {
.divider-bottom(
@spacing-top,
@spacing-bottom,
@border-width,
@border-color
);
}
div {
.divider-bottom ( @spacing-top,
@spacing-bottom,
@border-width,
@border-color
);
}
div {
.divider-bottom (@spacing-top,
@spacing-bottom,
@border-width,
@border-color
);
}
div {
.divider-bottom(@spacing-top,
@spacing-bottom,
@border-width,
@border-color
);
}
yields the following deprecation notices:
less.js:11431 DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in http://172.25.80.1:8000/test.less on line 27, column 19:
27 .divider-bottom ( @spacing-top,
warn @ less.js:11431Understand this warning
less.js:11431 DEPRECATED WARNING: Whitespace between a mixin name and parentheses for a mixin call is deprecated in http://172.25.80.1:8000/test.less on line 35, column 19:
35 .divider-bottom (@spacing-top,
which should resolve false positive deprecation notices for syntax like:
.divider-bottom(
@spacing-top,
@spacing-bottom,
@border-width,
@border-color
);
Why:
Many users have reported the false positive behavior and wish to not see the notice or have to rewrite their valid Less.
Checklist:
- [ ] Documentation
- [ ] Added/updated unit tests
- [x] Code complete
What needs to happen to release this fix in a new stable version? Thanks!
I just noticed a new version was released but this fix wasn't included for some reason? Do we have an idea on a timeframe when this fix will get released? Sorry to keep pushing this, but I'd like to start fixing the actual deprecated problems in Magento, but for that to happen I would like to see a stable release of less where the false positives have been removed.
Many thanks!
@matthew-dean @iChenLei Would either of you be able to peer review this PR so we can merge and release?
Comment from the issue from hostep (see https://github.com/less/less.js/issues/4339):
Looks good @puckowski!
I just tried it in the ecosystem I'm active in, which is Magento2 ecommerce platform written in php, that uses less files for its frontend, and the amount of deprecated warnings dropped from 1220 to 39 after your changes, and those 39 seem like valid warnings. (example where warning went away, and example where warning still shows up, but that seems valid)
Many thanks!
Any update on reviewing this?
@matthew-dean are you ok with this being merged and released?