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

Commit

Permalink
requireNewlineBeforeSingleStatementsInIf: make lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
markelog committed Feb 27, 2016
1 parent f9f203b commit ce34c05
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions lib/rules/require-newline-before-single-statements-in-if.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,12 @@ module.exports.prototype = {

function assertDifferentLine(token, nextToken) {
errors.assert.differentLine({
token: token,
nextToken: nextToken,
message: 'Newline before single statement in if is required'
token: token,
nextToken: nextToken,
message: 'Newline before single statement in if is required'
});
}

// Recursively locate a token based on it's type.
function getToken(entity, tokenType, tokenProperty) {
if (entity.type === tokenType || !entity[tokenProperty]) {
return entity;
}

return getToken(entity[tokenProperty], tokenType, tokenProperty);
}

file.iterateNodesByType('IfStatement', function(node) {
var token;
var consequentNode = node.consequent;
Expand Down

0 comments on commit ce34c05

Please sign in to comment.