1 # require or disallow newlines around directives (lines-around-directive)
3 This rule was **deprecated** in ESLint v4.0.0 and replaced by the [padding-line-between-statements](padding-line-between-statements.md) rule.
5 Directives are used in JavaScript to indicate to the execution environment that a script would like to opt into a feature such as `"strict mode"`. Directives are grouped together in a [directive prologue](https://www.ecma-international.org/ecma-262/7.0/#directive-prologue) at the top of either a file or function block and are applied to the scope in which they occur.
8 // Strict mode is invoked for the entire script
22 // Strict mode is only invoked within this function
31 This rule requires or disallows blank newlines around directive prologues. This rule does not enforce any conventions about blank newlines between the individual directives. In addition, it does not require blank newlines before directive prologues unless they are preceded by a comment. Please use the [padded-blocks](padded-blocks.md) rule if this is a style you would like to enforce.
35 This rule has one option. It can either be a string or an object:
37 * `"always"` (default) enforces blank newlines around directives.
38 * `"never"` disallows blank newlines around directives.
44 "before": "always" or "never"
45 "after": "always" or "never",
51 This is the default option.
53 Examples of **incorrect** code for this rule with the `"always"` option:
56 /* eslint lines-around-directive: ["error", "always"] */
81 Examples of **correct** code for this rule with the `"always"` option:
84 /* eslint lines-around-directive: ["error", "always"] */
117 Examples of **incorrect** code for this rule with the `"never"` option:
120 /* eslint lines-around-directive: ["error", "never"] */
155 Examples of **correct** code for this rule with the `"never"` option:
158 /* eslint lines-around-directive: ["error", "never"] */
185 Examples of **incorrect** code for this rule with the `{ "before": "never", "after": "always" }` option:
188 /* eslint lines-around-directive: ["error", { "before": "never", "after": "always" }] */
216 Examples of **correct** code for this rule with the `{ "before": "never", "after": "always" }` option:
219 /* eslint lines-around-directive: ["error", { "before": "never", "after": "always" }] */
248 Examples of **incorrect** code for this rule with the `{ "before": "always", "after": "never" }` option:
251 /* eslint lines-around-directive: ["error", { "before": "always", "after": "never" }] */
280 Examples of **correct** code for this rule with the `{ "before": "always", "after": "never" }` option:
283 /* eslint lines-around-directive: ["error", { "before": "always", "after": "never" }] */
310 ## When Not To Use It
312 You can safely disable this rule if you do not have any strict conventions about whether or not directive prologues should have blank newlines before or after them.
316 * [lines-around-comment](lines-around-comment.md)
317 * [padded-blocks](padded-blocks.md)
321 * **JSCS**: [requirePaddingNewLinesAfterUseStrict](https://jscs-dev.github.io/rule/requirePaddingNewLinesAfterUseStrict)
322 * **JSCS**: [disallowPaddingNewLinesAfterUseStrict](https://jscs-dev.github.io/rule/disallowPaddingNewLinesAfterUseStrict)