Skip to content

Commit

Permalink
feat(rules): improve CSS locator error context node selection
Browse files Browse the repository at this point in the history
  • Loading branch information
alecxe committed Jun 21, 2017
1 parent 57092ca commit bc62086
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/rules/no-angular-attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {
extractedAttributes.forEach(function (extractedAttribute) {
if (ANGULAR_ATTR_RE.test(extractedAttribute)) {
context.report({
node: node,
node: node.arguments[0],
message: 'Unexpected Angular attribute "' + extractedAttribute + '" inside a CSS selector'
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-angular-classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
for (var i = 0; i < prohibitedClasses.length; i++) {
if (extractedClassNames.indexOf(prohibitedClasses[i]) >= 0) {
context.report({
node: node,
node: node.arguments[0],
message: 'Unexpected Angular class "' + prohibitedClasses[i] + '" inside a CSS selector'
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-bootstrap-classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
for (var i = 0; i < bootstrapClasses.length; i++) {
if (extractedClassNames.indexOf(bootstrapClasses[i]) >= 0) {
context.report({
node: node,
node: node.arguments[0],
message: 'Unexpected Bootstrap class "' + bootstrapClasses[i] + '" inside a CSS selector'
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-compound-classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {

if (locatorValue.indexOf(' ') >= 0) {
context.report({
node: node,
node: node.arguments[0],
message: 'No compound class names allowed.'
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-invalid-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {
parser.parse(cssSelector)
} catch (err) {
context.report({
node: node,
node: node.arguments[0],
message: 'Invalid CSS selector: "' + cssSelector + '"'
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/use-angular-locators.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
Object.keys(attributeToLocatorMap).forEach(function (key) {
if (node.arguments[0].value.indexOf(key) >= 0) {
context.report({
node: node,
node: node.arguments[0],
message: 'Unexpected "' + key + '" attribute used inside a CSS selector. Use ' + attributeToLocatorMap[key].join(' or ') + ' locator instead'
})
}
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/use-simple-repeaters.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ module.exports = {
if (repeaterValue) {
if (repeaterValue.indexOf('|') > 0) {
context.report({
node: node,
node: node.arguments[0],
message: 'Unexpected filter inside a by.repeater() locator.'
})
}

if (repeaterValue.indexOf('track by') > 0) {
context.report({
node: node,
node: node.arguments[0],
message: 'Unexpected "track by" inside a by.repeater() locator.'
})
}
Expand Down

0 comments on commit bc62086

Please sign in to comment.