mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
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:
parent
895bffec1f
commit
2e5977a137
1 changed files with 29 additions and 2 deletions
31
.eslintrc.js
31
.eslintrc.js
|
@ -1,3 +1,5 @@
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
env: {
|
env: {
|
||||||
es6: true,
|
es6: true,
|
||||||
|
@ -19,15 +21,40 @@ module.exports = {
|
||||||
rules: {
|
rules: {
|
||||||
'ghost/node/no-restricted-require': ['warn', [
|
'ghost/node/no-restricted-require': ['warn', [
|
||||||
{
|
{
|
||||||
name: '../server/**',
|
name: path.resolve(__dirname, 'core/server/**'),
|
||||||
message: 'Invalid require of core/server from core/shared.'
|
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.'
|
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.'
|
||||||
|
}
|
||||||
|
]]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue