Skip to content

Commit

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

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

module.exports = {
name: 'attributeQuotes',
Expand All @@ -17,12 +18,14 @@ module.exports = {

selectors.walkAttributes((selector) => {
if (selector.operator && !selector.quoted) {
const column = node.source.start.column + selector.source.start.column
+ selector.attribute.length + selector.operator.length;
const nodeString = nodeToString(node);
const { column, line } = node.positionBy({
index: nodeString.indexOf(selector.value, selector.sourceIndex)
});

results.push({
column,
line: node.source.start.line + selector.source.start.line - 1,
line,
message: this.message
});
}
Expand Down

0 comments on commit 7a4b6f7

Please sign in to comment.