From 2e5977a137c2b3ab9ff1595644cf77065d10d6a0 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Fri, 7 May 2021 20:25:50 +0100 Subject: [PATCH] Added require rules for server<>frontend [off] - These rules will help us to enforce that server code should not be required from the frontend, and vice versa - They are disabled/off for now because they are too noisy and not quick to fix - Having them in place makes it easy to set them to warn to preview how we're getting on with fixing them ahead of enabling them --- .eslintrc.js | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 4bd2a90270..5765c6539f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,3 +1,5 @@ +const path = require('path'); + module.exports = { env: { es6: true, @@ -19,15 +21,40 @@ module.exports = { rules: { 'ghost/node/no-restricted-require': ['warn', [ { - name: '../server/**', + name: path.resolve(__dirname, 'core/server/**'), message: 'Invalid require of core/server from core/shared.' }, { - name: '../frontend/**', + name: path.resolve(__dirname, 'core/server/**'), message: 'Invalid require of core/frontend from core/shared.' } ]] } + }, + /** + * @TODO: enable these soon + */ + { + files: 'core/frontend/**', + rules: { + 'ghost/node/no-restricted-require': ['off', [ + { + name: path.resolve(__dirname, 'core/server/**'), + message: 'Invalid require of core/server from core/frontend.' + } + ]] + } + }, + { + files: 'core/server/**', + rules: { + 'ghost/node/no-restricted-require': ['off', [ + { + name: path.resolve(__dirname, 'core/frontend/**'), + message: 'Invalid require of core/frontend from core/server.' + } + ]] + } } ] };