不要怂,就是干,撸起袖子干!

Commit aa099574 by Jan Aagaard Meier

Merge pull request #5221 from sequelize/greenkeeper-jshint-2.9.1

jshint@2.9.1 breaks build 
2 parents 8760076b 731ccd00
...@@ -109,17 +109,6 @@ var groupJoinData = function(rows, includeOptions, options) { ...@@ -109,17 +109,6 @@ var groupJoinData = function(rows, includeOptions, options) {
includeMap[previousPiece] = $current; includeMap[previousPiece] = $current;
} }
} }
// Calcuate the last item in the array prefix ('Results' for 'User.Results.id')
, lastKeyPrefixMemo = {}
, lastKeyPrefix = function (key) {
if (!lastKeyPrefixMemo[key]) {
var prefix = keyPrefix(key)
, length = prefix.length;
lastKeyPrefixMemo[key] = !length ? '' : prefix[length - 1];
}
return lastKeyPrefixMemo[key];
}
// Calculate the string prefix of a key ('User.Results' for 'User.Results.id') // Calculate the string prefix of a key ('User.Results' for 'User.Results.id')
, keyPrefixStringMemo = {} , keyPrefixStringMemo = {}
, keyPrefixString = function (key, memo) { , keyPrefixString = function (key, memo) {
...@@ -150,6 +139,17 @@ var groupJoinData = function(rows, includeOptions, options) { ...@@ -150,6 +139,17 @@ var groupJoinData = function(rows, includeOptions, options) {
} }
return keyPrefixMemo[key]; return keyPrefixMemo[key];
} }
// Calcuate the last item in the array prefix ('Results' for 'User.Results.id')
, lastKeyPrefixMemo = {}
, lastKeyPrefix = function (key) {
if (!lastKeyPrefixMemo[key]) {
var prefix = keyPrefix(key)
, length = prefix.length;
lastKeyPrefixMemo[key] = !length ? '' : prefix[length - 1];
}
return lastKeyPrefixMemo[key];
}
, getUniqueKeyAttributes = function (model) { , getUniqueKeyAttributes = function (model) {
var uniqueKeyAttributes = Utils._.chain(model.uniqueKeys); var uniqueKeyAttributes = Utils._.chain(model.uniqueKeys);
uniqueKeyAttributes = uniqueKeyAttributes uniqueKeyAttributes = uniqueKeyAttributes
......
...@@ -213,9 +213,11 @@ QueryInterface.prototype.dropTable = function(tableName, options) { ...@@ -213,9 +213,11 @@ QueryInterface.prototype.dropTable = function(tableName, options) {
}; };
QueryInterface.prototype.dropAllTables = function(options) { QueryInterface.prototype.dropAllTables = function(options) {
var self = this; var self = this
, skip;
options = options || {}; options = options || {};
skip = options.skip || [];
var dropAllTables = function(tableNames) { var dropAllTables = function(tableNames) {
return Promise.each(tableNames, function(tableName) { return Promise.each(tableNames, function(tableName) {
...@@ -226,7 +228,6 @@ QueryInterface.prototype.dropAllTables = function(options) { ...@@ -226,7 +228,6 @@ QueryInterface.prototype.dropAllTables = function(options) {
}); });
}; };
var skip = options.skip || [];
return self.showAllTables(options).then(function(tableNames) { return self.showAllTables(options).then(function(tableNames) {
if (self.sequelize.options.dialect === 'sqlite') { if (self.sequelize.options.dialect === 'sqlite') {
return self.sequelize.query('PRAGMA foreign_keys;', options).then(function(result) { return self.sequelize.query('PRAGMA foreign_keys;', options).then(function(result) {
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
"git": "^0.1.5", "git": "^0.1.5",
"hints": "^0.2.0", "hints": "^0.2.0",
"istanbul": "^0.4.0", "istanbul": "^0.4.0",
"jshint": "^2.8.0", "jshint": "^2.9.1",
"lcov-result-merger": "^1.0.0", "lcov-result-merger": "^1.0.0",
"mocha": "^2.2.1", "mocha": "^2.2.1",
"mysql": "~2.10.0", "mysql": "~2.10.0",
......
...@@ -90,14 +90,14 @@ describe(Support.getTestDialectTeaser('Transaction'), function() { ...@@ -90,14 +90,14 @@ describe(Support.getTestDialectTeaser('Transaction'), function() {
field: 'value' field: 'value'
} }
}) })
, self = this
, transTest = function (val) { , transTest = function (val) {
return self.sequelize.transaction({isolationLevel: 'SERIALIZABLE'}, function(t) { return self.sequelize.transaction({isolationLevel: 'SERIALIZABLE'}, function(t) {
return SumSumSum.sum('value', {transaction: t}).then(function (balance) { return SumSumSum.sum('value', {transaction: t}).then(function (balance) {
return SumSumSum.create({value: -val}, {transaction: t}); return SumSumSum.create({value: -val}, {transaction: t});
}); });
}); });
} };
, self = this;
// Attention: this test is a bit racy. If you find a nicer way to test this: go ahead // Attention: this test is a bit racy. If you find a nicer way to test this: go ahead
return SumSumSum.sync({force: true}).then(function () { return SumSumSum.sync({force: true}).then(function () {
return (expect(Promise.join(transTest(80), transTest(80), transTest(80))).to.eventually.be.rejectedWith('could not serialize access due to read/write dependencies among transactions')); return (expect(Promise.join(transTest(80), transTest(80), transTest(80))).to.eventually.be.rejectedWith('could not serialize access due to read/write dependencies among transactions'));
...@@ -239,7 +239,7 @@ describe(Support.getTestDialectTeaser('Transaction'), function() { ...@@ -239,7 +239,7 @@ describe(Support.getTestDialectTeaser('Transaction'), function() {
}); });
}); });
} }
if (current.dialect.supports.transactionOptions.type) { if (current.dialect.supports.transactionOptions.type) {
describe('transaction types', function() { describe('transaction types', function() {
it('should support default transaction type DEFERRED', function() { it('should support default transaction type DEFERRED', function() {
...@@ -250,7 +250,7 @@ describe(Support.getTestDialectTeaser('Transaction'), function() { ...@@ -250,7 +250,7 @@ describe(Support.getTestDialectTeaser('Transaction'), function() {
}); });
}); });
}); });
Object.keys(Transaction.TYPES).forEach(function(key) { Object.keys(Transaction.TYPES).forEach(function(key) {
it('should allow specification of ' + key + ' type', function() { it('should allow specification of ' + key + ' type', function() {
return this.sequelize.transaction({ return this.sequelize.transaction({
...@@ -262,7 +262,7 @@ describe(Support.getTestDialectTeaser('Transaction'), function() { ...@@ -262,7 +262,7 @@ describe(Support.getTestDialectTeaser('Transaction'), function() {
}); });
}); });
}); });
}); });
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!