diff --git a/lib/rules/max-file-line-count.js b/lib/rules/max-file-line-count.js index 3bad530c..5cc08125 100644 --- a/lib/rules/max-file-line-count.js +++ b/lib/rules/max-file-line-count.js @@ -2,18 +2,6 @@ var helpers = require('../helpers'); -/** - * Get the 'last' node of the tree - * - * @param {Object} node - The node whose last child we want to return - * @returns {Object} The last node - */ -var getLastNode = function (node) { - var last = node.last(); - - return last ? getLastNode(last) : node; -}; - module.exports = { 'name': 'max-file-line-count', 'defaults': { @@ -21,24 +9,13 @@ module.exports = { }, 'detect': function (ast, parser) { var result = []; - var last; - - // If the syntax is Sass we must recursively loop to determine the last node. - // This is not required for SCSS which will always use the last node in the - // content of the parent stylesheet node - if (ast.syntax === 'sass') { - last = getLastNode(ast); - } - else { - last = ast.content[ast.content.length - 1]; - } - if (last.end.line > parser.options.length) { + if (ast.end.line > parser.options.length) { result = helpers.addUnique(result, { 'ruleId': parser.rule.name, - 'line': last.end.line, + 'line': ast.end.line, 'column': 0, - 'message': 'This file has ' + last.end.line + ' lines, which exceeds the maximum of ' + parser.options.length + ' lines allowed.', + 'message': 'This file has ' + ast.end.line + ' lines, which exceeds the maximum of ' + parser.options.length + ' lines allowed.', 'severity': parser.severity }); }