From b0f383ffd8167bb2d804deb85a009ff826347c8e Mon Sep 17 00:00:00 2001 From: Erisu Date: Tue, 21 Apr 2020 11:29:29 +0900 Subject: [PATCH] chore: applied lint fixes from shelljs removal changes --- bin/lib/utils.js | 8 ++++---- bin/templates/scripts/cordova/lib/clean.js | 1 - tests/spec/unit/build.spec.js | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/lib/utils.js b/bin/lib/utils.js index 32f691ce8a..0704cb540e 100644 --- a/bin/lib/utils.js +++ b/bin/lib/utils.js @@ -35,9 +35,9 @@ const fs = require('fs-extra'); * @returns {void} */ exports.replaceFileContents = function (file, searchRegex, replacementString) { - // let contents; + let contents; try { - var contents = fs.readFileSync(file).toString(); + contents = fs.readFileSync(file).toString(); } catch (ex) { console.log('TRYING TO READ: ', file); throw ex; @@ -54,9 +54,9 @@ exports.replaceFileContents = function (file, searchRegex, replacementString) { * @returns string|null */ exports.grep = function (file, regex) { - let contents = fs.readFileSync(file).toString().replace(/\\r/g, '').split('\n'); + const contents = fs.readFileSync(file).toString().replace(/\\r/g, '').split('\n'); for (let i = 0; i < contents.length; i++) { - let line = contents[i]; + const line = contents[i]; if (regex.test(line)) { return line; } diff --git a/bin/templates/scripts/cordova/lib/clean.js b/bin/templates/scripts/cordova/lib/clean.js index df9349b3ac..0c07b33ffa 100644 --- a/bin/templates/scripts/cordova/lib/clean.js +++ b/bin/templates/scripts/cordova/lib/clean.js @@ -20,7 +20,6 @@ const Q = require('q'); const path = require('path'); const fs = require('fs-extra'); -const shell = require('shelljs'); const superspawn = require('cordova-common').superspawn; const projectPath = path.join(__dirname, '..', '..'); diff --git a/tests/spec/unit/build.spec.js b/tests/spec/unit/build.spec.js index 39723a6b2e..c931bc9039 100644 --- a/tests/spec/unit/build.spec.js +++ b/tests/spec/unit/build.spec.js @@ -414,7 +414,7 @@ describe('build', () => { return buildRequire.findXCodeProjectIn(fakePath).then( () => {}, (error) => { - expect(error).toBe(`No Xcode project found in ${fakePath}`) + expect(error).toBe(`No Xcode project found in ${fakePath}`); } ); }); @@ -424,7 +424,7 @@ describe('build', () => { return buildRequire.findXCodeProjectIn(fakePath).then( (projectName) => { expect(events.emit).toHaveBeenCalledWith(jasmine.any(String), jasmine.stringMatching(/Found multiple .xcodeproj directories in/)); - expect(projectName).toBe('Test1') + expect(projectName).toBe('Test1'); } ); }); @@ -434,7 +434,7 @@ describe('build', () => { return buildRequire.findXCodeProjectIn(fakePath).then( (projectName) => { expect(events.emit).not.toHaveBeenCalled(); - expect(projectName).toBe('Test1') + expect(projectName).toBe('Test1'); } ); });