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 declaration-property-value-no-unknown false positives for env() #6646

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/serious-moose-applaud.md
@@ -0,0 +1,5 @@
---
"stylelint": patch
---

Fix `declaration-property-value-no-unknown` false positives for `env()`
romainmenke marked this conversation as resolved.
Show resolved Hide resolved
Expand Up @@ -19,6 +19,9 @@ testRule({
{
code: 'a { top: var(--foo); }',
},
{
code: 'a { top: env(titlebar-area-height); }',
},
{
code: 'a { foo: 1px; }',
},
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/declaration-property-value-no-unknown/index.js
Expand Up @@ -130,6 +130,7 @@ const rule = (primary, secondaryOptions) => {
* some math functions like `clamp()` via `fork()`. In the future, it may be unnecessary.
*
* @see https://github.com/stylelint/stylelint/pull/6511#issuecomment-1412921062
* @see https://github.com/stylelint/stylelint/issues/6635#issuecomment-1425787649
*
* @param {import('css-tree').CssNode} cssTreeNode
* @returns {boolean}
Expand All @@ -138,7 +139,7 @@ function containsUnsupportedMathFunction(cssTreeNode) {
return Boolean(
find(
cssTreeNode,
(node) => node.type === 'Function' && ['clamp', 'min', 'max'].includes(node.name),
(node) => node.type === 'Function' && ['clamp', 'min', 'max', 'env'].includes(node.name),
),
);
}
Expand Down