Skip to content
Browse files

Docs: newline-after-var doesn't allow invalid options.

  • Loading branch information...
alberto committed Jan 18, 2016
1 parent 4bfa496 commit a456077444d5ac2ad1247d4c146fe84fc5303596
Showing with 8 additions and 3 deletions.
  1. +7 −1 docs/rules/
  2. +1 −2 lib/rules/newline-after-var.js
@@ -20,7 +20,13 @@ The problem is when these developers work together in a project. This rule enfor
## Rule Details

This rule enforces a coding style where empty newlines are required or disallowed after `var`, `let`, or `const` statements to achieve a consistent coding style across the project.
Invalid option value (anything other than `always` nor `never`), defaults to `always`.

### Options

This rule takes one option, a string, which can be:

* `"always"` enforces empty newlines after `var`, `let` or `const` (default)
* `"never"` disallows empty newlines after `var`, `let` or `const`

The following patterns are considered problems:

@@ -17,8 +17,7 @@ module.exports = function(context) {
var ALWAYS_MESSAGE = "Expected blank line after variable declarations.",
NEVER_MESSAGE = "Unexpected blank line after variable declarations.";

// Default `mode` to "always". This means that invalid options will also
// be treated as "always" and the only special case is "never"
// Default `mode` to "always".
var mode = context.options[0] === "never" ? "never" : "always";

// Cache starting and ending line numbers of comments for faster lookup

0 comments on commit a456077

Please sign in to comment.
You can’t perform that action at this time.