Skip to content

Commit b0eb37c

Browse files
committed
Add rule
1 parent b2a1a5b commit b0eb37c

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

etc/eslint/rules/style.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,31 @@ rules[ 'no-unneeded-ternary' ] = [ 'error', {
12081208
*/
12091209
rules[ 'no-whitespace-before-property' ] = 'error';
12101210

1211+
/**
1212+
* Require the single line statements of `if`, `else`, `while`, `do-while`, and `for` statements to be on the same line.
1213+
*
1214+
* @name nonblock-statement-body-position
1215+
* @memberof rules
1216+
* @type {Array}
1217+
* @see [nonblock-statement-body-position]{@link http://eslint.org/docs/rules/nonblock-statement-body-position}
1218+
*
1219+
* @example
1220+
* // Bad...
1221+
* if ( x )
1222+
* bar();
1223+
*
1224+
* @example
1225+
* // Good...
1226+
* if ( x ) {
1227+
* bar();
1228+
* }
1229+
*
1230+
* @example
1231+
* // Okay, within the context of this rule, but discouraged...
1232+
* if ( x ) bar();
1233+
*/
1234+
rules[ 'nonblock-statement-body-position' ] = [ 'error', 'beside' ];
1235+
12111236
/**
12121237
* Require consistent line breaks inside braces.
12131238
*

0 commit comments

Comments
 (0)