From d7ed1196bdd44d7734d41d91a5e72a71785e0a08 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 5 Jan 2023 02:09:07 +0100 Subject: switched to single quotes string in eslint --- middlewares/formParser.js | 2 +- middlewares/helmet.js | 4 ++-- middlewares/requireAuth.js | 2 +- middlewares/sessions.js | 20 ++++++++++---------- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'middlewares') diff --git a/middlewares/formParser.js b/middlewares/formParser.js index 41134ac..b117045 100644 --- a/middlewares/formParser.js +++ b/middlewares/formParser.js @@ -1,3 +1,3 @@ -import bodyParser from "body-parser"; +import bodyParser from 'body-parser'; export default bodyParser.urlencoded({ extended: false }); diff --git a/middlewares/helmet.js b/middlewares/helmet.js index 5ced2c3..67d6e98 100644 --- a/middlewares/helmet.js +++ b/middlewares/helmet.js @@ -1,10 +1,10 @@ -import helmet from "helmet"; +import helmet from 'helmet'; const myHelmet = helmet({ contentSecurityPolicy: { directives: { ...helmet.contentSecurityPolicy.getDefaultDirectives(), - "script-src": ["'self'", "'unsafe-inline'"], + 'script-src': ['\'self\'', '\'unsafe-inline\''], }, }, }); diff --git a/middlewares/requireAuth.js b/middlewares/requireAuth.js index 1ea6deb..4d85e43 100644 --- a/middlewares/requireAuth.js +++ b/middlewares/requireAuth.js @@ -2,7 +2,7 @@ function requireAuth(req, res, next) { if (req.session.user !== undefined) { return next(); } - return res.redirect(302, "/login"); + return res.redirect(302, '/login'); } export default requireAuth; diff --git a/middlewares/sessions.js b/middlewares/sessions.js index 901c262..30f5c49 100644 --- a/middlewares/sessions.js +++ b/middlewares/sessions.js @@ -1,21 +1,21 @@ -import expressSession from "express-session"; -import Database from "better-sqlite3"; -import sqliteStore from "better-sqlite3-session-store"; +import expressSession from 'express-session'; +import Database from 'better-sqlite3'; +import sqliteStore from 'better-sqlite3-session-store'; const SqliteStore = sqliteStore(expressSession); const db = new Database( - process.env.NODE_ENV === "test" ? "testsessions.db" : "sessions.db", - process.env.NODE_ENV === "development" ? { verbose: console.log } : null + process.env.NODE_ENV === 'test' ? 'testsessions.db' : 'sessions.db', + process.env.NODE_ENV === 'development' ? { verbose: console.log } : null ); -const secret = process.env.SESSION_SECRET || "secret"; +const secret = process.env.SESSION_SECRET || 'secret'; const session = expressSession({ cookie: { httpOnly: true, maxAge: 1000 * 60 * 60 * 24 * 15, // 15 days - sameSite: "Strict", - secure: process.env.NODE_ENV === "production" ? true : false, + sameSite: 'Strict', + secure: process.env.NODE_ENV === 'production' ? true : false, }, - name: "JDMSessionId", + name: 'JDMSessionId', saveUninitialized: false, secret: secret, store: new SqliteStore({ @@ -26,7 +26,7 @@ const session = expressSession({ } }), resave: false, - unset: "destroy", + unset: 'destroy', }); export default session; -- cgit v1.2.3