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
This commit is contained in:
Hannah Wolfe 2021-05-07 20:25:50 +01:00
parent 895bffec1f
commit 2e5977a137
No known key found for this signature in database
GPG Key ID: 9F8C7532D0A6BA55

View File

@ -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.'
}
]]
}
}
]
};