Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
disallowSpacesInConditionalExpression: do not use getLoc method
Browse files Browse the repository at this point in the history
  • Loading branch information
markelog committed Apr 12, 2016
1 parent 479d071 commit 56a84ba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/rules/disallow-spaces-in-conditional-expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module.exports.prototype = {
var colonToken = file.findPrevOperatorToken(alternateToken, ':');
var token;

if (this._afterTest && test.getLoc().end.line === questionMarkToken.getLoc().start.line) {
if (this._afterTest && file.isOnTheSameLine(test, questionMarkToken)) {
token = file.getPrevToken(questionMarkToken);

errors.assert.noWhitespaceBetween({
Expand All @@ -121,7 +121,7 @@ module.exports.prototype = {
});
}

if (this._beforeConsequent && consequent.getLoc().end.line === questionMarkToken.getLoc().start.line) {
if (this._beforeConsequent && file.isOnTheSameLine(questionMarkToken, consequent)) {
token = file.getNextToken(questionMarkToken);

errors.assert.noWhitespaceBetween({
Expand All @@ -131,7 +131,7 @@ module.exports.prototype = {
});
}

if (this._afterConsequent && consequent.getLoc().end.line === colonToken.getLoc().start.line) {
if (this._afterConsequent && file.isOnTheSameLine(consequent, colonToken)) {
token = file.getPrevToken(colonToken);

errors.assert.noWhitespaceBetween({
Expand All @@ -141,7 +141,7 @@ module.exports.prototype = {
});
}

if (this._beforeAlternate && alternate.getLoc().end.line === colonToken.getLoc().start.line) {
if (this._beforeAlternate && file.isOnTheSameLine(colonToken, alternate)) {
token = file.getNextToken(colonToken);
errors.assert.noWhitespaceBetween({
token: colonToken,
Expand Down

0 comments on commit 56a84ba

Please sign in to comment.