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

`maximumLineLength` - rewrite `functionSignature` handling, include `FunctionExpression` #2040

Closed himdel closed 8 years ago

himdel commented 8 years ago

This closes #2032 - maximumLineLength allExcept: ['functionSignature'] - broken in IIFE.

I've essentially rewritten the functionSignature handling to use iterateNodesByType instead of the recursive searchBodyForDecl, and include FunctionExpression (as well as the previously checked FunctionDeclaration and MethodDefiniton)

Also abstracted common boilerplate into a local removeLoc function - the empty lines .loc.start.line - 1 through .loc.end.line - 1 logic is used in multiple places there and warrants a helper.

Spec changes:

himdel commented 8 years ago

.. Also added support for ArrowFunctionExpression, so now even fooooooooooo => baaaaaaaaar is ignored.

markelog commented 8 years ago

Coverage decreased (-0.001%) to 99.327%

?

Also, would you mind adding example for this param?

himdel commented 8 years ago

Coverage is decreased because 100% of shorter code is less code covered than 100% of longer code , apparently :).

Also, would you mind adding example for this param?

Sure, will do..

himdel commented 8 years ago

..added a few examples..

markelog commented 8 years ago

Thank you!