From b77f4f1379c7d9a7c81cd79a9b4dce91f72af20f Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Fri, 8 Sep 2023 13:35:48 +0100 Subject: [PATCH] Merge pull request #14727 from overleaf/bg-eslint-rule-for-node-fetch restrict use of node-fetch using eslint rules GitOrigin-RevId: 79fd41a7f69e68d2f9f9c55c5d46ffd7bf3c00fd --- services/web/.eslintrc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/services/web/.eslintrc b/services/web/.eslintrc index 19566de917..05775e78e3 100644 --- a/services/web/.eslintrc +++ b/services/web/.eslintrc @@ -101,7 +101,16 @@ "import/no-extraneous-dependencies": ["error", { // do not allow importing of devDependencies. "devDependencies": false - }] + }], + + // do not allow node-fetch in backend code + "no-restricted-syntax": [ + "error", + { + "selector": "CallExpression[callee.name='require'] > .arguments[value='node-fetch']", + "message": "Requiring node-fetch is not allowed in production services, please use fetch-utils." + } + ] } }, {