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
This commit is contained in:
Michał Gołębiowski-Owczarek 2019-10-09 00:17:55 +02:00 committed by GitHub
parent 4504fc3d72
commit bbad821c39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 24 additions and 14 deletions

View File

@ -10,5 +10,9 @@
"env": { "env": {
"es6": true, "es6": true,
"node": 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 ) { function readOptionalJSON( filepath ) {
var stripJSONComments = require( "strip-json-comments" ), var stripJSONComments = require( "strip-json-comments" ),
data = {}; data = {};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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