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 negatives for grid shorthands in named-grid-areas-no-invalid #5514

Merged
merged 4 commits into from Sep 6, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 38 additions & 11 deletions lib/rules/named-grid-areas-no-invalid/__tests__/index.js
Expand Up @@ -17,16 +17,16 @@ testRule({
},
{
code: stripIndent`
a {
a {
grid-template-areas: "head head"
"nav main"
"nav foot";
}`,
},
{
code: stripIndent`
a {
grid-template-areas:
a {
grid-template-areas:
/* "" */ "head head"
"nav main" /* "a b c" */
"nav foot" /* "" */;
Expand All @@ -52,8 +52,17 @@ testRule({
},
{
code: stripIndent`
a {
grid-template-areas: /* "comment" */ none /* "comment " */;
a {
grid-template-areas: /* "comment" */ none /* "comment " */;
}`,
},
{
code: stripIndent`
a {
grid-template:
"a a a" 40px
"b c c" 40px
"b c c" 40px / 1fr 1fr 1fr;
}`,
},
],
Expand All @@ -80,10 +89,10 @@ testRule({
},
{
code: stripIndent`
a {
a {
grid-template-areas: "header header header header"
"main main . sidebar"
"footer footer footer header";
"footer footer footer header";
}`,
message: messages.expectedRectangle('header'),
line: 2,
Expand All @@ -103,8 +112,8 @@ testRule({
},
{
code: stripIndent`
a { grid-template-areas:
"";
a { grid-template-areas:
"";
jeddy3 marked this conversation as resolved.
Show resolved Hide resolved
}`,
message: messages.expectedToken(),
line: 2,
Expand All @@ -120,9 +129,9 @@ testRule({
},
{
code: stripIndent`
a {
a {
grid-template-areas: /* none */
"" /* none */;
"" /* none */;
}`,
message: messages.expectedToken(),
line: 3,
Expand All @@ -134,5 +143,23 @@ testRule({
line: 1,
column: 26,
},
{
code: stripIndent`
a {
grid-template:
"a a" 40px
"b c c" 40px
"b c c" 40px / 1fr 1fr 1fr;
}`,
message: messages.expectedSameNumber(),
line: 3,
column: 3,
},
{
code: `a { grid: "" 200px "b" min-content; }`,
message: messages.expectedToken(),
line: 1,
column: 11,
},
],
});
2 changes: 1 addition & 1 deletion lib/rules/named-grid-areas-no-invalid/index.js
Expand Up @@ -25,7 +25,7 @@ const rule = (primary) => {
return;
}

root.walkDecls(/^grid-template-areas$/i, (decl) => {
root.walkDecls(/^grid$|^grid-template|$^grid-template-areas|$/i, (decl) => {
jeddy3 marked this conversation as resolved.
Show resolved Hide resolved
const { value } = decl;

if (value.toLowerCase().trim() === 'none') return;
Expand Down