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 function-calc-no-unspaced-operator false negatives for calc-size #8026

Merged
merged 4 commits into from
Oct 21, 2024

Conversation

azat-io
Copy link
Contributor

@azat-io azat-io commented Oct 8, 2024

Added new CSS function calc-size.

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

N/A.

Is there anything in the PR that needs further explanation?

Read more:
https://chromestatus.com/feature/5196713071738880
https://blog.webdevsimplified.com/2024-07/css-calc-size/
https://caniuse.com/?search=calc-size

Copy link

changeset-bot bot commented Oct 8, 2024

🦋 Changeset detected

Latest commit: df78bdc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
stylelint Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ybiquitous ybiquitous changed the title Support calc-size function Fix function-no-unknown false positives for calc-size Oct 8, 2024
Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

@azat-io Thanks for the first-time contribution!

For a normal workflow, contributors should open an issue first for triage. However, this fix is clear and small, so I believe directly opening a PR is acceptable in this case.

We can reproduce the false positive bug of the function-no-unknown rule with this demo.

See also the CSS calc-size() spec.

.changeset/flat-tomatoes-kick.md Outdated Show resolved Hide resolved
.changeset/flat-tomatoes-kick.md Outdated Show resolved Hide resolved
lib/reference/functions.mjs Outdated Show resolved Hide resolved
lib/rules/function-no-unknown/__tests__/index.mjs Outdated Show resolved Hide resolved
lib/utils/__tests__/isMathFunction.test.mjs Outdated Show resolved Hide resolved
@ybiquitous
Copy link
Member

Oh, I forgot that the rule depends on the css-functions-list package rather than our internal utils. 😅

const functionsList = require('css-functions-list/index.json');

Can you open an issue or pull request to the css-functions-list repo upstream?

@ybiquitous
Copy link
Member

I think css-functions-list scrapes MDN, so it may be better to wait for mdn/content#35934 publising the calc-size() page:
https://github.com/niksy/css-functions-list/blob/25b4fb4a50edd41041ff0194390a18d659f590e4/generate-list.js#L67

@ybiquitous ybiquitous added pr: blocked is blocked by another issue or pr upstream relates to an upstream package labels Oct 8, 2024
@azat-io
Copy link
Contributor Author

azat-io commented Oct 8, 2024

I created also pull request here niksy/css-functions-list#9

@ybiquitous
Copy link
Member

@azat-io Thank you for creating the PR to css-functions-list too. It was merged, and the new version was released quickly!

So, I think this PR is no longer necessary. As you can see this demo, the function-no-unknown error has gone.

If you don't have any other problem, can you please close this PR? I'm sorry that you've addressed my reviews, though. 🙇🏼

@Mouvedia
Copy link
Member

Mouvedia commented Oct 9, 2024

I think this PR is no longer necessary.

@ybiquitous it can be refurbished.
i.e. Fix function-calc-no-unspaced-operator false negatives for calc-size

@ybiquitous
Copy link
Member

i.e. Fix function-calc-no-unspaced-operator false negatives for calc-size

Sounds good. 👍🏼

@azat-io If you're interested, can you please add or update test cases about calc-size? There should be some rules impacted by this PR (mathFunctions or isMathFunction).

@Mouvedia Mouvedia changed the title Fix function-no-unknown false positives for calc-size Fix function-calc-no-unspaced-operator false negatives for calc-size Oct 10, 2024
@Mouvedia Mouvedia removed pr: blocked is blocked by another issue or pr upstream relates to an upstream package labels Oct 10, 2024
@Mouvedia
Copy link
Member

@romainmenke can you merge this?
I can't due to the "requested changes".

@romainmenke romainmenke dismissed ybiquitous’s stale review October 21, 2024 16:04

Feedback has been addressed

Copy link
Member

@romainmenke romainmenke left a comment

Choose a reason for hiding this comment

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

LGTM!

Thank you everyone for working on this 🙇

@romainmenke romainmenke merged commit 1d45ea8 into stylelint:main Oct 21, 2024
17 checks passed
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Nov 28, 2024
| datasource | package   | from    | to      |
| ---------- | --------- | ------- | ------- |
| npm        | stylelint | 16.10.0 | 16.11.0 |


## [v16.11.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#16110)

-   Added: `--report-unscoped-disables` CLI flag and `reportUnscopedDisables` option to Node.js API and configuration object ([#8024](stylelint/stylelint#8024)) ([@Mouvedia](https://github.com/Mouvedia)).
-   Added: `ignoreFunctions: []` to `media-query-no-invalid` ([#8060](stylelint/stylelint#8060)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Added: `name` configuration property under `overrides` ([#8095](stylelint/stylelint#8095)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `benchmark-rule` script to resolve `TypeError` ([#8090](stylelint/stylelint#8090)) ([@ybiquitous](https://github.com/ybiquitous)).
-   Fixed: `github` formatter deprecation warning link to `https://stylelint.io/awesome-stylelint#formatters` ([#8115](stylelint/stylelint#8115)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `function-calc-no-unspaced-operator` false negatives for `calc-size` ([#8026](stylelint/stylelint#8026)) ([@azat-io](https://github.com/azat-io)).
-   Fixed: `max-nesting-depth` false positives when the `&` selector is being ignored ([#8048](stylelint/stylelint#8048)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `media-feature-name-value-no-unknown` false positives for `display-mode: picture-in-picture` ([#8136](stylelint/stylelint#8136)) ([@Mouvedia](https://github.com/Mouvedia)).
-   Fixed: `no-irregular-whitespace` reported ranges ([#8066](stylelint/stylelint#8066)) ([@romainmenke](https://github.com/romainmenke)).
-   Fixed: `selector-attribute-name-disallowed-list` reported ranges ([#8037](stylelint/stylelint#8037)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-attribute-operator-allowed-list` reported ranges ([#8038](stylelint/stylelint#8038)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-attribute-operator-disallowed-list` reported ranges ([#8039](stylelint/stylelint#8039)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-class-pattern` reported ranges ([#8042](stylelint/stylelint#8042)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-combinator-allowed-list` reported ranges ([#8046](stylelint/stylelint#8046)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-combinator-disallowed-list` reported ranges ([#8047](stylelint/stylelint#8047)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-disallowed-list` reported ranges ([#8067](stylelint/stylelint#8067)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-id-pattern` reported ranges ([#8045](stylelint/stylelint#8045)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-attribute` reported ranges ([#8052](stylelint/stylelint#8052)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-class` reported ranges ([#8053](stylelint/stylelint#8053)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-combinators` reported-ranges ([#8055](stylelint/stylelint#8055)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-compound-selectors` reported ranges ([#8056](stylelint/stylelint#8056)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-id` reported ranges ([#8054](stylelint/stylelint#8054)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-pseudo-class` reported ranges ([#8057](stylelint/stylelint#8057)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-specificity` reported ranges ([#8058](stylelint/stylelint#8058)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-universal` reported ranges ([#8059](stylelint/stylelint#8059)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-nested-pattern` reported ranges ([#8072](stylelint/stylelint#8072)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-no-vendor-prefix` reported ranges ([#8073](stylelint/stylelint#8073)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-not-notation` reported ranges ([#8074](stylelint/stylelint#8074)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-pseudo-class-allowed-list` reported ranges ([#8061](stylelint/stylelint#8061)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-pseudo-class-disallowed-list` reported ranges ([#8062](stylelint/stylelint#8062)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-pseudo-class-no-unknown` reported ranges ([#8063](stylelint/stylelint#8063)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-pseudo-element-allowed-list` reported ranges ([#8068](stylelint/stylelint#8068)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-pseudo-element-colon-notation` reported ranges ([#8069](stylelint/stylelint#8069)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-pseudo-element-disallowed-list` reported ranges ([#8070](stylelint/stylelint#8070)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-pseudo-element-no-unknown` false positives for `::scroll-marker` and `::scroll-marker-group` ([#8110](stylelint/stylelint#8110)) ([@Mouvedia](https://github.com/Mouvedia)).
-   Fixed: `selector-pseudo-element-no-unknown` reported ranges ([#8071](stylelint/stylelint#8071)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-type-no-unknown` reported ranges ([#8076](stylelint/stylelint#8076)) ([@ryo-manba](https://github.com/ryo-manba)).
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Nov 29, 2024
| datasource | package   | from    | to      |
| ---------- | --------- | ------- | ------- |
| npm        | stylelint | 16.10.0 | 16.11.0 |


## [v16.11.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#16110)

-   Added: `--report-unscoped-disables` CLI flag and `reportUnscopedDisables` option to Node.js API and configuration object ([#8024](stylelint/stylelint#8024)) ([@Mouvedia](https://github.com/Mouvedia)).
-   Added: `ignoreFunctions: []` to `media-query-no-invalid` ([#8060](stylelint/stylelint#8060)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Added: `name` configuration property under `overrides` ([#8095](stylelint/stylelint#8095)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `benchmark-rule` script to resolve `TypeError` ([#8090](stylelint/stylelint#8090)) ([@ybiquitous](https://github.com/ybiquitous)).
-   Fixed: `github` formatter deprecation warning link to `https://stylelint.io/awesome-stylelint#formatters` ([#8115](stylelint/stylelint#8115)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `function-calc-no-unspaced-operator` false negatives for `calc-size` ([#8026](stylelint/stylelint#8026)) ([@azat-io](https://github.com/azat-io)).
-   Fixed: `max-nesting-depth` false positives when the `&` selector is being ignored ([#8048](stylelint/stylelint#8048)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `media-feature-name-value-no-unknown` false positives for `display-mode: picture-in-picture` ([#8136](stylelint/stylelint#8136)) ([@Mouvedia](https://github.com/Mouvedia)).
-   Fixed: `no-irregular-whitespace` reported ranges ([#8066](stylelint/stylelint#8066)) ([@romainmenke](https://github.com/romainmenke)).
-   Fixed: `selector-attribute-name-disallowed-list` reported ranges ([#8037](stylelint/stylelint#8037)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-attribute-operator-allowed-list` reported ranges ([#8038](stylelint/stylelint#8038)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-attribute-operator-disallowed-list` reported ranges ([#8039](stylelint/stylelint#8039)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-class-pattern` reported ranges ([#8042](stylelint/stylelint#8042)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-combinator-allowed-list` reported ranges ([#8046](stylelint/stylelint#8046)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-combinator-disallowed-list` reported ranges ([#8047](stylelint/stylelint#8047)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-disallowed-list` reported ranges ([#8067](stylelint/stylelint#8067)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-id-pattern` reported ranges ([#8045](stylelint/stylelint#8045)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-attribute` reported ranges ([#8052](stylelint/stylelint#8052)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-class` reported ranges ([#8053](stylelint/stylelint#8053)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-combinators` reported-ranges ([#8055](stylelint/stylelint#8055)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-compound-selectors` reported ranges ([#8056](stylelint/stylelint#8056)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-id` reported ranges ([#8054](stylelint/stylelint#8054)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-pseudo-class` reported ranges ([#8057](stylelint/stylelint#8057)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-specificity` reported ranges ([#8058](stylelint/stylelint#8058)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-max-universal` reported ranges ([#8059](stylelint/stylelint#8059)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-nested-pattern` reported ranges ([#8072](stylelint/stylelint#8072)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-no-vendor-prefix` reported ranges ([#8073](stylelint/stylelint#8073)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-not-notation` reported ranges ([#8074](stylelint/stylelint#8074)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-pseudo-class-allowed-list` reported ranges ([#8061](stylelint/stylelint#8061)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-pseudo-class-disallowed-list` reported ranges ([#8062](stylelint/stylelint#8062)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-pseudo-class-no-unknown` reported ranges ([#8063](stylelint/stylelint#8063)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-pseudo-element-allowed-list` reported ranges ([#8068](stylelint/stylelint#8068)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-pseudo-element-colon-notation` reported ranges ([#8069](stylelint/stylelint#8069)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-pseudo-element-disallowed-list` reported ranges ([#8070](stylelint/stylelint#8070)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-pseudo-element-no-unknown` false positives for `::scroll-marker` and `::scroll-marker-group` ([#8110](stylelint/stylelint#8110)) ([@Mouvedia](https://github.com/Mouvedia)).
-   Fixed: `selector-pseudo-element-no-unknown` reported ranges ([#8071](stylelint/stylelint#8071)) ([@ryo-manba](https://github.com/ryo-manba)).
-   Fixed: `selector-type-no-unknown` reported ranges ([#8076](stylelint/stylelint#8076)) ([@ryo-manba](https://github.com/ryo-manba)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants