Skip to content

Commit

Permalink
Fix selector-nested-pattern end positions (#6259)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous committed Aug 14, 2022
1 parent f691395 commit 8b7c4ad
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
42 changes: 30 additions & 12 deletions lib/rules/selector-nested-pattern/__tests__/index.js
Expand Up @@ -52,23 +52,29 @@ testRule({
message: messages.expected('b', /^[A-Z]+$/),
line: 1,
column: 5,
endLine: 1,
endColumn: 6,
},
{
code: stripIndent`
a {
DIV {
span {}
}
}`,
a {
DIV {
span {}
}
}`,
message: messages.expected('span', /^[A-Z]+$/),
line: 3,
column: 5,
column: 3,
endLine: 3,
endColumn: 7,
},
{
code: '@media print { a { b {} } }',
message: messages.expected('b', /^[A-Z]+$/),
line: 1,
column: 20,
endLine: 1,
endColumn: 21,
},
],
});
Expand All @@ -85,23 +91,29 @@ testRule({
message: messages.expected('b', '^[A-Z]+$'),
line: 1,
column: 5,
endLine: 1,
endColumn: 6,
},
{
code: stripIndent`
a {
DIV {
span {}
}
}`,
a {
DIV {
span {}
}
}`,
message: messages.expected('span', '^[A-Z]+$'),
line: 3,
column: 5,
column: 3,
endLine: 3,
endColumn: 7,
},
{
code: '@media print { a { b {} } }',
message: messages.expected('b', '^[A-Z]+$'),
line: 1,
column: 20,
endLine: 1,
endColumn: 21,
},
],
});
Expand All @@ -128,18 +140,24 @@ testRule({
message: messages.expected('.bar', '^&:(?:hover|focus)$'),
line: 1,
column: 8,
endLine: 1,
endColumn: 12,
},
{
code: '.foo { .bar:hover {} }',
message: messages.expected('.bar:hover', '^&:(?:hover|focus)$'),
line: 1,
column: 8,
endLine: 1,
endColumn: 18,
},
{
code: '.foo { &:hover, &focus {} }',
message: messages.expected('&:hover, &focus', '^&:(?:hover|focus)$'),
line: 1,
column: 8,
endLine: 1,
endColumn: 23,
},
],
});
Expand Down
1 change: 1 addition & 0 deletions lib/rules/selector-nested-pattern/index.js
Expand Up @@ -51,6 +51,7 @@ const rule = (primary) => {
ruleName,
message: messages.expected(selector, primary),
node: ruleNode,
word: selector,
});
});
};
Expand Down

0 comments on commit 8b7c4ad

Please sign in to comment.