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 percent-placeholder-pattern end positions #920

Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 13 additions & 1 deletion src/rules/percent-placeholder-pattern/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ testRule({
{
code: "%floo { top: 1em; }",
line: 1,
column: 1,
endLine: 1,
endColumn: 6,
message: messages.expected("floo"),
description: "Regexp: sequence part. Example: symbol in between."
}
Expand Down Expand Up @@ -113,6 +116,9 @@ testRule({
{
code: "% foo { top: 1em; }",
line: 1,
column: 1,
endLine: 1,
endColumn: 2,
message: messages.expected(""),
description:
"Regexp: strict match. Example: matches, but has a space after '%'."
Expand Down Expand Up @@ -223,7 +229,10 @@ testRule({
a,
&1oo {}
}`,
line: 3,
line: 2,
column: 7,
endLine: 3,
endColumn: 14,
message: messages.expected("Foo-bar1oo"),
description:
"Regexp: SUIT component. Example: nesting, only lv1 part comply."
Expand All @@ -235,6 +244,9 @@ testRule({
}
}`,
line: 1,
column: 1,
endLine: 1,
endColumn: 4,
message: messages.expected("Fo"),
description:
"Regexp: pattern at the beginning. Example: nesting, with nesting selector; first lv doesn't comply."
Expand Down
4 changes: 2 additions & 2 deletions src/rules/percent-placeholder-pattern/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function rule(pattern) {
function checkSelector(fullSelector, rule) {
// postcss-selector-parser gives %placeholders' nodes a "tag" type
fullSelector.walkTags(compoundSelector => {
const { value, sourceIndex } = compoundSelector;
const { value } = compoundSelector;

if (value[0] !== "%") {
return;
Expand All @@ -87,7 +87,7 @@ function rule(pattern) {
ruleName,
message: messages.expected(placeholder),
node: rule,
index: sourceIndex
word: value
});
});
}
Expand Down