Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix false positives and memory leak for function-calc-no-unspaced-operator #6045

Merged
merged 2 commits into from Apr 29, 2022

Conversation

ybiquitous
Copy link
Member

@ybiquitous ybiquitous commented Apr 29, 2022

Which issue, if any, is this issue related to?

Is there anything in the PR that needs further explanation?

This pull request does 2 major things:

  • dropping the support of the * and / operators since they are not required (see also calc() notes on MDN)
  • preventing a potential infinite-loop by mutating an array inside a loop (see also the issue comment)

@@ -32,9 +32,27 @@ testRule({
{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[note] Testing --fix has been done.

},
{
code: 'a { top: calc(10px/var(--foo)); }',
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[note] The case raised a memory leak. See #6044 (comment)

@ybiquitous ybiquitous marked this pull request as ready for review April 29, 2022 06:55
sourceIndex: 0,
sourceEndIndex: 1,
});
currentNode.value = isBeforeOp ? `${currentNode.value} ` : ` ${currentNode.value}`;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, dropping * and / may make the mutation unnecessary. I'll try removing it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reconsidered. Test cases may not be enough. But, just in case, I leave it.

@ybiquitous ybiquitous mentioned this pull request Apr 29, 2022
6 tasks
Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the memory leak @ybiquitous !

I've tweaked the README, but everything else LGTM.

Feel free to merge.

@ybiquitous ybiquitous merged commit e747ad1 into main Apr 29, 2022
@ybiquitous ybiquitous deleted the issue-5695-and-6044 branch April 29, 2022 12:47
@ybiquitous
Copy link
Member Author

Changelog entry added:

  • Fixed: function-calc-no-unspaced-operator false positives and memory leak (#6045).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants