Skip to content

Commit

Permalink
Fixed: remove hacks related to custom property set.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Jun 30, 2017
1 parent ee17f06 commit cddb022
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
19 changes: 2 additions & 17 deletions lib/rules/no-extra-semicolons/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"use strict"

const hasEmptyBlock = require("../../utils/hasEmptyBlock")
const isCustomPropertySet = require("../../utils/isCustomPropertySet")
const report = require("../../utils/report")
const ruleMessages = require("../../utils/ruleMessages")
Expand Down Expand Up @@ -59,11 +58,6 @@ const rule = function (actual) {
if (rawBeforeNode && rawBeforeNode.trim().length !== 0) {
let allowedSemi = 0

// Forbid semicolon before first custom properties sets
if (isCustomPropertySet(node) && node.parent.index(node) > 0) {
allowedSemi = 1
}

const next = node.next()

// Ignore semicolon before comment if next node is custom properties sets or comment
Expand Down Expand Up @@ -93,18 +87,9 @@ const rule = function (actual) {
const rawAfterNode = node.raws.after

if (rawAfterNode && rawAfterNode.trim().length !== 0) {
let allowedSemi = 0

if (!hasEmptyBlock(node) && isCustomPropertySet(node.nodes[node.nodes.length - 1])) {
allowedSemi = 1
}

styleSearch({ source: rawAfterNode, target: ";" }, (match, count) => {
if (count === allowedSemi) {
return
}

styleSearch({ source: rawAfterNode, target: ";" }, (match) => {
const index = getOffsetByNode(node) + node.toString().length - 1 - rawAfterNode.length + match.startIndex

complain(index)
})
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"micromatch": "^2.3.11",
"normalize-selector": "^0.2.0",
"pify": "^2.3.0",
"postcss": "^6.0.1",
"postcss": "^6.0.4",
"postcss-less": "^0.14.0",
"postcss-media-query-parser": "^0.2.0",
"postcss-reporter": "^4.0.0",
Expand Down

0 comments on commit cddb022

Please sign in to comment.