0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Switched to using .js files for eslint

- Using JS files to configure eslint gives us more power, e.g. being able to calculate paths
- We already use JS in pretty much every other repo we own, including admin... it's just Ghost we don't, and it's time!
This commit is contained in:
Hannah Wolfe 2021-05-07 10:30:41 +01:00
parent b08b95085e
commit d2c6838133
No known key found for this signature in database
GPG key ID: 9F8C7532D0A6BA55
4 changed files with 50 additions and 52 deletions

18
.eslintrc.js Normal file
View file

@ -0,0 +1,18 @@
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': [2, 'never'],
// @TODO: enable this for all components once it gets a bit quieter
'ghost/ghost-custom/no-cross-requires': ['warn', {shared: true, server: false, frontend: false}]
}
};

View file

@ -1,20 +0,0 @@
{
"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": [2, "never"],
// @TODO: enable this for all components once it gets a bit quieter
"ghost/ghost-custom/no-cross-requires": ["warn", {"shared": true, "server": false, "frontend": false}]
}
}

32
test/.eslintrc.js Normal file
View file

@ -0,0 +1,32 @@
module.exports = {
env: {
es6: true,
node: true,
mocha: true
},
plugins: [
'ghost'
],
extends: [
'eslint:recommended',
'plugin:ghost/test'
],
rules: {
// TODO: remove this rule once it's turned into "error" in the base plugin
'no-shadow': 'error',
// these rules were were not previously enforced in our custom rules,
// they're turned off here because they _are_ enforced in our plugin.
// TODO: remove these custom rules and fix the problems in test files where appropriate
camelcase: 'off',
'no-prototype-builtins': 'off',
'no-unused-vars': 'off',
'no-useless-escape': 'off',
// TODO: remove these custom rules and fix problems in test files
'ghost/mocha/max-top-level-suites': 'off',
'ghost/mocha/no-identical-title': 'off',
'ghost/mocha/no-setup-in-describe': 'off',
'ghost/mocha/no-sibling-hooks': 'off'
}
};

View file

@ -1,32 +0,0 @@
{
"env": {
"es6": true,
"node": true,
"mocha": true
},
"plugins": [
"ghost"
],
"extends": [
"eslint:recommended",
"plugin:ghost/test"
],
"rules": {
// TODO: remove this rule once it's turned into "error" in the base plugin
"no-shadow": "error",
// these rules were were not previously enforced in our custom rules,
// they're turned off here because they _are_ enforced in our plugin.
// TODO: remove these custom rules and fix the problems in test files where appropriate
"camelcase": "off",
"no-prototype-builtins": "off",
"no-unused-vars": "off",
"no-useless-escape": "off",
// TODO: remove these custom rules and fix problems in test files
"ghost/mocha/max-top-level-suites": "off",
"ghost/mocha/no-identical-title": "off",
"ghost/mocha/no-setup-in-describe": "off",
"ghost/mocha/no-sibling-hooks": "off"
}
}