2021-05-07 22:25:50 +03:00
|
|
|
const path = require('path');
|
|
|
|
|
2021-05-07 12:30:41 +03:00
|
|
|
module.exports = {
|
|
|
|
env: {
|
|
|
|
es6: true,
|
|
|
|
node: true
|
|
|
|
},
|
|
|
|
plugins: ['ghost'],
|
|
|
|
extends: [
|
|
|
|
'plugin:ghost/node'
|
|
|
|
],
|
|
|
|
rules: {
|
|
|
|
// @TODO: remove this rule once it's turned into "error" in the base plugin
|
|
|
|
'no-shadow': 'error',
|
|
|
|
'no-var': 'error',
|
2021-06-30 17:37:23 +03:00
|
|
|
'one-var': ['error', 'never']
|
2021-05-07 15:21:22 +03:00
|
|
|
},
|
|
|
|
overrides: [
|
2021-05-07 22:41:14 +03:00
|
|
|
{
|
|
|
|
files: 'core/server/api/canary/*',
|
|
|
|
rules: {
|
2021-10-25 16:36:12 +03:00
|
|
|
'ghost/ghost-custom/max-api-complexity': 'error'
|
2021-05-07 22:41:14 +03:00
|
|
|
}
|
|
|
|
},
|
2021-05-07 15:21:22 +03:00
|
|
|
{
|
|
|
|
files: 'core/shared/**',
|
|
|
|
rules: {
|
2021-05-26 14:34:39 +03:00
|
|
|
'ghost/node/no-restricted-require': ['error', [
|
2021-05-07 15:21:22 +03:00
|
|
|
{
|
2021-05-07 22:25:50 +03:00
|
|
|
name: path.resolve(__dirname, 'core/server/**'),
|
2021-05-07 15:21:22 +03:00
|
|
|
message: 'Invalid require of core/server from core/shared.'
|
|
|
|
},
|
|
|
|
{
|
2021-09-30 16:59:01 +03:00
|
|
|
name: path.resolve(__dirname, 'core/frontend/**'),
|
2021-05-07 15:21:22 +03:00
|
|
|
message: 'Invalid require of core/frontend from core/shared.'
|
|
|
|
}
|
|
|
|
]]
|
|
|
|
}
|
2021-05-07 22:25:50 +03:00
|
|
|
},
|
|
|
|
/**
|
|
|
|
* @TODO: enable these soon
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
files: 'core/frontend/**',
|
|
|
|
rules: {
|
|
|
|
'ghost/node/no-restricted-require': ['off', [
|
2021-10-16 18:30:09 +03:00
|
|
|
// If we make the frontend entirely independent, these have to be solved too
|
|
|
|
// {
|
|
|
|
// name: path.resolve(__dirname, 'core/shared/**'),
|
|
|
|
// message: 'Invalid require of core/shared from core/frontend.'
|
|
|
|
// },
|
2021-09-29 13:12:33 +03:00
|
|
|
// These are critical refactoring issues that we need to tackle ASAP
|
2021-05-07 22:25:50 +03:00
|
|
|
{
|
2021-10-19 20:41:02 +03:00
|
|
|
name: [path.resolve(__dirname, 'core/server/**')],
|
2021-05-07 22:25:50 +03:00
|
|
|
message: 'Invalid require of core/server from core/frontend.'
|
|
|
|
}
|
|
|
|
]]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: 'core/server/**',
|
|
|
|
rules: {
|
2021-10-21 22:37:08 +03:00
|
|
|
'ghost/node/no-restricted-require': ['warn', [
|
2021-05-07 22:25:50 +03:00
|
|
|
{
|
2021-10-16 19:27:08 +03:00
|
|
|
// Throw an error for all requires of the frontend, _except_ the url service which will be moved soon
|
2021-10-19 20:41:02 +03:00
|
|
|
name: [path.resolve(__dirname, 'core/frontend/**')],
|
2021-05-07 22:25:50 +03:00
|
|
|
message: 'Invalid require of core/frontend from core/server.'
|
|
|
|
}
|
|
|
|
]]
|
|
|
|
}
|
2021-05-07 15:21:22 +03:00
|
|
|
}
|
|
|
|
]
|
2021-05-07 12:30:41 +03:00
|
|
|
};
|