Skip to content

Commit

Permalink
fix eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dryoma committed May 18, 2016
1 parent 5e1feec commit b48dd35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/rules/selector-max-compound-selectors/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { testRule } from "../../../testUtils"

import rule, { ruleName, messages } from ".."

// Testing plain selectors, different combinators
testRule(rule, {
ruleName,
Expand All @@ -28,7 +28,7 @@ testRule(rule, {
}, {
code: "a { top: 0; d { top: 0; }}",
} ],

reject: [ {
code: "a b c { top: 0; }",
message: messages.expected("a b c", 2),
Expand Down Expand Up @@ -72,7 +72,7 @@ testRule(rule, {
code: " [type=\"text\"]#id.classname l {}",
description: "attr selector with class and id selectors, complies.",
} ],

reject: [ {
code: ":not(a b c) { top: 0; }",
description: "Standalone :not(), number of compound selectors > max inside it",
Expand Down
4 changes: 2 additions & 2 deletions src/rules/selector-max-compound-selectors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export default function (max) {
// Finds actual selectors in selectorNode object and checks them
function checkSelector(selectorNode, rule) {
let compoundCount = 1

selectorNode.each(childNode => {
// Only traverse inside actual selectors and :not()
if (childNode.type === "selector" || childNode.value === ":not") {
checkSelector(childNode, rule)
}

// Compund selectors are separated by combinators, so increase count when meeting one
if (childNode.type === "combinator") { compoundCount ++ }
if (childNode.type === "combinator") { compoundCount++ }
})

if (selectorNode.type !== "root" && selectorNode.type !== "pseudo" && compoundCount > max) {
Expand Down

0 comments on commit b48dd35

Please sign in to comment.