From: Michał Gołębiowski-Owczarek Date: Tue, 8 Oct 2019 22:17:55 +0000 (+0200) Subject: Build: Require strict mode in Node.js scripts via ESLint X-Git-Tag: 3.5.0~35 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ac2da4e6b96f5b583c4dfe148a9a9e870465fc69;p=jquery.git Build: Require strict mode in Node.js scripts via ESLint So far, only browser-based JS files were required to be in strict mode (in the function form). This commit adds such a requirement to Node.js scripts where the global form is preferred. All Node.js scripts in sloppy mode were converted to strict mode. Closes gh-4499 (cherry picked from commit bbad821c399da92995a11b88d6684970479d4a9b) --- diff --git a/.eslintrc-node.json b/.eslintrc-node.json index 589144272..544a92cdc 100644 --- a/.eslintrc-node.json +++ b/.eslintrc-node.json @@ -10,5 +10,9 @@ "env": { "es6": true, "node": true + }, + + "rules": { + "strict": ["error", "global"] } } diff --git a/Gruntfile.js b/Gruntfile.js index 9524e70c0..8458a6772 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,6 +1,6 @@ -module.exports = function( grunt ) { - "use strict"; +"use strict"; +module.exports = function( grunt ) { function readOptionalJSON( filepath ) { var stripJSONComments = require( "strip-json-comments" ), data = {}; diff --git a/build/release.js b/build/release.js index a3b5fc2ba..a9713fc08 100644 --- a/build/release.js +++ b/build/release.js @@ -1,3 +1,5 @@ +"use strict"; + var fs = require( "fs" ); module.exports = function( Release ) { diff --git a/build/release/cdn.js b/build/release/cdn.js index c65c53e8c..3d96d0179 100644 --- a/build/release/cdn.js +++ b/build/release/cdn.js @@ -1,3 +1,5 @@ +"use strict"; + var fs = require( "fs" ), shell = require( "shelljs" ), diff --git a/build/release/dist.js b/build/release/dist.js index ef4ee7c92..9120aa2ac 100644 --- a/build/release/dist.js +++ b/build/release/dist.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function( Release, files, complete ) { var diff --git a/build/release/ensure-sizzle.js b/build/release/ensure-sizzle.js index f9c5c70dd..eb1cbd8e8 100644 --- a/build/release/ensure-sizzle.js +++ b/build/release/ensure-sizzle.js @@ -1,3 +1,5 @@ +"use strict"; + var fs = require( "fs" ), npm = require( "npm" ), chalk = require( "chalk" ), diff --git a/build/tasks/build.js b/build/tasks/build.js index 73dfd581d..1a6e5d02a 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -4,10 +4,9 @@ * and includes/excludes specified modules */ -module.exports = function( grunt ) { - - "use strict"; +"use strict"; +module.exports = function( grunt ) { var fs = require( "fs" ), requirejs = require( "requirejs" ), Insight = require( "insight" ), diff --git a/build/tasks/dist.js b/build/tasks/dist.js index fa6920c88..f19929b89 100644 --- a/build/tasks/dist.js +++ b/build/tasks/dist.js @@ -1,7 +1,6 @@ -module.exports = function( grunt ) { - - "use strict"; +"use strict"; +module.exports = function( grunt ) { var fs = require( "fs" ), filename = grunt.option( "filename" ), distpaths = [ diff --git a/build/tasks/node_smoke_tests.js b/build/tasks/node_smoke_tests.js index e3d69db88..40c49a4d9 100644 --- a/build/tasks/node_smoke_tests.js +++ b/build/tasks/node_smoke_tests.js @@ -1,7 +1,6 @@ -module.exports = ( grunt ) => { - - "use strict"; +"use strict"; +module.exports = ( grunt ) => { const fs = require( "fs" ); const spawnTest = require( "./lib/spawn_test.js" ); const testsDir = "./test/node_smoke_tests/"; diff --git a/build/tasks/qunit_fixture.js b/build/tasks/qunit_fixture.js index 3f332dad0..138ca662d 100644 --- a/build/tasks/qunit_fixture.js +++ b/build/tasks/qunit_fixture.js @@ -1,3 +1,5 @@ +"use strict"; + var fs = require( "fs" ); module.exports = function( grunt ) { diff --git a/build/tasks/sourcemap.js b/build/tasks/sourcemap.js index 3f21b2afd..509374f2e 100644 --- a/build/tasks/sourcemap.js +++ b/build/tasks/sourcemap.js @@ -1,3 +1,5 @@ +"use strict"; + var fs = require( "fs" ); module.exports = function( grunt ) { diff --git a/build/tasks/testswarm.js b/build/tasks/testswarm.js index 88e883d0f..d2653e0e0 100644 --- a/build/tasks/testswarm.js +++ b/build/tasks/testswarm.js @@ -1,7 +1,6 @@ -module.exports = function( grunt ) { - - "use strict"; +"use strict"; +module.exports = function( grunt ) { grunt.registerTask( "testswarm", function( commit, configFile, projectName, browserSets, timeout, testMode ) { var jobName, config, tests,