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 at the top of either a file or function block and are applied to the scope in which they occur.

// Strict mode is invoked for the entire script"use strict";varfoo;functionbar(){varbaz;}

varfoo;functionbar(){// Strict mode is only invoked within this function"use strict";varbaz;}

Rule Details

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 rule if this is a style you would like to enforce.