From 273d16c0edb3791cac73beeea8b352b0eb100666 Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Tue, 16 Jun 2015 14:54:14 +0200 Subject: [PATCH] Linting. --- js/.jshintrc | 7 ++++--- js/apps/system/_system/sessions/APP/storage.js | 2 -- js/common/bootstrap/modules.js | 9 +++++---- js/server/modules/org/arangodb/foxx/sessions.js | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/js/.jshintrc b/js/.jshintrc index ebc12c04bb..165af86e6e 100644 --- a/js/.jshintrc +++ b/js/.jshintrc @@ -2,11 +2,14 @@ "bitwise": true, "curly": true, "eqeqeq": true, + "esnext": true, "forin": true, "freeze": true, "globalstrict": true, "immed": true, + "indent": 2, "laxbreak": true, + "maxlen": 120, "newcap": true, "noarg": true, "node": true, @@ -15,7 +18,5 @@ "nonew": true, "strict": true, "undef": true, - "unused": true, - "indent": 2, - "maxlen": 120 + "unused": true } diff --git a/js/apps/system/_system/sessions/APP/storage.js b/js/apps/system/_system/sessions/APP/storage.js index 40ef15a98c..b26bc68548 100644 --- a/js/apps/system/_system/sessions/APP/storage.js +++ b/js/apps/system/_system/sessions/APP/storage.js @@ -1,6 +1,4 @@ -/*global applicationContext */ 'use strict'; - const _ = require('underscore'); const joi = require('joi'); const internal = require('internal'); diff --git a/js/common/bootstrap/modules.js b/js/common/bootstrap/modules.js index 0e766c65b0..610d576286 100644 --- a/js/common/bootstrap/modules.js +++ b/js/common/bootstrap/modules.js @@ -1378,17 +1378,17 @@ function require (path) { var keys = Object.keys(args); // script = Function.apply(null, keys.concat(content)); - // do not use Function constructor here... this is because the following code + // do not use Function constructor here... this is because the following code // // f = new Function("a", "b", "return 1"); - // + // // will create the following function code in current V8: // // function anonymous(a,b // /**/) { // return 1 // } - // + // // Though the function code is correct, the line numbers in the generated code // will be off by two lines due to V8 inserting two line breaks above the function body. // Generating the function as follows will avoid that: @@ -1399,7 +1399,7 @@ function require (path) { try { fn = internal.executeScript("(" + script + ")", undefined, filename); } catch (e) { - // This should never happen, right? + require('console').errorLines(e); throw extend(new internal.ArangoError({ errorNum: internal.errors.ERROR_SYNTAX_ERROR_IN_SCRIPT.code, errorMessage: internal.errors.ERROR_SYNTAX_ERROR_IN_SCRIPT.message @@ -1416,6 +1416,7 @@ function require (path) { return args[key]; })); } catch (e) { + require('console').errorLines(e); throw extend(new internal.ArangoError({ errorNum: internal.errors.ERROR_MODULE_FAILURE.code, errorMessage: internal.errors.ERROR_MODULE_FAILURE.message diff --git a/js/server/modules/org/arangodb/foxx/sessions.js b/js/server/modules/org/arangodb/foxx/sessions.js index b3c66a7c03..0eea1ad55c 100644 --- a/js/server/modules/org/arangodb/foxx/sessions.js +++ b/js/server/modules/org/arangodb/foxx/sessions.js @@ -50,10 +50,10 @@ function decorateController(auth, controller) { secret: cfg.cookie.secret, algorithm: cfg.cookie.algorithm } - }); + } : undefined); } - if (cfg.header) { - sid = sid || req.headers[cfg.header.toLowerCase()]; + if (!sid && cfg.header) { + sid = req.headers[cfg.header.toLowerCase()]; } if (sid) { if (cfg.jwt) {