jscs-dev / node-jscs

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

disallowPaddingNewlinesBeforeKeywords interprets a comment as a blank line #2237

Closed bcowgill closed 8 years ago

bcowgill commented 8 years ago

// jscs:enable disallowPaddingNewlinesBeforeKeywords if (temp1 < 0) { temp1++; } // comments else { temp1--; } // jscs:disable disallowPaddingNewlinesBeforeKeywords

disallowPaddingNewlinesBeforeKeywords: Keyword else should not have an empty line above it at src/templates/jscs-test.jsx : 166 |if (temp1 < 0) { 167 | temp1++; 168 |} ---------^ 169 |// comments 170 |else {

If I remove the comment line and leave the else uncuddled the error goes away.

// jscs:enable disallowPaddingNewlinesBeforeKeywords if (temp1 < 0) { temp1++; } else { temp1--; } // jscs:disable disallowPaddingNewlinesBeforeKeywords