Skip to content

Commit 2c544b1

Browse files
committed
chore(cs): fix codestyle
Signed-off-by: Tobias Gurtzick <[email protected]>
1 parent 02c6cd6 commit 2c544b1

File tree

6 files changed

+43
-61
lines changed

6 files changed

+43
-61
lines changed

lib/chain.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Chain {
7272

7373
async exec (m, ...args) {
7474
let ret;
75-
let stat = [];
75+
const stat = [];
7676
while (this.step()) {
7777
ret = await this._interface[m].apply(this._interface, args);
7878
stat.push(ret);

lib/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ exports.loadObject = function (_config, currentEnv) {
176176

177177
if (currentEnv) {
178178
out.setCurrent(currentEnv);
179-
} else if (config['default']) {
180-
out.setCurrent(config['default']);
179+
} else if (config.default) {
180+
out.setCurrent(config.default);
181181
} else if (config.defaultEnv) {
182182
if (config.defaultEnv.ENV) {
183183
out.setCurrent(process.env[config.defaultEnv.ENV]);

lib/file.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function formatTitle (title) {
3838
}
3939

4040
function parseDate (name) {
41-
let date = new Date();
41+
const date = new Date();
4242
const match = name.match(/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})-[^.]+/);
4343
date.setUTCFullYear(match[1]);
4444
date.setUTCDate(match[3]);
@@ -125,9 +125,7 @@ File.registerHook = function (Plugin, internals) {
125125

126126
if (plugin.maintainer && plugin.maintainer.repository) {
127127
log.verbose(
128-
`The repo of the ${plugin.name} plugin is ${
129-
plugin.maintainer.repository
130-
}!`
128+
`The repo of the ${plugin.name} plugin is ${plugin.maintainer.repository}!`
131129
);
132130
}
133131
return plugin['migrator:migration:hook:require']();

lib/learn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class STD {
105105
}
106106

107107
removeColumn (t, c, o = {}) {
108-
let alter = {};
108+
const alter = {};
109109
this.checkColumn(t, c);
110110

111111
if (this.schema[t][c].notNull === true) {

lib/state.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,24 @@ module.exports = {
3131

3232
init: async function (driver, internals) {
3333
await driver._createKV(internals.migrationState);
34-
let schema = await driver._getKV(internals.migrationState, SSTATE);
34+
const schema = await driver._getKV(internals.migrationState, SSTATE);
3535
if (schema) {
3636
internals.schema = JSON.parse(schema.value);
3737
} else {
3838
await driver._insertKV(internals.migrationState, SSTATE, '{}');
3939
}
4040

4141
if (!internals.dryRun) {
42-
let state = await driver._getKV(internals.migrationState, MSTATE);
42+
const state = await driver._getKV(internals.migrationState, MSTATE);
4343
return module.exports.lockState(driver, state, internals);
4444
}
4545

4646
return Promise.resolve();
4747
},
4848

4949
startMigration: async function (driver, file, internals) {
50-
let state = await driver._getKV(internals.migrationState, MSTATE);
51-
let mig = await driver._getKV(internals.migrationState, file.name);
50+
const state = await driver._getKV(internals.migrationState, MSTATE);
51+
const mig = await driver._getKV(internals.migrationState, file.name);
5252

5353
if (mig) {
5454
internals.modSchema = JSON.parse(mig.value);

test/migration_test.js

Lines changed: 33 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const fileNameNoExtension = 'filename';
1414
const fileName = 'filename.js';
1515
const templateType = Template.TemplateType.SQL_FILE_LOADER;
1616

17-
let internals = {};
17+
const internals = {};
1818
internals.migrationTable = 'migrations';
1919

2020
lab.experiment('migration', function () {
@@ -52,25 +52,21 @@ function newMigrationObject () {
5252
internals
5353
);
5454

55-
lab.test(
56-
'should have title set without file extension', () => {
57-
Code.expect(migration.title).to.equal(fileNameNoExtension);
58-
}
59-
);
55+
lab.test('should have title set without file extension', () => {
56+
Code.expect(migration.title).to.equal(fileNameNoExtension);
57+
});
6058

6159
lab.test('should have date set', () => {
6260
migration.date.setMilliseconds(0);
6361
date.setMilliseconds(0);
6462
Code.expect(migration.date.getTime()).to.equal(date.getTime());
6563
});
6664

67-
lab.test(
68-
'should have name set without file extension', () => {
69-
Code.expect(migration.name).to.equal(
70-
dateString + '-' + fileNameNoExtension
71-
);
72-
}
73-
);
65+
lab.test('should have name set without file extension', () => {
66+
Code.expect(migration.name).to.equal(
67+
dateString + '-' + fileNameNoExtension
68+
);
69+
});
7470

7571
lab.test('should have path set', () => {
7672
Code.expect(migration.path).to.equal(
@@ -150,12 +146,10 @@ function getTemplate () {
150146
function () {
151147
const migration = new Template(fileName, dirName, date, internals);
152148

153-
lab.test(
154-
'should return default javascript template', () => {
155-
const actual = migration.getTemplate();
156-
Code.expect(actual).to.equal(migration.defaultJsTemplate());
157-
}
158-
);
149+
lab.test('should return default javascript template', () => {
150+
const actual = migration.getTemplate();
151+
Code.expect(actual).to.equal(migration.defaultJsTemplate());
152+
});
159153
}
160154
);
161155

@@ -169,12 +163,10 @@ function getTemplate () {
169163
internals
170164
);
171165

172-
lab.test(
173-
'should return sql file loader template', () => {
174-
const actual = migration.getTemplate();
175-
Code.expect(actual).to.equal(migration.sqlFileLoaderTemplate());
176-
}
177-
);
166+
lab.test('should return sql file loader template', () => {
167+
const actual = migration.getTemplate();
168+
Code.expect(actual).to.equal(migration.sqlFileLoaderTemplate());
169+
});
178170
});
179171

180172
lab.experiment('as default sql', function () {
@@ -186,12 +178,10 @@ function getTemplate () {
186178
internals
187179
);
188180

189-
lab.test(
190-
'should return default sql template', () => {
191-
const actual = migration.getTemplate();
192-
Code.expect(actual).to.equal(migration.defaultSqlTemplate());
193-
}
194-
);
181+
lab.test('should return default sql template', () => {
182+
const actual = migration.getTemplate();
183+
Code.expect(actual).to.equal(migration.defaultSqlTemplate());
184+
});
195185
});
196186

197187
lab.experiment('as default coffee', function () {
@@ -203,12 +193,10 @@ function getTemplate () {
203193
internals
204194
);
205195

206-
lab.test(
207-
'should return default coffee template', () => {
208-
const actual = migration.getTemplate();
209-
Code.expect(actual).to.equal(migration.defaultCoffeeTemplate());
210-
}
211-
);
196+
lab.test('should return default coffee template', () => {
197+
const actual = migration.getTemplate();
198+
Code.expect(actual).to.equal(migration.defaultCoffeeTemplate());
199+
});
212200
});
213201

214202
lab.experiment('as coffee sql loader', function () {
@@ -220,12 +208,10 @@ function getTemplate () {
220208
internals
221209
);
222210

223-
lab.test(
224-
'should return default coffee template', () => {
225-
const actual = migration.getTemplate();
226-
Code.expect(actual).to.equal(migration.coffeeSqlFileLoaderTemplate());
227-
}
228-
);
211+
lab.test('should return default coffee template', () => {
212+
const actual = migration.getTemplate();
213+
Code.expect(actual).to.equal(migration.coffeeSqlFileLoaderTemplate());
214+
});
229215
});
230216

231217
lab.experiment('as default javascript', function () {
@@ -237,12 +223,10 @@ function getTemplate () {
237223
internals
238224
);
239225

240-
lab.test(
241-
'should return default sql template', () => {
242-
const actual = migration.getTemplate();
243-
Code.expect(actual).to.equal(migration.defaultJsTemplate());
244-
}
245-
);
226+
lab.test('should return default sql template', () => {
227+
const actual = migration.getTemplate();
228+
Code.expect(actual).to.equal(migration.defaultJsTemplate());
229+
});
246230
});
247231
});
248232
}

0 commit comments

Comments
 (0)