Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix declaration-property-value-no-unknown false positives for `attr…
…()` and `if()`
  • Loading branch information
jeddy3 committed Nov 27, 2025
commit 85307bac830cb3c3fc35f0a8c5d00b4e2df47abf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ testRule({
{
code: 'a { anchor-name: --bar, --qux; }',
},
{
code: 'a { filter: alpha(opacity=30); }',
description: 'ignore csstree parse errors',
},
{
code: 'a { color: if(media(all): red;); }',
description: 'ignore csstree parse errors for `if()` function',
},
{
code: 'a { content: attr(data-foo type(<string>)) }',
description: 'ignore csstree parse errors for `attr()` function',
},
{
code: '@font-face { font-weight: bolder; }',
description: 'ignore descriptors with unknown values',
Expand Down Expand Up @@ -344,14 +356,6 @@ testRule({
endLine: 1,
endColumn: 17,
},
{
code: 'a { filter: alpha(opacity=30); }',
message: messages.rejectedParseError('filter', 'alpha(opacity=30)'),
line: 1,
column: 13,
endLine: 1,
endColumn: 30,
},
{
code: stripIndent`
a { --foo: 10px; }
Expand Down
16 changes: 1 addition & 15 deletions lib/rules/declaration-property-value-no-unknown/index.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 1 addition & 15 deletions lib/rules/declaration-property-value-no-unknown/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

const messages = ruleMessages(ruleName, {
rejected: (property, value) => `Unexpected unknown value "${value}" for property "${property}"`,
rejectedParseError: (property, value) =>
`Cannot parse property value "${value}" for property "${property}"`,
});

const meta = {
Expand Down Expand Up @@ -156,19 +154,7 @@

if (containsUnsupportedFunction(cssTreeValueNode)) return;
} catch {
const index = declarationValueIndex(decl);
const endIndex = index + value.length;

report({
message: messages.rejectedParseError,
messageArgs: [prop, value],
node: decl,
index,
endIndex,
result,
ruleName,
});

// Ignore parse errors
return;
}

Expand Down Expand Up @@ -250,6 +236,6 @@
}

rule.ruleName = ruleName;
rule.messages = messages;

Check failure on line 239 in lib/rules/declaration-property-value-no-unknown/index.mjs

View workflow job for this annotation

GitHub Actions / lint / Lint on Node.js lts/* and ubuntu-latest

Type '{ rejected: (property: string | number | boolean | RegExp | (string | RegExp)[], value: string | number | boolean | RegExp | (string | RegExp)[]) => string; }' is not assignable to type 'RejectedMessage<[property: string, value: string]> & { rejectedParseError: (property: string, value: string) => string; }'.
rule.meta = meta;
export default rule;
Loading