Enable the no-var
linting rule in test/testutils.js
This is done automatically with the `gulp lint --fix` command with the only exception of the `parts` variable.
This commit is contained in:
parent
a24982a733
commit
71326c6a1c
@ -13,13 +13,12 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* eslint-disable no-var */
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var fs = require("fs");
|
const fs = require("fs");
|
||||||
var path = require("path");
|
const path = require("path");
|
||||||
var rimrafSync = require("rimraf").sync;
|
const rimrafSync = require("rimraf").sync;
|
||||||
|
|
||||||
exports.removeDirSync = function removeDirSync(dir) {
|
exports.removeDirSync = function removeDirSync(dir) {
|
||||||
fs.readdirSync(dir); // Will throw if dir is not a directory
|
fs.readdirSync(dir); // Will throw if dir is not a directory
|
||||||
@ -29,14 +28,14 @@ exports.removeDirSync = function removeDirSync(dir) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.copySubtreeSync = function copySubtreeSync(src, dest) {
|
exports.copySubtreeSync = function copySubtreeSync(src, dest) {
|
||||||
var files = fs.readdirSync(src);
|
const files = fs.readdirSync(src);
|
||||||
if (!fs.existsSync(dest)) {
|
if (!fs.existsSync(dest)) {
|
||||||
fs.mkdirSync(dest);
|
fs.mkdirSync(dest);
|
||||||
}
|
}
|
||||||
files.forEach(function (filename) {
|
files.forEach(function (filename) {
|
||||||
var srcFile = path.join(src, filename);
|
const srcFile = path.join(src, filename);
|
||||||
var file = path.join(dest, filename);
|
const file = path.join(dest, filename);
|
||||||
var stats = fs.statSync(srcFile);
|
const stats = fs.statSync(srcFile);
|
||||||
if (stats.isDirectory()) {
|
if (stats.isDirectory()) {
|
||||||
copySubtreeSync(srcFile, file);
|
copySubtreeSync(srcFile, file);
|
||||||
} else {
|
} else {
|
||||||
@ -49,8 +48,8 @@ exports.ensureDirSync = function ensureDirSync(dir) {
|
|||||||
if (fs.existsSync(dir)) {
|
if (fs.existsSync(dir)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var parts = dir.split(path.sep),
|
const parts = dir.split(path.sep);
|
||||||
i = parts.length;
|
let i = parts.length;
|
||||||
while (i > 1 && !fs.existsSync(parts.slice(0, i - 1).join(path.sep))) {
|
while (i > 1 && !fs.existsSync(parts.slice(0, i - 1).join(path.sep))) {
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user