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 selector-nest-combinators throwing an error when using nested props #360

Merged
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
11 changes: 11 additions & 0 deletions src/rules/declaration-nested-properties/__tests__/index.js
Expand Up @@ -33,6 +33,17 @@ testRule(rule, {
}
`,
description: "{ always } Vendor prefixed rules."
},
{
code: `
a {
font: {
size: 10px;
weight: 400;
}
}
`,
description: "nested properties"
}
]
});
Expand Down
22 changes: 22 additions & 0 deletions src/rules/selector-nest-combinators/__tests__/index.js
Expand Up @@ -96,6 +96,17 @@ testRule(rule, {
}
`,
description: "should support interpolation"
},
{
code: `
a {
font: {
size: 10px;
weight: 400;
}
}
`,
description: "ignores nested properties"
}
],

Expand Down Expand Up @@ -240,6 +251,17 @@ testRule(rule, {
.class-name #{if(&, "&", "")} {}
`,
description: "should support interpolation"
},
{
code: `
a {
font: {
size: 10px;
weight: 400;
}
}
`,
description: "ignores nested properties"
}
],

Expand Down
8 changes: 8 additions & 0 deletions src/rules/selector-nest-combinators/index.js
Expand Up @@ -46,6 +46,14 @@ export default function(expectation) {
const interpolationRe = /#{.+?}$/;

root.walkRules(rule => {
if (typeof rule.selector === "string") {
const isNestedProperty = rule.selector.slice(-1) === ":";

if (isNestedProperty) {
return;
}
}

parseSelector(rule.selector, result, rule, fullSelector => {
let message;

Expand Down