Skip to content

Conversation

puckowski
Copy link
Contributor

What:

Fixes issue #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
  • Code complete

* Fix issue less#4339 by limiting the whitespace check for the deprecation
  notice to not produce false positives.
* Correct deprecation notice for issue less#4339.
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 30, 2025
@hostep
Copy link

hostep commented Sep 16, 2025

What needs to happen to release this fix in a new stable version? Thanks!

@hostep
Copy link

hostep commented Oct 7, 2025

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!

@puckowski
Copy link
Contributor Author

@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 #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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants