From 7bce05ab86045968ac2bcdafe60af64d49600fa0 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Mon, 26 Apr 2021 15:06:57 +0100 Subject: [PATCH] Added custom no-cross-requires eslint rule [soft] refs: https://github.com/TryGhost/eslint-plugin-ghost/commit/7e787ef80745e6627f7fcd3cf1a941263c521023 - bumps eslint-plugin-ghost to 2.1.0 which adds the code for a new custom rule - adds configuration to our eslint file to enable the rule in a very soft mode for now - this rule is intended to enforce not tightly coupling the server and frontend - the intention is to make it stricter over time as the number of cross requires reduces - enabling this rule temporarily and running lint is a nice way to grok just how tightly coupled things are at the moment --- .eslintrc.json | 6 ++++-- package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index e35c50340c..00b6e078b3 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -10,9 +10,11 @@ "plugin:ghost/node" ], "rules": { - // TODO: remove this rule once it's turned into "error" in the base plugin + // @TODO: remove this rule once it's turned into "error" in the base plugin "no-shadow": "error", "no-var": "error", - "one-var": [2, "never"] + "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}] } } diff --git a/package.json b/package.json index 5c4e06c77b..dca9a4aed0 100644 --- a/package.json +++ b/package.json @@ -150,7 +150,7 @@ "coffeescript": "2.5.1", "cssnano": "5.0.1", "eslint": "7.25.0", - "eslint-plugin-ghost": "2.0.0", + "eslint-plugin-ghost": "2.1.0", "grunt": "1.4.0", "grunt-bg-shell": "2.3.3", "grunt-contrib-clean": "2.0.0", diff --git a/yarn.lock b/yarn.lock index 409eb2077a..c1f836f39c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3152,10 +3152,10 @@ eslint-plugin-ember@9.3.0: lodash.kebabcase "^4.1.1" snake-case "^3.0.3" -eslint-plugin-ghost@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-ghost/-/eslint-plugin-ghost-2.0.0.tgz#14e67180188850abf978df772e02bb74b1832374" - integrity sha512-BlygF0CZr/38ena3qztpyCuo7z1KsbbjEz0FO3zjfg+V6Id5wcZsKTaOdFHFZwyDl4kBm5jujFAsWILh/DtNiQ== +eslint-plugin-ghost@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-ghost/-/eslint-plugin-ghost-2.1.0.tgz#811402f32e6339be526368b1ce1b3b4be26a2e4d" + integrity sha512-zeAFtxthQ8GaC1LV4e+n6DMfLfl8AEAagYT63SQ1jYzYykK4Wmh0xEADMR0tZFl8eHzTornAyQWmWSwS7CUkXQ== dependencies: eslint-plugin-ember "9.3.0" eslint-plugin-mocha "8.0.0"