Skip to content

Commit

Permalink
Refactor spaceAfterPropertyColon position reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilsson committed Dec 29, 2018
1 parent 7a4b6f7 commit 121eb7b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/linters/space_after_property_colon.js
@@ -1,5 +1,7 @@
'use strict';

const nodeToString = require('../utils/node-to-string');

module.exports = {
name: 'spaceAfterPropertyColon',
nodeTypes: ['decl'],
Expand All @@ -21,9 +23,14 @@ module.exports = {
}

if (!styles[config.style].test(node.raws.between)) {
const nodeString = nodeToString(node);
const { column, line } = node.positionBy({
index: nodeString.indexOf(':') + 1
});

return [{
column: node.source.start.column + node.prop.length + node.raws.between.indexOf(':') + 1,
line: node.source.start.line,
column,
line,
message: this.message[config.style]
}];
}
Expand Down

0 comments on commit 121eb7b

Please sign in to comment.