jscs-dev / node-jscs

:arrow_heading_up: JavaScript Code Style checker (unmaintained)
https://jscs-dev.github.io
MIT License
4.96k stars 513 forks source link

requireNewlineBeforeSingleStatementsInIf is broken #2182

Closed minj closed 8 years ago

minj commented 8 years ago
Error running rule requireNewlineBeforeSingleStatementsInIf: This is an issue with JSCS and not your codebase.
Please file an issue (with the stack trace below) at: https://github.com/jscs-dev/node-jscs/issues/new
TypeError: Cannot read property 'type' of null
    at isExpressionStatement (/usr/lib/node_modules/jscs/lib/rules/require-newline-before-single-statements-in-if.js:61:26)
    at Object.<anonymous> (/usr/lib/node_modules/jscs/lib/rules/require-newline-before-single-statements-in-if.js:86:17)
    at Array.forEach (native)
    at Object.JsFile.iterateNodesByType (/usr/lib/node_modules/jscs/lib/js-file.js:595:42)
    at Object.module.exports.check (/usr/lib/node_modules/jscs/lib/rules/require-newline-before-single-statements-in-if.js:72:14)
    at null.<anonymous> (/usr/lib/node_modules/jscs/lib/string-checker.js:165:22)
    at Array.forEach (native)
    at StringChecker._checkJsFile (/usr/lib/node_modules/jscs/lib/string-checker.js:161:31)
    at StringChecker.checkString (/usr/lib/node_modules/jscs/lib/string-checker.js:106:14)
    at null.<anonymous> (/usr/lib/node_modules/jscs/lib/checker.js:56:21) at ./content/popup.js :
     1 |'use strict';
--------^
     2 |/**
     3 | * popup.js
markelog commented 8 years ago

Can't repro, would you mind testing it on current master? If this indeed reproducible, can you provide more code?

minj commented 8 years ago

@markelog it seems to be fixed in master.

Bisecting it..

fbe9bf4ad5ab3e2645affee07a5fc5ff19cea35f seems to be first good revision

I guess this is a dupe of #2174