From ca5c6d03f6cb7421b6de83598202f96ed49b72d8 Mon Sep 17 00:00:00 2001 From: Jonathan Sharpe Date: Wed, 10 Jan 2024 23:51:13 +0000 Subject: [PATCH] Ensure process.env use is centralised --- server/.eslintrc | 9 ++++++++- server/utils/config.js | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/server/.eslintrc b/server/.eslintrc index b221ccff..74b41df2 100644 --- a/server/.eslintrc +++ b/server/.eslintrc @@ -16,6 +16,13 @@ } ], "rules": { - "no-console": "warn" + "no-console": "warn", + "no-restricted-syntax": [ + "warn", + { + "selector": "MemberExpression[object.name=process][property.name=env]", + "message": "process.env should only be accessed in utils/config.js" + } + ] } } diff --git a/server/utils/config.js b/server/utils/config.js index 0ba83ab9..20d041f6 100644 --- a/server/utils/config.js +++ b/server/utils/config.js @@ -1,3 +1,4 @@ +/* eslint-disable no-restricted-syntax */ import "dotenv/config"; export default {