mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 19:02:29 +03:00
df51da5f7e
refs:10d02e8343
refs:83a30775bf
refs:3355f627c4
refs:0e9b950558
- In eslint-plugin-ghost 2.4.0 I moved some of the rules implmented in Ghost as they are global rules, including: - no new Error() - use @tryghost/errors - forcing index.js to be under 50 chars as a leading indicator for misuse of index files - I also added new rules to check for tpl('literal string') and the deprecated ghost-ignition package - Because the new Error and tpl rules are both implemented with no-restricted-syntax, the local rules overrode the global one - Removing the rule here allows the global ones to work - Have to think about how to do this long term
67 lines
1.9 KiB
JavaScript
67 lines
1.9 KiB
JavaScript
const path = require('path');
|
|
|
|
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',
|
|
'one-var': ['error', 'never']
|
|
},
|
|
overrides: [
|
|
{
|
|
files: 'core/server/api/canary/*',
|
|
rules: {
|
|
'ghost/ghost-custom/max-api-complexity': 'warn'
|
|
}
|
|
},
|
|
{
|
|
files: 'core/shared/**',
|
|
rules: {
|
|
'ghost/node/no-restricted-require': ['error', [
|
|
{
|
|
name: path.resolve(__dirname, 'core/server/**'),
|
|
message: 'Invalid require of core/server from core/shared.'
|
|
},
|
|
{
|
|
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.'
|
|
}
|
|
]]
|
|
}
|
|
}
|
|
]
|
|
};
|