Hello, let me explain this weird suggestion.
In our team, we’re using css-in-js, so can can manipulate our style easily.
import {css} from '@emotion/css';
import {getSpacing} from '@ourdesignsystem/package';
export const myFooBar = css`
margin-left: ${getSpacing(3)};
`;
As expected, Sonar will trigger a code smell for magic_number, but in this case getSpacing
will return ${3 * x}rem;
(as x is our spacing basis from our designer).
So, it doesn’t make sense to make a var for each of them.
As our design-system grow, this rule is annoying for this purpose.