carbon-design-system / stylelint-plugin-carbon-tokens

Apache License 2.0
9 stars 3 forks source link

Spurious warnings about layout tokens in calc(-1 * ...). #126

Open wkeese opened 2 months ago

wkeese commented 2 months ago

Given:

@use "@carbon/layout" as layout;
...
.foo {
  margin-top: calc(-1 * #{layout.$spacing-01});
}

We get the spurious carbon/layout-use error that:

229:15 ⚠ Expected calc of the form calc(P O #{$}) or calc(-1 #{$}). Where 'P' is in (vw, vh or %), 'O' is + or -, '$' is a carbon layout token, mixin or function for "margin-top" found "calc(-1 #{layout.$spacing-01})".

(In reality, layout.$spacing-01 is a carbon layout token.)

Same spurious error with

.foo {
  margin-top: -#{layout.$spacing-01};
}
lee-chase commented 3 weeks ago

The scopes functionality is somewhat broken, thanks for raising this issue.