Skip to content

Commit cc5959f

Browse files
committed
Update rules concerning newlines around directives
1 parent b0eb37c commit cc5959f

1 file changed

Lines changed: 40 additions & 24 deletions

File tree

etc/eslint/rules/style.js

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -601,30 +601,6 @@ rules[ 'lines-around-comment' ] = [ 'off', {
601601
'allowArrayEnd': true
602602
}];
603603

604-
/**
605-
* Always require a blank newline after a directive.
606-
*
607-
* @name lines-around-directive
608-
* @memberof rules
609-
* @type {Array}
610-
* @see [lines-around-directive]{@link http://eslint.org/docs/rules/lines-around-directive}
611-
*
612-
* @example
613-
* // Bad...
614-
* "use strict";
615-
* var x = 5;
616-
*
617-
* @example
618-
* // Good...
619-
* "use strict";
620-
*
621-
* var x = 5;
622-
*/
623-
rules[ 'lines-around-directive' ] = [ 'error', {
624-
'before': 'never',
625-
'after': 'always'
626-
}];
627-
628604
/**
629605
* Enforce a maximum depth that blocks can be nested.
630606
*
@@ -1440,6 +1416,46 @@ rules[ 'operator-linebreak' ] = [ 'error', 'after' ];
14401416
*/
14411417
rules[ 'padded-blocks' ] = [ 'error', 'never' ];
14421418

1419+
/**
1420+
* Specify padding between statements.
1421+
*
1422+
* @name padding-line-between-statements
1423+
* @memberof rules
1424+
* @type {Array}
1425+
* @see [padding-line-between-statements]{@link http://eslint.org/docs/rules/padding-line-between-statements}
1426+
*
1427+
* @example
1428+
* // Bad...
1429+
* "use strict";
1430+
* var x = 5;
1431+
*
1432+
* @example
1433+
* // Good...
1434+
* "use strict";
1435+
*
1436+
* var x = 5;
1437+
*/
1438+
rules[ 'padding-line-between-statements' ] = [ 'error',
1439+
// Never allow a blank line before a directive...
1440+
{
1441+
'blankLine': 'never',
1442+
'prev': '*',
1443+
'next': 'directive'
1444+
},
1445+
// Always require a blank line after a directive...
1446+
{
1447+
'blankLine': 'always',
1448+
'prev': 'directive',
1449+
'next': '*'
1450+
},
1451+
// But allow directives to be grouped together...
1452+
{
1453+
'blankLine': 'any',
1454+
'prev': 'directive',
1455+
'next': 'directive'
1456+
}
1457+
];
1458+
14431459
/**
14441460
* Always quote object literal property names.
14451461
*

0 commit comments

Comments
 (0)