Skip to content

Commit

Permalink
added standard linter
Browse files Browse the repository at this point in the history
replace jshint task with standard task in gulp dev
formatted all files wrt standard linter
fixed lint warnings regarding path and split vars
fixed lint warnings around error handling
fixed other misc lint warnings
  • Loading branch information
VikramTiwari committed Aug 27, 2016
1 parent dbb39c5 commit 36e50c1
Show file tree
Hide file tree
Showing 29 changed files with 608 additions and 597 deletions.
84 changes: 42 additions & 42 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
'use strict';
'use strict'

import 'angular/angular-csp.css';
import 'angular-ui-select/select.min.css';
import 'bootstrap/dist/css/bootstrap.min.css';
import 'angular/angular-csp.css'
import 'angular-ui-select/select.min.css'
import 'bootstrap/dist/css/bootstrap.min.css'

import jQuery from 'jquery';
import 'angular';
import 'angular-ui-select/select';
import 'angular-mocks';
import 'angular-cookies';
import 'angular-resource';
import 'angular-sanitize';
import 'angular-ui-router';
import 'angular-jwt';
import 'angular-bootstrap/ui-bootstrap-tpls';
import jQuery from 'jquery'
import 'angular'
import 'angular-ui-select/select'
import 'angular-mocks'
import 'angular-cookies'
import 'angular-resource'
import 'angular-sanitize'
import 'angular-ui-router'
import 'angular-jwt'
import 'angular-bootstrap/ui-bootstrap-tpls'

window.$ = jQuery;
window.$ = jQuery

angular.element(document).ready(function () {
//Fixing facebook bug with redirect
if (window.location.hash === '#_=_') window.location.hash = '#!';

//Then init the app
angular.bootstrap(document, ['mean']);

});

function processModules(modules) {

var packageModules = ['ngCookies', 'ngResource', 'ui.bootstrap', 'ui.router', 'ui.select', 'ngSanitize'], m, mn;
for (var index in modules) {
m = modules[index];
mn = 'mean.' + m.name;
angular.module(mn, m.angularDependencies || []);
packageModules.push(mn);
}

var req = require.context('./packages', true, /\/public\/(?!tests|assets|views)(.*)\.js$/);
req.keys().map(req);
req = require.context('./node_modules', true, /\/meanio-(.*)\/public\/(?!tests|assets|views)(.*)\.js$/);
req.keys().map(req);
angular.module('mean', packageModules);
// Fixing facebook bug with redirect
if (window.location.hash === '#_=_') window.location.hash = '#!'

// Then init the app
angular.bootstrap(document, ['mean'])
})

function processModules (modules) {
var packageModules = ['ngCookies', 'ngResource', 'ui.bootstrap', 'ui.router', 'ui.select', 'ngSanitize']
var m
var mn
for (var index in modules) {
m = modules[index]
mn = 'mean.' + m.name
angular.module(mn, m.angularDependencies || [])
packageModules.push(mn)
}

var req = require.context('./packages', true, /\/public\/(?!tests|assets|views)(.*)\.js$/)
req.keys().map(req)
req = require.context('./node_modules', true, /\/meanio-(.*)\/public\/(?!tests|assets|views)(.*)\.js$/)
req.keys().map(req)
angular.module('mean', packageModules)
}

jQuery.ajax('/_getModules', {
dataType: 'json',
async: false,
success: processModules
});
dataType: 'json',
async: false,
success: processModules
})
18 changes: 9 additions & 9 deletions config/env/default.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
'use strict'

var path = require('path'),
rootPath = path.normalize(__dirname + '/../..');
var path = require('path')
var rootPath = path.join(__dirname, '/../..')

module.exports = {
root: rootPath,
Expand Down Expand Up @@ -45,20 +45,20 @@ module.exports = {
public: {
languages: [{
locale: 'en',
direction: 'ltr',
direction: 'ltr'
}, {
locale: 'he',
direction: 'rtl',
direction: 'rtl'
}],
currentLanguage: 'en',
loginPage: '/auth/login',
cssFramework: 'bootstrap'
},
clusterSticky: false,
stickyOptions: {
proxy: false, //activate layer 4 patching
header: 'x-forwarded-for', //provide here your header containing the users ip
num: (process.env.CPU_COUNT || require('os').cpus().length) - 1,
proxy: false, // activate layer 4 patching
header: 'x-forwarded-for', // provide here your header containing the users ip
num: (process.env.CPU_COUNT || require('os').cpus().length) - 1
},
// The session cookie name
sessionName: 'connect.sid',
Expand All @@ -67,4 +67,4 @@ module.exports = {
json: {limit: '100kb'},
urlencoded: {limit: '100kb', extended: true}
}
};
}
6 changes: 3 additions & 3 deletions config/env/development.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
'use strict'

module.exports = {
db: 'mongodb://' + (process.env.DB_PORT_27017_TCP_ADDR || 'localhost') + '/mean-dev',
Expand Down Expand Up @@ -58,6 +58,6 @@ module.exports = {
user: 'EMAIL_ID',
pass: 'PASSWORD'
}
},
},
secret: 'SOME_TOKEN_SECRET'
};
}
4 changes: 2 additions & 2 deletions config/env/production.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
'use strict'

module.exports = {
db: 'mongodb://' + (process.env.DB_PORT_27017_TCP_ADDR || 'localhost') + '/mean-prod',
Expand Down Expand Up @@ -78,4 +78,4 @@ module.exports = {
}
},
secret: 'SOME_TOKEN_SECRET'
};
}
4 changes: 2 additions & 2 deletions config/env/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
'use strict'

module.exports = {
db: 'mongodb://' + (process.env.DB_PORT_27017_TCP_ADDR || 'localhost') + '/mean-test',
Expand Down Expand Up @@ -60,4 +60,4 @@ module.exports = {
}
},
secret: 'SOME_TOKEN_SECRET'
};
}
73 changes: 35 additions & 38 deletions config/express.js
Original file line number Diff line number Diff line change
@@ -1,71 +1,68 @@
/* globals require */
'use strict';
'use strict'

/**
* Module dependencies.
*/
var mean = require('meanio'),
compression = require('compression'),
consolidate = require('consolidate'),
express = require('express'),
helpers = require('view-helpers'),
flash = require('connect-flash'),
modRewrite = require('connect-modrewrite'),
// seo = require('mean-seo'),
config = mean.getConfig(),
bodyParser = require('body-parser'),
helmet = require('helmet');


module.exports = function(app, db) {

app.use(bodyParser.json(config.bodyParser.json));
app.use(bodyParser.urlencoded(config.bodyParser.urlencoded));

app.use(helmet());

app.set('showStackError', true);
var mean = require('meanio')
var compression = require('compression')
var consolidate = require('consolidate')
var express = require('express')
var helpers = require('view-helpers')
var flash = require('connect-flash')
var modRewrite = require('connect-modrewrite')
// seo = require('mean-seo'),
var config = mean.getConfig()
var bodyParser = require('body-parser')
var helmet = require('helmet')

module.exports = function (app, db) {
app.use(bodyParser.json(config.bodyParser.json))
app.use(bodyParser.urlencoded(config.bodyParser.urlencoded))

app.use(helmet())

app.set('showStackError', true)

// Prettify HTML
app.locals.pretty = true;
app.locals.pretty = true

// cache=memory or swig dies in NODE_ENV=production
app.locals.cache = 'memory';
app.locals.cache = 'memory'

// Should be placed before express.static
// To ensure that all assets and data are compressed (utilize bandwidth)
app.use(compression({
// Levels are specified in a range of 0 to 9, where-as 0 is
// no compression and 9 is best compression, but slowest
level: 9
}));
}))

// Enable compression on bower_components
app.use('/bower_components', express.static(config.root + '/bower_components'));
app.use('/bower_components', express.static(config.root + '/bower_components'))

app.use('/bundle', express.static(config.root + '/bundle'));
app.use('/bundle', express.static(config.root + '/bundle'))

// Adds logging based on logging config in config/env/ entry
require('./middlewares/logging')(app, config.logging);
require('./middlewares/logging')(app, config.logging)

// assign the template engine to .html files
app.engine('html', consolidate[config.templateEngine]);
app.engine('html', consolidate[config.templateEngine])

// set .html as the default extension
app.set('view engine', 'html');

app.set('view engine', 'html')

// Dynamic helpers
app.use(helpers(config.app.name));
app.use(helpers(config.app.name))

// Connect flash for flash messages
app.use(flash());
app.use(flash())

app.use(modRewrite([

'!^/api/.*|\\_getModules|\\.html|\\.js|\\.css|\\.swf|\\.jp(e?)g|\\.JP(E?)G|\\.PNG|\\.png|\\.ico|\\.gif|\\.svg|\\.eot|\\.ttf|\\.woff|\\.txt|\\.pdf$ / [L]'

]));
'!^/api/.*|\\_getModules|\\.html|\\.js|\\.css|\\.swf|\\.jp(e?)g|\\.JP(E?)G|\\.PNG|\\.png|\\.ico|\\.gif|\\.svg|\\.eot|\\.ttf|\\.woff|\\.txt|\\.pdf$ / [L]'

]))

// app.use(seo());
};
// app.use(seo())
}
21 changes: 10 additions & 11 deletions config/middlewares/logging.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/* globals require */
(function() {
'use strict';
;(function () {
'use strict'

module.exports = function(app, config) {
var format, options;
module.exports = function (app, config) {
var format, options

if (config !== false) {
config = config || {};
config = config || {}

format = config.format || 'dev';
options = config.options || {};
format = config.format || 'dev'
options = config.options || {}

app.use(require('morgan')(format, options));
app.use(require('morgan')(format, options))
}
};

})();
}
})()
Loading

0 comments on commit 36e50c1

Please sign in to comment.