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 for interpolation and shorthand in font-family-name-quotes #6335

Merged
merged 4 commits into from
Sep 11, 2022
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: Ignore scss function in with interpolation
  • Loading branch information
kimulaco committed Sep 10, 2022
commit c74c7988e7fb35a34f8a736adae79758b2f832b2
31 changes: 31 additions & 0 deletions lib/rules/font-family-name-quotes/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ const variablePositiveTests = [
},
];

const scssPositiveTests = [
{
code: 'a { font: #{customFunc($some-length)} "Times", "Arial"; }',
description: 'ignores Sass function with interpolation',
},
];

testRule({
ruleName,
config: ['always-unless-keyword'],
Expand Down Expand Up @@ -203,6 +210,14 @@ testRule({
],
});

testRule({
ruleName,
customSyntax: 'postcss-scss',
config: ['always-unless-keyword'],

accept: [...scssPositiveTests],
});

testRule({
ruleName,
config: ['always-where-recommended'],
Expand Down Expand Up @@ -378,6 +393,14 @@ testRule({
],
});

testRule({
ruleName,
customSyntax: 'postcss-scss',
config: ['always-where-recommended'],

accept: [...scssPositiveTests],
});

testRule({
ruleName,
config: ['always-where-required'],
Expand Down Expand Up @@ -503,6 +526,14 @@ testRule({
],
});

testRule({
ruleName,
customSyntax: 'postcss-scss',
config: ['always-where-required'],

accept: [...scssPositiveTests],
});

testRule({
ruleName,
config: ['always-unless-keyword'],
Expand Down
4 changes: 4 additions & 0 deletions lib/rules/font-family-name-quotes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ const rule = (primary, _secondary, context) => {
return;
}

if (!isStandardSyntaxValue(decl.value)) {
return;
}

if (isVariable(rawFamily)) {
return;
}
Expand Down