UNPKG

646 BJavaScriptView Raw
1/**
2 * @fileoverview Rule to flag global strict mode.
3 * @author Nicholas C. Zakas
4 */
5"use strict";
6
7//------------------------------------------------------------------------------
8// Rule Definition
9//------------------------------------------------------------------------------
10
11module.exports = function(context) {
12
13 return {
14
15 "ExpressionStatement": function(node) {
16
17 var parent = context.getAncestors().pop();
18
19 if (node.expression.value === "use strict" && parent.type === "Program") {
20 context.report(node, "Use the function form of \"use strict\".");
21 }
22
23 }
24 };
25
26};