From ac32944dc6caa095836a4f2228c163b837e5f66c Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Tue, 5 Apr 2022 11:49:13 +0100 Subject: [PATCH] Updated migration eslint rule to catch bad filenames - We had an incident where a migration file was misnamed. - This is caused by using slimer with spaces rather than hyphens - We didn't imagine this case when writing the regex for matching filenames - However, now we know it, it's easy to tweak the regex to match this case - This requires adding an override to the one badly named file --- .eslintrc.js | 2 +- .../data/migrations/versions/4.42/2022-03-21-17-17-add.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index e673e42f72..678bd88615 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -30,7 +30,7 @@ module.exports = { 'core/server/data/migrations/versions/3.*/*' ], rules: { - 'ghost/filenames/match-regex': ['error', '^(?:\\d{2}|\\d{4}(?:-\\d{2}){4})(?:-[a-zA-Z]+)+$', true] + 'ghost/filenames/match-regex': ['error', '^(?:\\d{2}|\\d{4}(?:-\\d{2}){4})(?:-[a-zA-Z]+){2,}$', true] } }, { diff --git a/core/server/data/migrations/versions/4.42/2022-03-21-17-17-add.js b/core/server/data/migrations/versions/4.42/2022-03-21-17-17-add.js index 62763126f4..acd1e0af8b 100644 --- a/core/server/data/migrations/versions/4.42/2022-03-21-17-17-add.js +++ b/core/server/data/migrations/versions/4.42/2022-03-21-17-17-add.js @@ -1,3 +1,8 @@ +// ESLint Override Notice +// This file was named incorrectly and it didn't flag up in our eslint rules. +// The ESLint match-regex rule has now been updated to catch this, but this file has to be excluded. +/* eslint-disable ghost/filenames/match-regex */ + const {addTable} = require('../../utils'); module.exports = addTable('newsletters', {