mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-07 04:51:26 +01:00
Merge pull request #4957 from lo1tuma/eslint
Add eslint to detect unhandled callback errors
This commit is contained in:
20
.eslintignore
Normal file
20
.eslintignore
Normal file
@@ -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
|
||||
6
.eslintrc.json
Normal file
6
.eslintrc.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"rules": {
|
||||
"handle-callback-err": [ "error", "^(e$|(e|(.*(_e|E)))rr)" ]
|
||||
}
|
||||
}
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -16,6 +16,7 @@ provision.sh
|
||||
*.komodoproject
|
||||
.DS_Store
|
||||
feeds/recent.rss
|
||||
.eslintcache
|
||||
|
||||
logs/
|
||||
|
||||
@@ -51,4 +52,4 @@ tx.exe
|
||||
.transifexrc
|
||||
|
||||
##Coverage output
|
||||
coverage
|
||||
coverage
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
"main": "app.js",
|
||||
"scripts": {
|
||||
"start": "node loader.js",
|
||||
"lint": "eslint --cache .",
|
||||
"pretest": "npm run lint",
|
||||
"test": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- ./tests -t 10000"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -90,6 +92,7 @@
|
||||
"xregexp": "~3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^3.4.0",
|
||||
"grunt": "~0.4.5",
|
||||
"grunt-contrib-watch": "^1.0.0",
|
||||
"istanbul": "^0.4.2",
|
||||
|
||||
@@ -79,6 +79,10 @@ define('admin/settings/email', ['admin/settings'], function(settings) {
|
||||
}
|
||||
|
||||
socket.emit('meta.getServerTime', {}, function(err, now) {
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
|
||||
now = new Date(now);
|
||||
|
||||
$('#serverTime').text(now.toString());
|
||||
|
||||
@@ -381,7 +381,9 @@ authenticationController.localLogin = function(req, username, password, next) {
|
||||
if (result.banned) {
|
||||
// Retrieve ban reason and show error
|
||||
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 + ']]'));
|
||||
} else {
|
||||
next(new Error('[[error:user-banned]]'));
|
||||
|
||||
Reference in New Issue
Block a user