From fbaa986d8f091173a54dcefb0bcb7c60467e321e Mon Sep 17 00:00:00 2001 From: Ryan Zimmerman Date: Tue, 14 May 2019 13:21:28 -0400 Subject: [PATCH] Upgrade to standard v12 --- lib/__tests__/promise.test.js | 2 +- lib/copy-sync/__tests__/broken-symlink.test.js | 2 +- lib/copy-sync/__tests__/copy-sync-file.test.js | 14 +++++++------- .../__tests__/copy-sync-preserve-timestamp.test.js | 4 ++-- lib/copy-sync/__tests__/symlink.test.js | 2 +- lib/copy-sync/copy-sync.js | 2 +- lib/copy/__tests__/copy-preserve-timestamp.test.js | 4 ++-- lib/copy/__tests__/copy.test.js | 4 ++-- lib/copy/__tests__/ncp/broken-symlink.test.js | 2 +- lib/copy/__tests__/ncp/ncp.test.js | 6 +++--- lib/copy/__tests__/ncp/symlink.test.js | 2 +- lib/copy/copy.js | 2 +- lib/ensure/__tests__/symlink-paths.test.js | 14 +++++++------- lib/json/__tests__/output-json-sync.test.js | 4 ++-- lib/json/__tests__/output-json.test.js | 6 +++--- lib/move-sync/__tests__/move-sync.test.js | 10 +++++----- lib/move/__tests__/move.test.js | 10 +++++----- lib/util/__tests__/utimes.test.js | 2 +- package.json | 2 +- 19 files changed, 47 insertions(+), 47 deletions(-) diff --git a/lib/__tests__/promise.test.js b/lib/__tests__/promise.test.js index eb6ad339..2c134687 100644 --- a/lib/__tests__/promise.test.js +++ b/lib/__tests__/promise.test.js @@ -29,7 +29,7 @@ describe('promise support', () => { it('provides fse.promises API', () => { const desc = Object.getOwnPropertyDescriptor(fse, 'promises') assert.ok(desc) - assert.equal(typeof desc.get, 'function') + assert.strictEqual(typeof desc.get, 'function') }) } }) diff --git a/lib/copy-sync/__tests__/broken-symlink.test.js b/lib/copy-sync/__tests__/broken-symlink.test.js index a5e6d57f..d6d5b57b 100644 --- a/lib/copy-sync/__tests__/broken-symlink.test.js +++ b/lib/copy-sync/__tests__/broken-symlink.test.js @@ -28,7 +28,7 @@ describe('copy-sync / broken symlink', () => { }) it('should throw an error when dereference=true', () => { - assert.throws(() => copySync(src, out, {dereference: true}), err => err.code === 'ENOENT') + assert.throws(() => copySync(src, out, { dereference: true }), err => err.code === 'ENOENT') }) }) diff --git a/lib/copy-sync/__tests__/copy-sync-file.test.js b/lib/copy-sync/__tests__/copy-sync-file.test.js index b1122a23..5044214e 100644 --- a/lib/copy-sync/__tests__/copy-sync-file.test.js +++ b/lib/copy-sync/__tests__/copy-sync-file.test.js @@ -136,7 +136,7 @@ describe('+ copySync() / file', () => { describe('> when destination file does NOT exist', () => { describe('> when overwrite is true', () => { it('should copy the file and not throw an error', () => { - fs.copySync(src, dest, {overwrite: true}) + fs.copySync(src, dest, { overwrite: true }) const destData = fs.readFileSync(dest, 'utf8') assert.strictEqual(srcData, destData) }) @@ -144,7 +144,7 @@ describe('+ copySync() / file', () => { describe('> when overwrite is false', () => { it('should copy the file and not throw an error', () => { - fs.copySync(src, dest, {overwrite: false}) + fs.copySync(src, dest, { overwrite: false }) const destData = fs.readFileSync(dest, 'utf8') assert.strictEqual(srcData, destData) }) @@ -161,7 +161,7 @@ describe('+ copySync() / file', () => { describe('> when overwrite is true', () => { it('should copy the file and not throw an error', () => { - fs.copySync(src, dest, {overwrite: true}) + fs.copySync(src, dest, { overwrite: true }) destData = fs.readFileSync(dest, 'utf8') assert.strictEqual(srcData, destData) }) @@ -169,14 +169,14 @@ describe('+ copySync() / file', () => { describe('> when overwrite is false', () => { it('should not throw an error', () => { - fs.copySync(src, dest, {overwrite: false}) + fs.copySync(src, dest, { overwrite: false }) // copy never happened const destDataNew = fs.readFileSync(dest, 'utf8') assert.strictEqual(destData, destDataNew) }) it('should throw an error when errorOnExist is true', () => { - assert.throws(() => fs.copySync(src, dest, {overwrite: false, errorOnExist: true})) + assert.throws(() => fs.copySync(src, dest, { overwrite: false, errorOnExist: true })) // copy never happened const destDataNew = fs.readFileSync(dest, 'utf8') @@ -188,7 +188,7 @@ describe('+ copySync() / file', () => { it('should copy the file and not throw an error', () => { try { fs.chmodSync(dest, parseInt('444', 8)) - fs.copySync(src, dest, {overwrite: true}) + fs.copySync(src, dest, { overwrite: true }) destData = fs.readFileSync(dest, 'utf8') assert.strictEqual(srcData, destData) } finally { @@ -212,7 +212,7 @@ describe('+ copySync() / file', () => { }) it('is an alias for overwrite', () => { - fs.copySync(src, dest, {clobber: false}) + fs.copySync(src, dest, { clobber: false }) // copy never happened const destDataNew = fs.readFileSync(dest, 'utf8') diff --git a/lib/copy-sync/__tests__/copy-sync-preserve-timestamp.test.js b/lib/copy-sync/__tests__/copy-sync-preserve-timestamp.test.js index aa8318d0..39cda0cb 100644 --- a/lib/copy-sync/__tests__/copy-sync-preserve-timestamp.test.js +++ b/lib/copy-sync/__tests__/copy-sync-preserve-timestamp.test.js @@ -32,8 +32,8 @@ describeIfPractical('copySync() - preserveTimestamps option', () => { describe('> when preserveTimestamps option is true', () => { it('should have the same timestamps on copy', () => { - fs.copySync(SRC, DEST, {preserveTimestamps: true}) - FILES.forEach(testFile({preserveTimestamps: true})) + fs.copySync(SRC, DEST, { preserveTimestamps: true }) + FILES.forEach(testFile({ preserveTimestamps: true })) }) }) diff --git a/lib/copy-sync/__tests__/symlink.test.js b/lib/copy-sync/__tests__/symlink.test.js index 1825eece..c6e55080 100644 --- a/lib/copy-sync/__tests__/symlink.test.js +++ b/lib/copy-sync/__tests__/symlink.test.js @@ -35,7 +35,7 @@ describe('copy-sync / symlink', () => { it('copies file contents when dereference=true', () => { try { - copySync(src, out, {dereference: true}) + copySync(src, out, { dereference: true }) } catch (err) { assert.ifError(err) } diff --git a/lib/copy-sync/copy-sync.js b/lib/copy-sync/copy-sync.js index 0ca35c85..bb70e819 100644 --- a/lib/copy-sync/copy-sync.js +++ b/lib/copy-sync/copy-sync.js @@ -10,7 +10,7 @@ const stat = require('../util/stat') function copySync (src, dest, opts) { if (typeof opts === 'function') { - opts = {filter: opts} + opts = { filter: opts } } opts = opts || {} diff --git a/lib/copy/__tests__/copy-preserve-timestamp.test.js b/lib/copy/__tests__/copy-preserve-timestamp.test.js index 3e1e5584..ba52cb43 100644 --- a/lib/copy/__tests__/copy-preserve-timestamp.test.js +++ b/lib/copy/__tests__/copy-preserve-timestamp.test.js @@ -33,8 +33,8 @@ describeIfPractical('copy() - preserve timestamp', () => { describe('> when timestamp option is true', () => { it('should have the same timestamps on copy', done => { - copy(SRC, DEST, {preserveTimestamps: true}, () => { - FILES.forEach(testFile({preserveTimestamps: true})) + copy(SRC, DEST, { preserveTimestamps: true }, () => { + FILES.forEach(testFile({ preserveTimestamps: true })) done() }) }) diff --git a/lib/copy/__tests__/copy.test.js b/lib/copy/__tests__/copy.test.js index 9c1ce7f8..798bafd6 100644 --- a/lib/copy/__tests__/copy.test.js +++ b/lib/copy/__tests__/copy.test.js @@ -38,7 +38,7 @@ describe('fs-extra', () => { fse.ensureFileSync(src) fse.ensureFileSync(dest) - fse.copy(src, dest, {overwrite: false, errorOnExist: true}, err => { + fse.copy(src, dest, { overwrite: false, errorOnExist: true }, err => { assert(err) done() }) @@ -50,7 +50,7 @@ describe('fs-extra', () => { fse.ensureFileSync(src) fse.ensureFileSync(dest) - fse.copy(src, dest, {overwrite: false, errorOnExist: true}, err => { + fse.copy(src, dest, { overwrite: false, errorOnExist: true }, err => { assert(err) done() }) diff --git a/lib/copy/__tests__/ncp/broken-symlink.test.js b/lib/copy/__tests__/ncp/broken-symlink.test.js index 461fa85d..572e821d 100644 --- a/lib/copy/__tests__/ncp/broken-symlink.test.js +++ b/lib/copy/__tests__/ncp/broken-symlink.test.js @@ -31,7 +31,7 @@ describe('ncp broken symlink', () => { }) it('should return an error when dereference=true', done => { - ncp(src, out, {dereference: true}, err => { + ncp(src, out, { dereference: true }, err => { assert.strictEqual(err.code, 'ENOENT') done() }) diff --git a/lib/copy/__tests__/ncp/ncp.test.js b/lib/copy/__tests__/ncp/ncp.test.js index fab4bc3f..d22d64d2 100644 --- a/lib/copy/__tests__/ncp/ncp.test.js +++ b/lib/copy/__tests__/ncp/ncp.test.js @@ -72,7 +72,7 @@ describe('ncp', () => { }) it('the copy is complete after callback', done => { - ncp(src, out, {overwrite: true}, err => { + ncp(src, out, { overwrite: true }, err => { fs.createReadStream = () => done(new Error('createReadStream after callback')) assert.ifError(err) @@ -85,7 +85,7 @@ describe('ncp', () => { beforeEach(done => rimraf(out, done)) it('works', cb => { - ncp(src, out, {overwrite: false}, err => { + ncp(src, out, { overwrite: false }, err => { assert.ifError(err) cb() }) @@ -93,7 +93,7 @@ describe('ncp', () => { it('should not error if files exist', cb => { ncp(src, out, () => { - ncp(src, out, {overwrite: false}, err => { + ncp(src, out, { overwrite: false }, err => { assert.ifError(err) cb() }) diff --git a/lib/copy/__tests__/ncp/symlink.test.js b/lib/copy/__tests__/ncp/symlink.test.js index 87ec3f1f..dc1d3073 100644 --- a/lib/copy/__tests__/ncp/symlink.test.js +++ b/lib/copy/__tests__/ncp/symlink.test.js @@ -35,7 +35,7 @@ describe('ncp / symlink', () => { }) it('copies file contents when dereference=true', done => { - ncp(src, out, {dereference: true}, err => { + ncp(src, out, { dereference: true }, err => { assert.ifError(err) const fileSymlinkPath = path.join(out, 'file-symlink') diff --git a/lib/copy/copy.js b/lib/copy/copy.js index b5738b72..fdab802c 100644 --- a/lib/copy/copy.js +++ b/lib/copy/copy.js @@ -14,7 +14,7 @@ function copy (src, dest, opts, cb) { cb = opts opts = {} } else if (typeof opts === 'function') { - opts = {filter: opts} + opts = { filter: opts } } cb = cb || function () {} diff --git a/lib/ensure/__tests__/symlink-paths.test.js b/lib/ensure/__tests__/symlink-paths.test.js index 518b45d0..8db4e858 100644 --- a/lib/ensure/__tests__/symlink-paths.test.js +++ b/lib/ensure/__tests__/symlink-paths.test.js @@ -38,16 +38,16 @@ describe('symlink-type', () => { }) const tests = [ - [['foo.txt', 'symlink.txt'], {toCwd: 'foo.txt', toDst: 'foo.txt'}], // smart && nodestyle - [['foo.txt', 'empty-dir/symlink.txt'], {toCwd: 'foo.txt', toDst: '../foo.txt'}], // smart - [['../foo.txt', 'empty-dir/symlink.txt'], {toCwd: 'foo.txt', toDst: '../foo.txt'}], // nodestyle - [['foo.txt', 'dir-bar/symlink.txt'], {toCwd: 'foo.txt', toDst: '../foo.txt'}], // smart - [['../foo.txt', 'dir-bar/symlink.txt'], {toCwd: 'foo.txt', toDst: '../foo.txt'}], // nodestyle + [['foo.txt', 'symlink.txt'], { toCwd: 'foo.txt', toDst: 'foo.txt' }], // smart && nodestyle + [['foo.txt', 'empty-dir/symlink.txt'], { toCwd: 'foo.txt', toDst: '../foo.txt' }], // smart + [['../foo.txt', 'empty-dir/symlink.txt'], { toCwd: 'foo.txt', toDst: '../foo.txt' }], // nodestyle + [['foo.txt', 'dir-bar/symlink.txt'], { toCwd: 'foo.txt', toDst: '../foo.txt' }], // smart + [['../foo.txt', 'dir-bar/symlink.txt'], { toCwd: 'foo.txt', toDst: '../foo.txt' }], // nodestyle // this is to preserve node's symlink capability these arguments say create // a link to 'dir-foo/foo.txt' this works because it exists this is unlike // the previous example with 'empty-dir' because 'empty-dir/foo.txt' does not exist. - [['foo.txt', 'dir-foo/symlink.txt'], {toCwd: 'dir-foo/foo.txt', toDst: 'foo.txt'}], // nodestyle - [['foo.txt', 'real-alpha/real-beta/real-gamma/symlink.txt'], {toCwd: 'foo.txt', toDst: '../../../foo.txt'}] + [['foo.txt', 'dir-foo/symlink.txt'], { toCwd: 'dir-foo/foo.txt', toDst: 'foo.txt' }], // nodestyle + [['foo.txt', 'real-alpha/real-beta/real-gamma/symlink.txt'], { toCwd: 'foo.txt', toDst: '../../../foo.txt' }] ] // formats paths to pass on multiple operating systems diff --git a/lib/json/__tests__/output-json-sync.test.js b/lib/json/__tests__/output-json-sync.test.js index a4bc8c50..671fe792 100644 --- a/lib/json/__tests__/output-json-sync.test.js +++ b/lib/json/__tests__/output-json-sync.test.js @@ -22,7 +22,7 @@ describe('json', () => { const file = path.join(TEST_DIR, 'this-dir', 'does-not', 'exist', 'file.json') assert(!fs.existsSync(file)) - const data = {name: 'JP'} + const data = { name: 'JP' } outputJsonSync(file, data) assert(fs.existsSync(file)) @@ -37,7 +37,7 @@ describe('json', () => { assert(!fs.existsSync(file)) const replacer = (k, v) => v === 'JP' ? 'Jon Paul' : v - const data = {name: 'JP'} + const data = { name: 'JP' } outputJsonSync(file, data, { replacer }) const newData = JSON.parse(fs.readFileSync(file, 'utf8')) diff --git a/lib/json/__tests__/output-json.test.js b/lib/json/__tests__/output-json.test.js index f69108a6..c98370be 100644 --- a/lib/json/__tests__/output-json.test.js +++ b/lib/json/__tests__/output-json.test.js @@ -22,7 +22,7 @@ describe('json', () => { const file = path.join(TEST_DIR, 'this-dir', 'prob-does-not', 'exist', 'file.json') assert(!fs.existsSync(file)) - const data = {name: 'JP'} + const data = { name: 'JP' } outputJson(file, data, err => { if (err) return done(err) @@ -38,7 +38,7 @@ describe('json', () => { const file = path.join(TEST_DIR, 'this-dir', 'prob-does-not', 'exist', 'file.json') assert(!fs.existsSync(file)) - const data = {name: 'JP'} + const data = { name: 'JP' } return outputJson(file, data) }) @@ -48,7 +48,7 @@ describe('json', () => { assert(!fs.existsSync(file)) const replacer = (k, v) => v === 'JP' ? 'Jon Paul' : v - const data = {name: 'JP'} + const data = { name: 'JP' } outputJson(file, data, { replacer }, err => { assert.ifError(err) diff --git a/lib/move-sync/__tests__/move-sync.test.js b/lib/move-sync/__tests__/move-sync.test.js index e4b97ddb..13f50322 100644 --- a/lib/move-sync/__tests__/move-sync.test.js +++ b/lib/move-sync/__tests__/move-sync.test.js @@ -103,7 +103,7 @@ describe('moveSync()', () => { assert(fs.existsSync(dest)) try { - fse.moveSync(src, dest, {overwrite: false}) + fse.moveSync(src, dest, { overwrite: false }) } catch (err) { assert.strictEqual(err.message, 'dest already exists.') } @@ -116,7 +116,7 @@ describe('moveSync()', () => { // verify file exists already assert(fs.existsSync(dest)) - fse.moveSync(src, dest, {overwrite: true}) + fse.moveSync(src, dest, { overwrite: true }) const contents = fs.readFileSync(dest, 'utf8') const expected = /^sonic the hedgehog\r?\n$/ @@ -137,7 +137,7 @@ describe('moveSync()', () => { assert(pathsBefore.indexOf('another-file') >= 0) assert(pathsBefore.indexOf('another-folder') >= 0) - fse.moveSync(src, dest, {overwrite: true}) + fse.moveSync(src, dest, { overwrite: true }) // verify dest does not have old stuff const pathsAfter = fs.readdirSync(dest) @@ -198,7 +198,7 @@ describe('moveSync()', () => { setUpMockFs('EXDEV') - fse.moveSync(src, dest, {overwrite: true}) + fse.moveSync(src, dest, { overwrite: true }) const contents = fs.readFileSync(dest + '/another-folder/file3', 'utf8') const expected = /^knuckles\r?\n$/ @@ -228,7 +228,7 @@ describe('moveSync()', () => { // verify file exists already assert(fs.existsSync(dest)) - fse.moveSync(src, dest, {clobber: true}) + fse.moveSync(src, dest, { clobber: true }) const contents = fs.readFileSync(dest, 'utf8') const expected = /^sonic the hedgehog\r?\n$/ diff --git a/lib/move/__tests__/move.test.js b/lib/move/__tests__/move.test.js index 7ee2ac02..617ed0be 100644 --- a/lib/move/__tests__/move.test.js +++ b/lib/move/__tests__/move.test.js @@ -60,7 +60,7 @@ describe('+ move()', () => { // verify file exists already assert(fs.existsSync(dest)) - fse.move(src, dest, {overwrite: true}, err => { + fse.move(src, dest, { overwrite: true }, err => { assert.ifError(err) fs.readFile(dest, 'utf8', (err, contents) => { const expected = /^sonic the hedgehog\r?\n$/ @@ -85,7 +85,7 @@ describe('+ move()', () => { assert(paths.indexOf('another-file') >= 0) assert(paths.indexOf('another-folder') >= 0) - fse.move(src, dest, {overwrite: true}, err => { + fse.move(src, dest, { overwrite: true }, err => { assert.ifError(err) // verify dest does not have old stuff @@ -109,7 +109,7 @@ describe('+ move()', () => { setUpMockFs('EXDEV') - fse.move(src, dest, {overwrite: true}, err => { + fse.move(src, dest, { overwrite: true }, err => { assert.ifError(err) assert.strictEqual(fs.rename.callCount, 1) @@ -190,7 +190,7 @@ describe('+ move()', () => { // verify file exists already assert(fs.existsSync(dest)) - fse.move(src, dest, {overwrite: false}, err => { + fse.move(src, dest, { overwrite: false }, err => { assert.strictEqual(err.message, 'dest already exists.') done() }) @@ -281,7 +281,7 @@ describe('+ move()', () => { // verify file exists already assert(fs.existsSync(dest)) - fse.move(src, dest, {clobber: true}, err => { + fse.move(src, dest, { clobber: true }, err => { assert.ifError(err) fs.readFile(dest, 'utf8', (err, contents) => { const expected = /^sonic the hedgehog\r?\n$/ diff --git a/lib/util/__tests__/utimes.test.js b/lib/util/__tests__/utimes.test.js index f79199d5..103661d3 100644 --- a/lib/util/__tests__/utimes.test.js +++ b/lib/util/__tests__/utimes.test.js @@ -19,7 +19,7 @@ describe('utimes', () => { fse.emptyDir(TEST_DIR, done) // reset stubs gracefulFsStub = {} - utimes = proxyquire('../utimes', {'graceful-fs': gracefulFsStub}) + utimes = proxyquire('../utimes', { 'graceful-fs': gracefulFsStub }) }) describe('hasMillisResSync()', () => { diff --git a/package.json b/package.json index 462b2443..fe78288d 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "proxyquire": "^2.0.1", "read-dir-files": "^0.1.1", "semver": "^5.3.0", - "standard": "^11.0.1" + "standard": "^12.0.1" }, "main": "./lib/index.js", "scripts": {