diff --git a/backend/eslint.config.js b/backend/eslint.config.js index e5eb2558..9ed74ac0 100644 --- a/backend/eslint.config.js +++ b/backend/eslint.config.js @@ -1,34 +1,15 @@ -import js from '@eslint/js' -import jest from 'eslint-plugin-jest' -import globals from 'globals' +import globals from "globals"; +import pluginJs from "@eslint/js"; +/** @type {import('eslint').Linter.Config[]} */ export default [ - { ignores: ['dist'] }, - { - files: ['**/*.{js,ts}'], - languageOptions: { - ecmaVersion: 'latest', - globals: globals.node, - parserOptions: { - ecmaVersion: 'latest', - ecmaFeatures: { jsx: true }, - sourceType: 'module', - }, - }, - rules: { - ...js.configs.recommended.rules, - }, - }, - { - files: ['**/__tests__/**/*.test.{js,ts}'], - plugins: { - jest, - }, - languageOptions: { - globals: jest.environments.globals.globals - }, - rules: { - ...jest.configs.recommended.rules, - } - } -] + { languageOptions: { globals: globals.node } }, + pluginJs.configs.recommended, + { + rules: { + camelcase: ["warn", { properties: "never", ignoreDestructuring: false }], + "max-len": ["warn", { code: 140 }], + "no-console": "warn", + }, + }, +]; diff --git a/backend/package.json b/backend/package.json index 9634e7a3..b7b01d00 100644 --- a/backend/package.json +++ b/backend/package.json @@ -6,7 +6,7 @@ "scripts": { "build": "babel index.js -d dist", "dev": "nodemon server", - "lint": "eslint .", + "lint": "eslint", "start": "node index.js", "test": "jest" }, diff --git a/backend/src/middlewares/auth.js b/backend/src/middlewares/auth.js index e0596177..b8d71ea2 100644 --- a/backend/src/middlewares/auth.js +++ b/backend/src/middlewares/auth.js @@ -16,12 +16,10 @@ const auth = async (req, res, next) => { }) req.supabase = supabase; } else { - console.error("No token: Authentication Denied"); return res.status(401).json({ message: "No token: Authentication Denied" }); } next(); } catch (err) { - console.error("Invalid token, authentication denied:", err.message); return res.status(400).json({ message: `Invalid token, authentication denied: ${err.message}`}); } }; diff --git a/backend/src/routes/logbooks-route.js b/backend/src/routes/logbooks-route.js index add94897..b86a059e 100644 --- a/backend/src/routes/logbooks-route.js +++ b/backend/src/routes/logbooks-route.js @@ -25,13 +25,13 @@ router.post("/:logbookID/logs", auth, async (req, res) => { }); router.get("/:logbookID/logs/", auth, async (req, res) => { - const logbookLogs = await getLogbookLogs(req) + const logbookLogs = await getLogbookLogs(req); res.status(200).json({ data: logbookLogs }); -}) +}); router.get("/:logbookID/logs/:logID", auth, async (req, res) => { - const log = await getLog(req) + const log = await getLog(req); res.status(200).json({ data: log }); -}) +}); export default router;