Skip to content

Commit 96da647

Browse files
committed
Never allow linebreaks inside function parentheses
1 parent 9ac83f5 commit 96da647

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

etc/eslint/rules/style.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,43 @@ rules[ 'func-style' ] = [ 'error', 'declaration', {
415415
'allowArrowFunctions': false
416416
}];
417417

418+
/**
419+
* Never allow linebreaks inside parentheses of function parameters or arguments.
420+
*
421+
* @name function-paren-newline
422+
* @memberof rules
423+
* @type {Array}
424+
* @default [ 'error', 'never' ]
425+
* @see [function-paren-newline]{@link https://eslint.org/docs/rules/function-paren-newline}
426+
*
427+
* @example
428+
* // Bad...
429+
* function foo(
430+
* x,
431+
* y
432+
* ) {
433+
* return x + y;
434+
* }
435+
*
436+
* @example
437+
* // Bad...
438+
* console.log(
439+
* 1,
440+
* 2
441+
* );
442+
*
443+
* @example
444+
* // Good...
445+
* function foo( x, y ) {
446+
* return x + y;
447+
* }
448+
*
449+
* @example
450+
* // Good...
451+
* console.log( 1, 2 );
452+
*/
453+
rules[ 'function-paren-newline' ] = [ 'error', 'never' ];
454+
418455
/**
419456
* Do not blacklist any identifiers.
420457
*

0 commit comments

Comments
 (0)