Merge pull request #4957 from lo1tuma/eslint

Add eslint to detect unhandled callback errors
v1.18.x
Barış Soner Uşaklı 8 years ago committed by GitHub
commit 050ca6920a

@ -0,0 +1,20 @@
node_modules/
public/src/nodebb.min.js
*.sublime-project
*.sublime-workspace
.project
.vagrant
.DS_Store
logs/
/public/templates
/public/uploads
/public/sounds
/public/vendor
/public/nodebb.min.js
/public/acp.min.js
/public/src/modules/string.js
.idea/
.vscode/
*.ipr
*.iws
/coverage

@ -0,0 +1,6 @@
{
"rules": {
"handle-callback-err": [ "error", "^(e$|(e|(.*(_e|E)))rr)" ]
}
}

3
.gitignore vendored

@ -16,6 +16,7 @@ provision.sh
*.komodoproject *.komodoproject
.DS_Store .DS_Store
feeds/recent.rss feeds/recent.rss
.eslintcache
logs/ logs/
@ -51,4 +52,4 @@ tx.exe
.transifexrc .transifexrc
##Coverage output ##Coverage output
coverage coverage

@ -11,6 +11,8 @@
"main": "app.js", "main": "app.js",
"scripts": { "scripts": {
"start": "node loader.js", "start": "node loader.js",
"lint": "eslint --cache .",
"pretest": "npm run lint",
"test": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- ./tests -t 10000" "test": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- ./tests -t 10000"
}, },
"dependencies": { "dependencies": {
@ -90,6 +92,7 @@
"xregexp": "~3.1.0" "xregexp": "~3.1.0"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^3.4.0",
"grunt": "~0.4.5", "grunt": "~0.4.5",
"grunt-contrib-watch": "^1.0.0", "grunt-contrib-watch": "^1.0.0",
"istanbul": "^0.4.2", "istanbul": "^0.4.2",

@ -79,6 +79,10 @@ define('admin/settings/email', ['admin/settings'], function(settings) {
} }
socket.emit('meta.getServerTime', {}, function(err, now) { socket.emit('meta.getServerTime', {}, function(err, now) {
if (err) {
return app.alertError(err.message);
}
now = new Date(now); now = new Date(now);
$('#serverTime').text(now.toString()); $('#serverTime').text(now.toString());

@ -381,7 +381,9 @@ authenticationController.localLogin = function(req, username, password, next) {
if (result.banned) { if (result.banned) {
// Retrieve ban reason and show error // Retrieve ban reason and show error
return user.getLatestBanInfo(uid, function(err, banInfo) { return user.getLatestBanInfo(uid, function(err, banInfo) {
if (banInfo.reason) { if (err) {
next(err);
} else if (banInfo.reason) {
next(new Error('[[error:user-banned-reason, ' + banInfo.reason + ']]')); next(new Error('[[error:user-banned-reason, ' + banInfo.reason + ']]'));
} else { } else {
next(new Error('[[error:user-banned]]')); next(new Error('[[error:user-banned]]'));

Loading…
Cancel
Save