From cba4c7042d1652e2d4c21bf332f1fa2842d9ee0a Mon Sep 17 00:00:00 2001 From: Michael Krotscheck Date: Fri, 28 Aug 2015 09:01:30 -0700 Subject: [PATCH] Enable strict This enables the function form of the "use strict" invocation. In general, 'strict' is considered a good practice, so enabling it is good. Requiring the function method of use strict avoid a common bug encountered with a global strict declaration, where the rule applies to all javascript that comes after the global "use strict" statement. Using the function method prevents brittleness, by creating a scope around the 'strict' case. http://eslint.org/docs/rules/strict Change-Id: I5c89c26d2d7a38c342e7c8f49f8cabe145dd02c0 --- .eslintrc | 2 +- index.js | 1 + spec/index.js | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index 8ef185b..36312af 100644 --- a/.eslintrc +++ b/.eslintrc @@ -418,7 +418,7 @@ rules: # controls location of Use Strict Directives # http://eslint.org/docs/rules/strict strict: - - 0 # TODO(krotscheck): Discuss & Activate + - 2 - "function" ############################################################################# diff --git a/index.js b/index.js index bd4837c..b4f9684 100644 --- a/index.js +++ b/index.js @@ -19,6 +19,7 @@ * as a module. */ (function () { + "use strict"; var yaml = require('js-yaml'); var fs = require('fs'); diff --git a/spec/index.js b/spec/index.js index b43115e..3a0c26b 100644 --- a/spec/index.js +++ b/spec/index.js @@ -1,4 +1,5 @@ describe("Unit: eslint-config-openstack", function() { + "use strict"; it("should set espree as the default parser.", function() { var config = require('../index');