Skip to content

Commit

Permalink
fix(lint): fix linting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainLanz committed Feb 19, 2018
1 parent 03e0302 commit f6ab84e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 39 deletions.
4 changes: 2 additions & 2 deletions src/Factory/DatabaseFactory.js
Expand Up @@ -40,8 +40,8 @@ class DatabaseFactory {
*/
_getQueryBuilder () {
return (this._connection
? ioc.use('Adonis/Src/Database').connection(this._connection)
: ioc.use('Adonis/Src/Database')).table(this.tableName)
? ioc.use('Adonis/Src/Database').connection(this._connection)
: ioc.use('Adonis/Src/Database')).table(this.tableName)
}

/**
Expand Down
20 changes: 10 additions & 10 deletions src/Lucid/GlobalScope/index.js
Expand Up @@ -56,16 +56,16 @@ class ScopeIterator {
}

this._scopes
.filter((scope) => {
if (this._ignoreList.indexOf(scope.name) > -1) {
debug('ignoring scope %s', scope.name)
return false
}
return true
})
.forEach((scope) => {
scope.callback(builder)
})
.filter((scope) => {
if (this._ignoreList.indexOf(scope.name) > -1) {
debug('ignoring scope %s', scope.name)
return false
}
return true
})
.forEach((scope) => {
scope.callback(builder)
})

/**
* Cleaning up to avoid duplicate execution of
Expand Down
28 changes: 14 additions & 14 deletions src/Lucid/Model/index.js
Expand Up @@ -204,8 +204,8 @@ class Model extends BaseModel {
*/
query.on('query', (builder) => {
_(this.$queryListeners)
.filter((listener) => typeof (listener) === 'function')
.each((listener) => listener(builder))
.filter((listener) => typeof (listener) === 'function')
.each((listener) => listener(builder))
})

return query
Expand Down Expand Up @@ -463,10 +463,10 @@ class Model extends BaseModel {
*/
_formatDateFields (values) {
_(this.constructor.dates)
.filter((date) => {
return values[date] && typeof (this[util.getSetterName(date)]) !== 'function'
})
.each((date) => { values[date] = this.constructor.formatDates(date, values[date]) })
.filter((date) => {
return values[date] && typeof (this[util.getSetterName(date)]) !== 'function'
})
.each((date) => { values[date] = this.constructor.formatDates(date, values[date]) })
}

/**
Expand Down Expand Up @@ -1100,8 +1100,8 @@ class Model extends BaseModel {
* the $parent.
*/
_(value.rows)
.filter((val) => !!val)
.each((val) => (val.$parent = this.constructor.name))
.filter((val) => !!val)
.each((val) => (val.$parent = this.constructor.name))
}

/**
Expand Down Expand Up @@ -1285,7 +1285,7 @@ class Model extends BaseModel {
}
}

/**
/**
* Return a count of all model records.
*
* @method getCount
Expand All @@ -1311,7 +1311,7 @@ class Model extends BaseModel {
return this.query().getCountDistinct(columnName)
}

/**
/**
* Return the average of all values of columnName.
*
* @method getAvg
Expand All @@ -1337,7 +1337,7 @@ class Model extends BaseModel {
return this.query().getAvgDistinct(columnName)
}

/**
/**
* Return the minimum of all values of columnName.
*
* @method getMin
Expand All @@ -1350,7 +1350,7 @@ class Model extends BaseModel {
return this.query().getMin(columnName)
}

/**
/**
* Return the maximum of all values of columnName.
*
* @method getMax
Expand All @@ -1363,7 +1363,7 @@ class Model extends BaseModel {
return this.query().getMax(columnName)
}

/**
/**
* Return the sum of all values of columnName.
*
* @method getSum
Expand All @@ -1376,7 +1376,7 @@ class Model extends BaseModel {
return this.query().getSum(columnName)
}

/**
/**
* Return the sum of all distinct values of columnName.
*
* @method getSumDistinct
Expand Down
4 changes: 2 additions & 2 deletions src/Migration/index.js
Expand Up @@ -226,8 +226,8 @@ class Migration {
*/
async _getDiff (names, direction = 'up', batch) {
const schemas = direction === 'down'
? await this._getAfterBatch(batch)
: await this.db.table(this._migrationsTable).pluck('name')
? await this._getAfterBatch(batch)
: await this.db.table(this._migrationsTable).pluck('name')

return direction === 'down' ? _.reverse(_.intersection(names, schemas)) : _.difference(names, schemas)
}
Expand Down
19 changes: 8 additions & 11 deletions test/functional/seed-database.spec.js
Expand Up @@ -80,15 +80,14 @@ test.group('Seed Database', (group) => {

test('run seeds in sequence', async (assert) => {
ace.addCommand(Seed)
const g = global || GLOBAL
g.stack = []
global.stack = []

await fs.outputFile(path.join(__dirname, 'database/seeds/bar.js'), `
class Seed {
run () {
return new Promise((resolve) => {
setTimeout(() => {
(global || GLOBAL).stack.push('bar')
(global).stack.push('bar')
resolve()
}, 10)
})
Expand All @@ -100,7 +99,7 @@ test.group('Seed Database', (group) => {
await fs.outputFile(path.join(__dirname, 'database/seeds/baz.js'), `
class Seed {
run () {
(global || GLOBAL).stack.push('baz')
(global).stack.push('baz')
}
}
module.exports = Seed
Expand All @@ -112,15 +111,14 @@ test.group('Seed Database', (group) => {

test('run only selected files', async (assert) => {
ace.addCommand(Seed)
const g = global || GLOBAL
g.stack = []
global.stack = []

await fs.outputFile(path.join(__dirname, 'database/seeds/bar.js'), `
class Seed {
run () {
return new Promise((resolve) => {
setTimeout(() => {
(global || GLOBAL).stack.push('bar')
(global).stack.push('bar')
resolve()
}, 10)
})
Expand All @@ -132,7 +130,7 @@ test.group('Seed Database', (group) => {
await fs.outputFile(path.join(__dirname, 'database/seeds/foo.js'), `
class Seed {
run () {
(global || GLOBAL).stack.push('foo')
(global).stack.push('foo')
}
}
module.exports = Seed
Expand All @@ -144,8 +142,7 @@ test.group('Seed Database', (group) => {

test('run only js files', async (assert) => {
ace.addCommand(Seed)
const g = global || GLOBAL
g.stack = []
global.stack = []

await fs.outputFile(path.join(__dirname, 'database/seeds/bar.js'), `
class Seed {
Expand All @@ -164,7 +161,7 @@ test.group('Seed Database', (group) => {
await fs.outputFile(path.join(__dirname, 'database/seeds/.bar.js.swp'), `
class Seed {
run () {
(global || GLOBAL).stack.push('foo')
(global).stack.push('foo')
}
}
module.exports = Seed
Expand Down

0 comments on commit f6ab84e

Please sign in to comment.