|
37 | 37 | * ```js |
38 | 38 | * var aLineOf41Chars = 1234567890123456789; |
39 | 39 | * ``` |
| 40 | + * |
| 41 | + * #### Example for allExcept functionSignature |
| 42 | + * |
| 43 | + * ```js |
| 44 | + * "maximumLineLength": { "value": 40, "allExcept": [ "functionSignature" ] } |
| 45 | + * ``` |
| 46 | + * |
| 47 | + * ##### Valid |
| 48 | + * |
| 49 | + * ```js |
| 50 | + * var f = function(with, many, _many_, arguments) { .... }; |
| 51 | + * let f = x => x * x * x * x * x * x * x * x; |
| 52 | + * (function(foo, bar, baz, quux, cuttlefish) { |
| 53 | + * function namesNaamesNaaamesNaaaames() { |
| 54 | + * ... |
| 55 | + * } |
| 56 | + * })(); |
| 57 | + * const longNameIgnoredAsWell = (a, b) => a * b; |
| 58 | + * class X { myLongMethodName(withPossiblyManyArgs) { ... } }; |
| 59 | + * ``` |
| 60 | + * |
| 61 | + * ##### Invalid |
| 62 | + * |
| 63 | + * ```js |
| 64 | + * function x() { // valid |
| 65 | + * return "function_bodies_are_not_protected"; |
| 66 | + * } |
| 67 | + * ``` |
40 | 68 | */ |
41 | 69 |
|
42 | 70 | var assert = require('assert'); |
@@ -134,11 +162,11 @@ module.exports.prototype = { |
134 | 162 |
|
135 | 163 | file.iterateNodesByType('MethodDefinition', function(node) { |
136 | 164 | removeLoc(node.key); |
137 | | - // node.value is a FunctionExpression, params are handled there |
138 | 165 | }); |
139 | 166 |
|
140 | | - file.iterateNodesByType('FunctionExpression', function(node) { |
141 | | - // need to remove the first line, because we can't be sure there's any id or params |
| 167 | + file.iterateNodesByType(['ArrowFunctionExpression', 'FunctionExpression'], function(node) { |
| 168 | + |
| 169 | + // Need to remove the first line, because we can't be sure there's any id or params |
142 | 170 | lines[node.loc.start.line - 1] = ''; |
143 | 171 | if (node.id) { |
144 | 172 | removeLoc(node.id); |
|
0 commit comments