diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-10-09 00:17:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-09 00:17:55 +0200 |
commit | bbad821c399da92995a11b88d6684970479d4a9b (patch) | |
tree | 6c37c0b6d7f5115f452bcfbf07b223a03a29d431 | |
parent | 4504fc3d722dd029d861cb47aa65a5edc651c4d3 (diff) | |
download | jquery-bbad821c399da92995a11b88d6684970479d4a9b.tar.gz jquery-bbad821c399da92995a11b88d6684970479d4a9b.zip |
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
-rw-r--r-- | .eslintrc-node.json | 4 | ||||
-rw-r--r-- | Gruntfile.js | 4 | ||||
-rw-r--r-- | build/release.js | 2 | ||||
-rw-r--r-- | build/release/cdn.js | 2 | ||||
-rw-r--r-- | build/release/dist.js | 2 | ||||
-rw-r--r-- | build/tasks/build.js | 5 | ||||
-rw-r--r-- | build/tasks/dist.js | 5 | ||||
-rw-r--r-- | build/tasks/node_smoke_tests.js | 5 | ||||
-rw-r--r-- | build/tasks/qunit_fixture.js | 2 | ||||
-rw-r--r-- | build/tasks/sourcemap.js | 2 | ||||
-rw-r--r-- | build/tasks/testswarm.js | 5 |
11 files changed, 24 insertions, 14 deletions
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 012ce95db..e740690af 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 f666bf116..6011066ff 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 0b1e04a7f..0ca396811 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/tasks/build.js b/build/tasks/build.js index d536f538c..63dfc1ee8 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, |