diff --git a/.eslintignore b/.eslintignore index f177ae88ff..eea84f4843 100644 --- a/.eslintignore +++ b/.eslintignore @@ -13,5 +13,4 @@ wagtail/search/static wagtail/snippets/static wagtail/users/static wagtail/contrib/*/static -wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/includes/searchpromotions_formset.js .mypy_cache diff --git a/.eslintrc.js b/.eslintrc.js index e8a99ea68a..07ddcba1a3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -136,6 +136,7 @@ module.exports = { files: [ 'docs/_static/**', 'wagtail/contrib/modeladmin/static_src/wagtailmodeladmin/js/prepopulate.js', + 'wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/includes/searchpromotions_formset.js', 'wagtail/contrib/settings/static_src/wagtailsettings/js/site-switcher.js', 'wagtail/documents/static_src/wagtaildocs/js/add-multiple.js', 'wagtail/embeds/static_src/wagtailembeds/js/embed-chooser-modal.js', diff --git a/.prettierignore b/.prettierignore index a3ad2ef8fc..97ded0d057 100644 --- a/.prettierignore +++ b/.prettierignore @@ -11,5 +11,4 @@ _build *.md # Files which contain incompatible syntax. *.html -wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/includes/searchpromotions_formset.js .mypy_cache diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 7be64d333a..581d8d0e40 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -15,6 +15,7 @@ Changelog * Run Python tests with coverage and upload coverage data to codecov (Sage Abdullah) * Clean up duplicate JavaScript for the `escapeHtml` function (Jordan Rob) * Add documentation for `register_user_listing_buttons` hook (LB (Ben Johnston)) + * Clean up Prettier & Eslint usage for search promotions formset JS file (LB (Ben Johnston)) * Fix: Make sure workflow timeline icons are visible in high-contrast mode (Loveth Omokaro) * Fix: Ensure authentication forms (login, password reset) have a visible border in Windows high-contrast mode (Loveth Omokaro) * Fix: Ensure visual consistency between buttons and links as buttons in Windows high-contrast mode (Albina Starykova) diff --git a/wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/includes/searchpromotions_formset.js b/wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/includes/searchpromotions_formset.js index 3bf447c1f7..a16c14a609 100644 --- a/wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/includes/searchpromotions_formset.js +++ b/wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/includes/searchpromotions_formset.js @@ -1,13 +1,15 @@ -$(function() { - var panel = InlinePanel({ - formsetPrefix: "id_{{ formset.prefix }}", - emptyChildFormPrefix: "{{ formset.empty_form.prefix }}", - canOrder: true - }); +$(function () { + // eslint-disable-next-line no-undef + var panel = InlinePanel({ + formsetPrefix: 'id_{{ formset.prefix }}', + emptyChildFormPrefix: '{{ formset.empty_form.prefix }}', + canOrder: true, + }); - {% for form in formset.forms %} - panel.initChildControls('{{ formset.prefix }}-{{ forloop.counter0 }}'); - {% endfor %} + // {# Ensure eslint/prettier ignore the Django template syntax by treating them as comments, template for loop will still be executed by Django #} + // {% for form in formset.forms %} + panel.initChildControls('{{ formset.prefix }}-{{ forloop.counter0 }}'); + // {% endfor %} - panel.updateMoveButtonDisabledStates(); + panel.updateMoveButtonDisabledStates(); });