Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

jshint-related fixes

  • Loading branch information...
commit 2745368a164ae704b4e637df7a4d63e6b792c51b 2 parents a2cf4eb + 52f2925
@kunklejr kunklejr authored
View
5 .jshintrc
@@ -0,0 +1,5 @@
+{
+ "es5": true,
+ "expr": true,
+ "-W092": false
+}
View
6 lib/config.js
@@ -40,12 +40,12 @@ var setCurrent = exports.setCurrent = function (env) {
return {
env: current,
settings: exports[current]
- }
- }
+ };
+ };
}
});
if (!exports.getCurrent) {
throw new Error("Environment(s) '" + env.join(', ') + "' not found.");
}
-}
+};
View
4 lib/driver/base.js
@@ -206,8 +206,8 @@ module.exports = Base = Class.extend({
this.runSql('INSERT INTO migrations (name, run_on) VALUES (?, ?)', [name, new Date()], callback);
},
- startMigration: function(cb){cb()},
- endMigration: function(cb){cb()},
+ startMigration: function(cb){cb();},
+ endMigration: function(cb){cb();},
// sql, params, callback
// sql, callback
runSql: function() {
View
4 lib/driver/mysql.js
@@ -15,7 +15,7 @@ var MysqlDriver = Base.extend({
var len;
switch(spec.type) {
case type.TEXT:
- len = parseInt(spec.length) || 1000;
+ len = parseInt(spec.length, 10) || 1000;
if(len > 16777216) {
return 'LONGTEXT';
}
@@ -29,7 +29,7 @@ var MysqlDriver = Base.extend({
case type.DATE_TIME:
return 'DATETIME';
case type.BLOB:
- len = parseInt(spec.length) || 1000;
+ len = parseInt(spec.length, 10) || 1000;
if(len > 16777216) {
return 'LONGBLOB';
}
View
4 lib/driver/pg.js
@@ -13,11 +13,11 @@ var PgDriver = Base.extend({
},
startMigration: function(cb){
- this.runSql('BEGIN;', function() { cb()});
+ this.runSql('BEGIN;', function() { cb();});
},
endMigration: function(cb){
- this.runSql('COMMIT;', function(){cb(null)});
+ this.runSql('COMMIT;', function(){cb(null);});
},
createColumnDef: function(name, spec, options) {
View
16 lib/inflection.js
@@ -158,7 +158,7 @@ var nonTitlecasedWords = [
*/
var idSuffix = new RegExp('(_ids|_id)$', 'g');
var underbar = new RegExp('_', 'g');
-var spaceOrUnderbar = new RegExp('[\ _]', 'g');
+var spaceOrUnderbar = new RegExp('[ _]', 'g');
var dashOrUnderbar = new RegExp('[-_]', 'g');
var uppercase = new RegExp('([A-Z])', 'g');
var underbarPrefix = new RegExp('^_');
@@ -192,7 +192,7 @@ var applyRules = function(str, rules, skip, override) {
}
}
return str;
-}
+};
/*
This lets us detect if an Array contains a given element
@@ -277,7 +277,7 @@ exports.singularize = function(str, singular) {
"message_properties".camelize(true) == "messageProperties"
*/
exports.camelize = function(str, lowFirstLetter) {
- var str = str.toLowerCase();
+ str = str.toLowerCase();
var str_path = str.split('/');
for (var i = 0; i < str_path.length; i++) {
var str_arr = str_path[i].split('_');
@@ -329,7 +329,7 @@ exports.underscore = function(str) {
"message_properties".humanize(true) == "message properties"
*/
exports.humanize = function(str, lowFirstLetter) {
- var str = str.toLowerCase();
+ str = str.toLowerCase();
str = str.replace(idSuffix, '');
str = str.replace(dashOrUnderbar, ' ');
if (!lowFirstLetter) {
@@ -351,7 +351,7 @@ exports.humanize = function(str, lowFirstLetter) {
"message properties".capitalize() == "Message properties"
*/
exports.capitalize = function(str) {
- var str = str.toLowerCase();
+ str = str.toLowerCase();
str = str.substring(0, 1).toUpperCase() + str.substring(1);
return str;
};
@@ -386,7 +386,7 @@ exports.dasherize = function(str) {
"message properties to keep".titleize() == "Message Properties to Keep"
*/
exports.titleize = function(str) {
- var str = str.toLowerCase();
+ str = str.toLowerCase();
str = str.replace(underbar, ' ');
var str_arr = str.split(' ');
for (var x = 0; x < str_arr.length; x++) {
@@ -489,8 +489,8 @@ exports.foreignKey = function(str, dropIdUbar) {
exports.ordinalize = function(str) {
var str_arr = str.split(' ');
for (var x = 0; x < str_arr.length; x++) {
- var i = parseInt(str_arr[x]);
- if (i === NaN) {
+ var i = parseInt(str_arr[x], 10);
+ if (isNan(i)) {
var ltd = str_arr[x].substring(str_arr[x].length - 2);
var ld = str_arr[x].substring(str_arr[x].length - 1);
var suf = "th";
View
2  lib/migration.js
@@ -109,7 +109,7 @@ Migration.loadFromFilesystem = function(dir, callback) {
if (err) { callback(err); return; }
files = files.filter(function(file) {
return /\.js$/.test(file);
- })
+ });
var migrations = files.sort().map(function(file) {
return new Migration(path.join(dir, file));
});
View
6 lib/migrator.js
@@ -115,7 +115,7 @@ Migrator.prototype = {
if (err) { callback(err); return; }
var toRun = filterUp(allMigrations, completedMigrations, partialName, count);
- if (toRun.length == 0) {
+ if (toRun.length === 0) {
log.info('No migrations to run');
callback(null);
return;
@@ -126,7 +126,7 @@ Migrator.prototype = {
self.driver.startMigration(function() {
self.up(migration.up.bind(migration), function(err) {
if (err) { callback(err); return; }
- self.writeMigrationRecord(migration, function() { self.driver.endMigration(next) });
+ self.writeMigrationRecord(migration, function() { self.driver.endMigration(next); });
});
});
}, callback);
@@ -149,7 +149,7 @@ Migrator.prototype = {
var toRun = filterDown(completedMigrations, partialName, count);
- if (toRun.length == 0) {
+ if (toRun.length === 0) {
log.info('No migrations to run');
callback(null);
return;
View
2  lib/util.js
@@ -1,5 +1,5 @@
exports.lpad = function(str, padChar, totalLength) {
- var str = str.toString();
+ str = str.toString();
var neededPadding = totalLength - str.length;
for (var i = 0; i < neededPadding; i++) {
str = padChar + str;
View
2  package.json
@@ -46,7 +46,7 @@
"pkginfo": "~0.3.0"
},
"devDependencies": {
- "vows": "~0.6.2",
+ "vows": "~0.7.0",
"db-meta": "~0.4.1"
},
"scripts": {
Please sign in to comment.
Something went wrong with that request. Please try again.