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 bbad821c39)
This commit is contained in:
Michał Gołębiowski-Owczarek 2019-10-09 00:17:55 +02:00
parent ff5a43eb93
commit ac2da4e6b9
12 changed files with 26 additions and 14 deletions

View File

@ -10,5 +10,9 @@
"env": {
"es6": true,
"node": true
},
"rules": {
"strict": ["error", "global"]
}
}

View File

@ -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 = {};

View File

@ -1,3 +1,5 @@
"use strict";
var fs = require( "fs" );
module.exports = function( Release ) {

View File

@ -1,3 +1,5 @@
"use strict";
var
fs = require( "fs" ),
shell = require( "shelljs" ),

View File

@ -1,3 +1,5 @@
"use strict";
module.exports = function( Release, files, complete ) {
var

View File

@ -1,3 +1,5 @@
"use strict";
var fs = require( "fs" ),
npm = require( "npm" ),
chalk = require( "chalk" ),

View File

@ -4,10 +4,9 @@
* and includes/excludes specified modules
*/
"use strict";
module.exports = function( grunt ) {
"use strict";
var fs = require( "fs" ),
requirejs = require( "requirejs" ),
Insight = require( "insight" ),

View File

@ -1,7 +1,6 @@
"use strict";
module.exports = function( grunt ) {
"use strict";
var fs = require( "fs" ),
filename = grunt.option( "filename" ),
distpaths = [

View File

@ -1,7 +1,6 @@
"use strict";
module.exports = ( grunt ) => {
"use strict";
const fs = require( "fs" );
const spawnTest = require( "./lib/spawn_test.js" );
const testsDir = "./test/node_smoke_tests/";

View File

@ -1,3 +1,5 @@
"use strict";
var fs = require( "fs" );
module.exports = function( grunt ) {

View File

@ -1,3 +1,5 @@
"use strict";
var fs = require( "fs" );
module.exports = function( grunt ) {

View File

@ -1,7 +1,6 @@
"use strict";
module.exports = function( grunt ) {
"use strict";
grunt.registerTask( "testswarm", function( commit, configFile, projectName, browserSets,
timeout, testMode ) {
var jobName, config, tests,