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-08 13:36:37 +03:00
|
|
|
'one-var': [2, 'never'],
|
|
|
|
'no-restricted-syntax': ['warn',
|
|
|
|
{
|
|
|
|
selector: 'NewExpression[callee.name=\'Error\']',
|
|
|
|
message: 'Direct calls to new Error() are not allowed. Please use @tryghost/errors.'
|
|
|
|
}]
|
2021-05-07 15:21:22 +03:00
|
|
|
},
|
|
|
|
overrides: [
|
2021-05-07 23:00:39 +03:00
|
|
|
{
|
|
|
|
files: '**/index.js',
|
|
|
|
rules: {
|
|
|
|
'max-lines': ['warn', {skipBlankLines: true, skipComments: true, max: 50}]
|
|
|
|
}
|
|
|
|
},
|
2021-05-07 22:41:14 +03:00
|
|
|
{
|
|
|
|
files: 'core/server/api/canary/*',
|
|
|
|
rules: {
|
|
|
|
'ghost/ghost-custom/max-api-complexity': 'warn'
|
|
|
|
}
|
|
|
|
},
|
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-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/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', [
|
|
|
|
{
|
|
|
|
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.'
|
|
|
|
}
|
|
|
|
]]
|
|
|
|
}
|
2021-05-07 15:21:22 +03:00
|
|
|
}
|
|
|
|
]
|
2021-05-07 12:30:41 +03:00
|
|
|
};
|