Skip to content

Commit

Permalink
Update: update docs and fix coding style issue (refs eslint#5958)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorbal committed Sep 7, 2016
1 parent a68f4a1 commit 0b6e24b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions docs/rules/newline-before-return.md
@@ -1,5 +1,7 @@
# require an empty line before `return` statements (newline-before-return)

(fixable) The `--fix` option on the [command line](../user-guide/command-line-interface#fix) automatically fixes problems reported by this rule.

There is no hard and fast rule about whether empty lines should precede `return` statements in JavaScript. However, clearly delineating where a function is returning can greatly increase the readability and clarity of the code. For example:

```js
Expand Down
14 changes: 7 additions & 7 deletions lib/rules/newline-before-return.js
Expand Up @@ -113,13 +113,13 @@ module.exports = {
let lineNumTokenBefore;

/**
* Global return (at the beginning of a script) is a special case.
* If there is no token before `return`, then we expect no line
* break before the return. Comments are allowed to occupy lines
* before the global return, just no blank lines.
* Setting lineNumTokenBefore to zero in that case results in the
* desired behavior.
*/
* Global return (at the beginning of a script) is a special case.
* If there is no token before `return`, then we expect no line
* break before the return. Comments are allowed to occupy lines
* before the global return, just no blank lines.
* Setting lineNumTokenBefore to zero in that case results in the
* desired behavior.
*/
if (tokenBefore) {
lineNumTokenBefore = tokenBefore.loc.end.line;
} else {
Expand Down

0 comments on commit 0b6e24b

Please sign in to comment.