match jshintrc config

Signed-off-by: José Luis Di Biase <josx@interorganic.com.ar>
This commit is contained in:
José Luis Di Biase 2017-06-23 14:54:28 -03:00
parent d316e1d7c0
commit d1f3e5f74a
18 changed files with 59 additions and 51 deletions

View File

@ -24,7 +24,12 @@
"_": true,
"saveAs": true,
"ApplicationConfiguration": true,
"Session": true
"Session": true,
"$": true,
"$window": true,
"io": true,
"jsep": true,
"MobileDetect": true
},
"predef": [ // Extra globals.
"define",

View File

@ -50,7 +50,7 @@ exports.createSubmission = function(req, res) {
var timeElapsed = 0;
if(typeof req.body.timeElapsed === "number"){
if(typeof req.body.timeElapsed === 'number'){
timeElapsed = req.body.timeElapsed;
}
var submission = new FormSubmission({
@ -114,7 +114,7 @@ exports.create = function(req, res) {
if(!req.body.form){
return res.status(400).send({
message: "Invalid Input"
message: 'Invalid Input'
});
}
var form = new Form(req.body.form);

View File

@ -8,7 +8,7 @@ var errorHandler = require('../errors.server.controller'),
passport = require('passport'),
config = require('../../../config/config'),
User = mongoose.model('User'),
tokgen = require("../../libs/tokenGenerator");
tokgen = require('../../libs/tokenGenerator');
var nev = require('email-verification')(mongoose);
@ -122,7 +122,7 @@ exports.signup = function(req, res) {
}
return res.status(200).send('An email has been sent to you. Please check it to verify your account.');
});
}
}
return res.status(400).send({message: 'Error: User already exists!'});
});
};
@ -238,7 +238,7 @@ exports.saveOAuthUserProfile = function(req, providerUserProfile, done) {
// Check if user exists, is not signed in using this provider, and doesn't have that provider data already configured
if (user.provider !== providerUserProfile.provider && (!user.additionalProvidersData || !user.additionalProvidersData[providerUserProfile.provider])) {
// Add the provider data to the additional provider data field
if (!user.additionalProvidersData) {
if (!user.additionalProvidersData) {
user.additionalProvidersData = {};
}
user.additionalProvidersData[providerUserProfile.provider] = providerUserProfile.providerData;
@ -303,7 +303,7 @@ exports.generateAPIKey = function(req, res) {
if (err) {
return res.status(400).send(err);
}
if (!user) {
return res.status(400).send({
message: 'User does not Exist'

View File

@ -66,7 +66,7 @@ exports.forgot = function(req, res, next) {
},
function(token, user, done) {
res.render('templates/reset-password-email', {
name: user.displayName || "TellForm User",
name: user.displayName || 'TellForm User',
appName: config.app.title,
url: 'http://' + req.headers.host + '/auth/reset/' + token
}, function(err, emailHTML) {
@ -146,7 +146,7 @@ exports.reset = function(req, res, next) {
user.save(function(err) {
if (err) {
done(err, null)
done(err, null);
}
done(null, user);
});
@ -154,7 +154,7 @@ exports.reset = function(req, res, next) {
done('Passwords do not match', null);
}
} else {
done('Password reset token is invalid or has expired.', null)
done('Password reset token is invalid or has expired.', null);
}
});
},
@ -187,7 +187,7 @@ exports.reset = function(req, res, next) {
}
return res.json({
message: "Successfully changed your password!"
message: 'Successfully changed your password!'
});
});
};

View File

@ -1,6 +1,6 @@
"use strict";
'use strict';
var TokenGenerator = require("uuid-token-generator");
var TokenGenerator = require('uuid-token-generator');
var tokgen = new TokenGenerator(256, TokenGenerator.BASE62);
module.exports = function() {

View File

@ -215,7 +215,7 @@ FormSchema.virtual('analytics.fields').get(function () {
var visitors = this.analytics.visitors;
var that = this;
if(this.form_fields.length == 0) {
if(this.form_fields.length === 0) {
return null;
}

View File

@ -94,7 +94,7 @@ module.exports._getAssets = function(includeTests, isFormJS){
}
return output;
}
};
/**
* Get the modules JavaScript files

12
config/env/all.js vendored
View File

@ -15,9 +15,9 @@ module.exports = {
}
},
aws: {
"accessKeyId": process.env.AWS_ACCESS_ID,
"secretAccessKey": process.env.AWS_SECRET_KEY,
"region": process.env.AWS_REGION
'accessKeyId': process.env.AWS_ACCESS_ID,
'secretAccessKey': process.env.AWS_SECRET_KEY,
'region': process.env.AWS_REGION
},
port: process.env.PORT || 3000,
@ -27,8 +27,8 @@ module.exports = {
reCAPTCHA_Key: process.env.reCAPTCHA_KEY || '',
signupDisabled: (process.env.SIGNUP_DISABLED === "TRUE"),
disableClusterMode: (process.env.DISABLE_CLUSTER_MODE === "TRUE"),
signupDisabled: (process.env.SIGNUP_DISABLED === 'TRUE'),
disableClusterMode: (process.env.DISABLE_CLUSTER_MODE === 'TRUE'),
baseUrl: '',
tempUserCollection: 'temporary_users',
@ -37,7 +37,7 @@ module.exports = {
mailbox_id: process.env.MAILOSAUR_MAILBOX || ''
},
subdomainsDisabled: (process.env.SUBDOMAINS_DISABLED == "TRUE"),
subdomainsDisabled: (process.env.SUBDOMAINS_DISABLED === 'TRUE'),
//Sentry DSN Client Key
DSN: process.env.RAVEN_DSN || '',

View File

@ -1,6 +1,6 @@
"use strict";
'use strict';
var passport = require("passport");
var passport = require('passport');
module.exports.isAuthenticatedOrApiKey = function isAuthenticated(req, res, next) {
if (req.isAuthenticated()) {
@ -8,12 +8,12 @@ module.exports.isAuthenticatedOrApiKey = function isAuthenticated(req, res, next
}
// Try authenticate with API KEY
if (req.headers.apikey || req.query.apikey || req.body.apikey) {
passport.authenticate("localapikey", function (err, user, info) {
passport.authenticate('localapikey', function (err, user, info) {
if (err)
return res.sendStatus(500);
if (!user)
return res.status(401).send(info.message || "");
return res.status(401).send(info.message || '');
req.login(user, function(loginErr) {
if (loginErr) return res.sendStatus(500);
@ -31,7 +31,7 @@ module.exports.isAuthenticatedOrApiKey = function isAuthenticated(req, res, next
module.exports.hasRole = function hasRole(roleRequired) {
if (!roleRequired) {
throw new Error("Required role needs to be set");
throw new Error('Required role needs to be set');
}
return function(req, res, next) {
@ -45,6 +45,6 @@ module.exports.hasRole = function hasRole(roleRequired) {
};
module.exports.hasAdminRole = function hasAdminRole() {
return module.exports.hasRole("admin");
return module.exports.hasRole('admin');
};

View File

@ -1,7 +1,7 @@
"use strict";
'use strict';
var passport = require("passport");
var LocalAPIKeyStrategy = require("passport-localapikey-update").Strategy;
var passport = require('passport');
var LocalAPIKeyStrategy = require('passport-localapikey-update').Strategy;
var User = require('mongoose').model('User');
module.exports = function() {
@ -9,14 +9,14 @@ module.exports = function() {
passReqToCallback : true
}, function(req, apiKey, done) {
return User.findOne({
"apiKey": apiKey
'apiKey': apiKey
}, function(err, user) {
if (err)
return done(err);
if (!user)
return done(null, false, {
message: "Unknown API Key"
message: 'Unknown API Key'
});
return done(null, user);

View File

@ -2,12 +2,12 @@
//FIXME: Should find an appropriate place for this
//Setting up jsep
jsep.addBinaryOp("contains", 10);
jsep.addBinaryOp("!contains", 10);
jsep.addBinaryOp("begins", 10);
jsep.addBinaryOp("!begins", 10);
jsep.addBinaryOp("ends", 10);
jsep.addBinaryOp("!ends", 10);
jsep.addBinaryOp('contains', 10);
jsep.addBinaryOp('!contains', 10);
jsep.addBinaryOp('begins', 10);
jsep.addBinaryOp('!begins', 10);
jsep.addBinaryOp('ends', 10);
jsep.addBinaryOp('!ends', 10);
angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCounter', '$filter', '$rootScope', 'SendVisitorData',
function ($http, TimeCounter, $filter, $rootScope, SendVisitorData) {
@ -141,6 +141,7 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
case 'contains':
return (left.indexOf(right) > -1);
case '!contains':
/* jshint -W018 */
return !(left.indexOf(right) > -1);
case 'begins':
return left.startsWith(right);
@ -297,9 +298,9 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
var getIpAndGeo = function(){
//Get Ip Address and GeoLocation Data
$.ajaxSetup( { "async": false } );
$.ajaxSetup( { 'async': false } );
var geoData = $.getJSON('https://freegeoip.net/json/').responseJSON;
$.ajaxSetup( { "async": true } );
$.ajaxSetup( { 'async': true } );
return {
ipAddr: geoData.ip,
@ -307,7 +308,7 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
City: geoData.city,
Country: geoData.country_name
}
}
};
};
$rootScope.submitForm = $scope.submitForm = function() {

View File

@ -28,16 +28,16 @@
deviceType = 'desktop';
}
$.ajaxSetup( { "async": false } );
$.ajaxSetup( { 'async': false } );
var geoData = $.getJSON('https://freegeoip.net/json/').responseJSON;
$.ajaxSetup( { "async": true } );
$.ajaxSetup( { 'async': true } );
if(!geoData){
geoData = {
ip: '',
city: '',
country_name: ''
}
};
}
// Create a new message object

View File

@ -23,10 +23,10 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
CurrentForm.setForm($scope.myform);
$scope.formURL = "/#!/forms/" + $scope.myform._id;
$scope.formURL = '/#!/forms/' + $scope.myform._id;
if ($scope.myform.isLive) {
if ($window.subdomainsDisabled == true) {
if ($window.subdomainsDisabled === true) {
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + '/view' + $scope.formURL;
} else {
if (window.location.host.split('.').length < 3) {

View File

@ -29,7 +29,7 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
$scope.deleteForm = function() {
$scope.$parent.removeForm(items.formIndex);
}
};
},
resolve: {
items: function() {

View File

@ -14,6 +14,8 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
/*
** Initialize scope with variables
*/
var newField;
//Setup UI-Sortable
$scope.sortableOptions = {
appendTo: '.dropzone',
@ -282,7 +284,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
break;
}
}
var newField = {
newField = {
title: fieldTitle,
fieldType: fieldType,
fieldValue: '',

View File

@ -113,7 +113,7 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
var updateFields = $interval(initController, 2000);
$scope.$on("$destroy", function() {
$scope.$on('$destroy', function() {
if (updateFields) {
$interval.cancel($scope.updateFields);
}

View File

@ -1,5 +1,5 @@
(function () {
"use strict";
'use strict';
function SendVisitorData() {

View File

@ -89,7 +89,7 @@
if(cb){
cb();
}
}
};
}));