Skip to content

Commit

Permalink
Replace JShint with ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
simison committed Jul 25, 2016
1 parent e4dd93f commit 467f57a
Show file tree
Hide file tree
Showing 174 changed files with 2,601 additions and 2,630 deletions.
76 changes: 76 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
module.exports = {
extends: [
'airbnb/legacy'
],
rules: {
camelcase: 0,
'comma-dangle': [2, 'never'],
'comma-spacing': [2, { before: false, after: true }],
'consistent-return': 0,
curly: 0,
'default-case': 0,
eqeqeq: [2, 'smart'],
'func-names': 0,
'guard-for-in': 2,
indent: [2, 2, { SwitchCase: 1, VariableDeclarator: { var: 2, let: 2, const: 3 } }],
'key-spacing': [2, { beforeColon: false, afterColon: true }],
'keyword-spacing': [2, { before: true, after: true }],
'max-len': 0,
'new-cap': [2, { newIsCapExceptions: ['acl.memoryBackend', 'acl'] }],
'no-bitwise': 0,
'no-caller': 2,
'no-console': 0,
'no-else-return': 0,
'no-empty-class': 0,
'no-multi-spaces': 2,
'no-param-reassign': 0,
'no-shadow': 0,
'no-spaced-func': 2,
'no-throw-literal': 2,
'no-trailing-spaces': 2,
'no-undef': 2,
'no-unneeded-ternary': 2,
'no-unreachable': 2,
'no-underscore-dangle': 0,
'no-unused-expressions': 0,
'no-unused-vars': 0,
'no-use-before-define': [1, 'nofunc'],
'no-var': 0,
'object-curly-spacing': [2, 'always'],
'one-var': [0, 'never'],
'one-var-declaration-per-line': [2, 'always'],
'padded-blocks': 0,
'space-before-function-paren': 0,
'space-in-parens': [2, 'never'],
'spaced-comment': [2, 'always'],
strict: 0,
'quote-props': 0,
quotes: [1, 'single'],
'wrap-iife': [2, 'outside'],
'vars-on-top': 0
},
env: {
node: true,
browser: true,
jasmine: true,
mocha: true,
jquery: true
},
globals: {
angular: true,
PruneCluster: true,
PruneClusterForLeaflet: true,
PhusionPassenger: true,
L: true,
by: true,
browser: true,
element: true,
inject: true,
io: true,
moment: true,
Promise: true,
__TESTING__: true,
_: false,
AppConfig: true
}
};
43 changes: 0 additions & 43 deletions .jshintrc

This file was deleted.

4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
language: node_js
node_js:
- 4
- 5
- 6
matrix:
allow_failures:
- node_js: 4
# NodeJS v4 requires gcc 4.8
env:
- NODE_ENV=travis CXX="g++-4.8" CC="gcc-4.8"
Expand Down
22 changes: 11 additions & 11 deletions config/assets/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
'modules/core/client/fonts/fontello/css/tricons-codes.css',
'public/lib/angular-ui-bootstrap/src/position/position.css',
'public/lib/angular-ui-bootstrap/src/typeahead/typeahead.css',
'public/lib/angular-ui-bootstrap/src/tooltip/tooltip.css',
'public/lib/angular-ui-bootstrap/src/tooltip/tooltip.css'
],
js: [
// Non minified versions
Expand Down Expand Up @@ -115,12 +115,12 @@ module.exports = {
// Reset and dependencies
'public/lib/bootstrap/less/normalize.less',
'public/lib/bootstrap/less/print.less',
//'public/lib/bootstrap/less/glyphicons.less',
// 'public/lib/bootstrap/less/glyphicons.less',

// Core CSS
'public/lib/bootstrap/less/scaffolding.less',
'public/lib/bootstrap/less/type.less',
//'public/lib/bootstrap/less/code.less',
// 'public/lib/bootstrap/less/code.less',
'public/lib/bootstrap/less/grid.less',
'public/lib/bootstrap/less/tables.less',
'public/lib/bootstrap/less/forms.less',
Expand All @@ -133,27 +133,27 @@ module.exports = {
'public/lib/bootstrap/less/input-groups.less',
'public/lib/bootstrap/less/navs.less',
'public/lib/bootstrap/less/navbar.less',
//'public/lib/bootstrap/less/breadcrumbs.less',
//'public/lib/bootstrap/less/pagination.less',
//'public/lib/bootstrap/less/pager.less',
// 'public/lib/bootstrap/less/breadcrumbs.less',
// 'public/lib/bootstrap/less/pagination.less',
// 'public/lib/bootstrap/less/pager.less',
'public/lib/bootstrap/less/labels.less',
'public/lib/bootstrap/less/badges.less',
//'public/lib/bootstrap/less/jumbotron.less',
//'public/lib/bootstrap/less/thumbnails.less',
// 'public/lib/bootstrap/less/jumbotron.less',
// 'public/lib/bootstrap/less/thumbnails.less',
'public/lib/bootstrap/less/alerts.less',
'public/lib/bootstrap/less/progress-bars.less',
'public/lib/bootstrap/less/media.less',
'public/lib/bootstrap/less/list-group.less',
'public/lib/bootstrap/less/panels.less',
//'public/lib/bootstrap/less/responsive-embed.less',
//'public/lib/bootstrap/less/wells.less',
// 'public/lib/bootstrap/less/responsive-embed.less',
// 'public/lib/bootstrap/less/wells.less',
'public/lib/bootstrap/less/close.less',

// Components w/ JavaScript
'public/lib/bootstrap/less/modals.less',
'public/lib/bootstrap/less/tooltip.less',
'public/lib/bootstrap/less/popovers.less',
//'public/lib/bootstrap/less/carousel.less',
// 'public/lib/bootstrap/less/carousel.less',

// Utility classes
'public/lib/bootstrap/less/utilities.less',
Expand Down
2 changes: 1 addition & 1 deletion config/assets/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ module.exports = {
less: defaultAssets.client.less,
js: defaultAssets.client.js,
views: defaultAssets.client.views
},
}
};
4 changes: 2 additions & 2 deletions config/assets/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ module.exports = {
less: defaultAssets.client.less,
js: _.union(defaultAssets.client.js, [
'public/dist/uib-templates.js',
'public/dist/templates.js',
'public/dist/templates.js'
]),
views: defaultAssets.client.views
},
}
};
10 changes: 6 additions & 4 deletions config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ var getGlobbedPaths = function(globPatterns, excludes) {
files = files.map(function(file) {
if (_.isArray(excludes)) {
for (var i in excludes) {
file = file.replace(excludes[i], '');
if (excludes.hasOwnProperty(i)) {
file = file.replace(excludes[i], '');
}
}
} else {
file = file.replace(excludes, '');
Expand Down Expand Up @@ -80,7 +82,7 @@ var initGlobalConfigFolders = function(config, assets) {
};

// Setting globbed client paths
config.folders.client = getGlobbedPaths(path.join(process.cwd(), 'modules/*/client/'), process.cwd().replace(new RegExp(/\\/g),'/'));
config.folders.client = getGlobbedPaths(path.join(process.cwd(), 'modules/*/client/'), process.cwd().replace(new RegExp(/\\/g), '/'));
};

/**
Expand Down Expand Up @@ -108,7 +110,7 @@ var initGlobalConfigFiles = function(config, assets) {
config.files.server.policies = getGlobbedPaths(assets.server.policies);

// Setting Globbed js files
if(process.env.NODE_ENV === 'production') {
if (process.env.NODE_ENV === 'production') {
// In production mode assets.client.lib.js are combined into client.js already
config.files.client.js = getGlobbedPaths(assets.client.js, ['client/', 'public/']);
config.files.client.lib.js = getGlobbedPaths(assets.client.lib.js, 'public/');
Expand All @@ -117,7 +119,7 @@ var initGlobalConfigFiles = function(config, assets) {
}

// Setting Globbed css files
if(process.env.NODE_ENV === 'production') {
if (process.env.NODE_ENV === 'production') {
// In production mode assets.client.lib.css are combined into client.css already
config.files.client.css = getGlobbedPaths(assets.client.css, ['client/', 'public/']);
} else {
Expand Down
6 changes: 3 additions & 3 deletions config/env/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
title: 'Trustroots',
description: 'Travellers community for sharing, hosting and getting people together. We want a world that encourages trust and adventure.'
},
maxUploadSize: process.env.MAX_UPLOAD_SIZE || 10*1024*1024, // 10MB. Remember to change this to Nginx configs as well
maxUploadSize: process.env.MAX_UPLOAD_SIZE || 10 * 1024 * 1024, // 10MB. Remember to change this to Nginx configs as well
imageProcessor: 'graphicsmagick', // graphicsmagick|imagemagick
uploadTmpDir: './tmp/',
uploadDir: './modules/users/client/img/profile/uploads/',
Expand Down Expand Up @@ -59,7 +59,7 @@ module.exports = {
map: 'outdoors-v9',
user: 'mapbox',
legacy: false
},
}
},
user: process.env.MAPBOX_USERNAME || false,
publicKey: process.env.MAPBOX_ACCESS_TOKEN || false
Expand All @@ -77,7 +77,7 @@ module.exports = {
callbackURL: '/api/auth/twitter/callback'
},
google: {
page: process.env.GOOGLE_PAGE || '',
page: process.env.GOOGLE_PAGE || ''
},
github: {
clientID: process.env.GITHUB_ID || 'APP_ID',
Expand Down
4 changes: 2 additions & 2 deletions config/env/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ module.exports = {
auth: {
authMechanism: ''
}
//user: '',
//pass: ''
// user: '',
// pass: ''
},
// Enable mongoose debug mode
debug: process.env.MONGODB_DEBUG || false
Expand Down
4 changes: 2 additions & 2 deletions config/env/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ module.exports = {
auth: {
authMechanism: ''
}
//user: '',
//pass: ''
// user: '',
// pass: ''
},
// Enable mongoose debug mode
debug: process.env.MONGODB_DEBUG || false
Expand Down
4 changes: 2 additions & 2 deletions config/env/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ module.exports = {
auth: {
authMechanism: ''
}
//user: '',
//pass: ''
// user: '',
// pass: ''
},
// Enable mongoose debug mode
debug: process.env.MONGODB_DEBUG || false
Expand Down
23 changes: 3 additions & 20 deletions config/lib/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var _ = require('lodash'),
path = require('path'),
paginate = require('express-paginate'),
seo = require('mean-seo'),
path = require('path'),
Agenda = require('agenda');

/**
Expand Down Expand Up @@ -146,7 +145,7 @@ module.exports.initSession = function (app, db) {
secret: config.sessionSecret,
cookie: {
// If secure is true, and you access your site over HTTP, the cookie will not be set.
secure: false,//config.https,
secure: false, // ...or you could use `config.https`, but it screws things up with Nginx proxy.

// By default cookie.maxAge is null, meaning no "expires" parameter is
// set so the cookie becomes a browser-session cookie. When the user
Expand Down Expand Up @@ -205,7 +204,7 @@ module.exports.initHelmetHeaders = function (app) {
module.exports.initSEO = function (app) {
app.use(seo({
cacheClient: 'disk', // Can be 'disk' or 'redis'
cacheDuration: 2 * 60 * 60 * 24 * 1000, // In milliseconds for disk cache
cacheDuration: 2 * 60 * 60 * 24 * 1000 // In milliseconds for disk cache
}));
};

Expand All @@ -218,7 +217,7 @@ module.exports.initAgenda = function (app, db) {
// Don't launch Agenda on test environment
// @todo: make it possible to launch this manually with very small interwalls for testing
// @todo: similarly for testing purposes, write a stopAgenda() method
if(process.env.NODE_ENV === 'test') {
if (process.env.NODE_ENV === 'test') {
return;
}

Expand Down Expand Up @@ -290,19 +289,6 @@ module.exports.initErrorRoutes = function (app) {
app.use(errorHandler.errorResponse);
};

/**
* Configure Socket.io
*/
/*
module.exports.configureSocketIO = function (app, db) {
// Load the Socket.io configuration
var server = require('./socket.io')(app, db);
// Return server object
return server;
};
*/

/**
* Initialize the Express application
*/
Expand Down Expand Up @@ -346,8 +332,5 @@ module.exports.init = function (db) {
// Initialize Agenda ("cron" jobs)
this.initAgenda(app, db);

// Configure Socket.io
//app = this.configureSocketIO(app, db);

return app;
};
Loading

0 comments on commit 467f57a

Please sign in to comment.