diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/api-client.js index 2551709c0c..760e0d4ea8 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/api-client.js @@ -1,4 +1,3 @@ -/* keep tidy */ import ArticleRequestAPIClient from "./article-request-api-client.js"; import AVAPIClient from "./authorised-value-api-client.js"; import CataloguingAPIClient from "./cataloguing-api-client.js"; diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/article-request-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/article-request-api-client.js index 3afc9a3cf8..59e984b122 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/article-request-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/article-request-api-client.js @@ -1,4 +1,3 @@ -/* keep tidy */ import HttpClient from "./http-client.js"; export class ArticleRequestAPIClient extends HttpClient { diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/authorised-value-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/authorised-value-api-client.js index c646541948..3ae25e4d67 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/authorised-value-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/authorised-value-api-client.js @@ -1,4 +1,3 @@ -/* keep tidy */ import HttpClient from "./http-client.js"; export class AVAPIClient extends HttpClient { diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/cataloguing-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/cataloguing-api-client.js index 7bae56d62a..843f467332 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/cataloguing-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/cataloguing-api-client.js @@ -1,4 +1,3 @@ -/* keep tidy */ import HttpClient from "./http-client.js"; export class CataloguingAPIClient extends HttpClient { diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/circulation-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/circulation-api-client.js index 4f32d5caa5..f822b68d6b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/circulation-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/circulation-api-client.js @@ -1,4 +1,3 @@ -/* keep tidy */ import HttpClient from "./http-client.js"; export class CirculationAPIClient extends HttpClient { diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/club-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/club-api-client.js index a238da5a6b..102a01c8ec 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/club-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/club-api-client.js @@ -1,4 +1,3 @@ -/* keep tidy */ import HttpClient from "./http-client.js"; export class ClubAPIClient extends HttpClient { diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/cover-image-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/cover-image-api-client.js index 6e1d73e42b..2d6c0a03cd 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/cover-image-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/cover-image-api-client.js @@ -1,4 +1,3 @@ -/* keep tidy */ import HttpClient from "./http-client.js"; export class CoverImageAPIClient extends HttpClient { diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js index 52ae08493a..50dc09f6ca 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/http-client.js @@ -1,4 +1,3 @@ -/* keep tidy */ class Dialog { constructor(options = {}) {} diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/localization-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/localization-api-client.js index 4fbede4c67..1a22dfbd3a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/localization-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/localization-api-client.js @@ -1,4 +1,3 @@ -/* keep tidy */ import HttpClient from "./http-client.js"; export class LocalizationAPIClient extends HttpClient { diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/patron-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/patron-api-client.js index a6825bd6bf..da8a510711 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/patron-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/patron-api-client.js @@ -1,4 +1,3 @@ -/* keep tidy */ import HttpClient from "./http-client.js"; export class PatronAPIClient extends HttpClient { diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/recall-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/recall-api-client.js index 3a413fe597..d7f04eb8ae 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/recall-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/recall-api-client.js @@ -1,4 +1,3 @@ -/* keep tidy */ import HttpClient from "./http-client.js"; export class RecallAPIClient extends HttpClient { diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/system-preferences-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/system-preferences-api-client.js index 11d30a4156..2301326362 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/system-preferences-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/system-preferences-api-client.js @@ -1,4 +1,3 @@ -/* keep tidy */ import HttpClient from "./http-client.js"; export class SysprefAPIClient extends HttpClient { diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/ticket-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/ticket-api-client.js index 267f65b1e1..1249716ae5 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/ticket-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/ticket-api-client.js @@ -1,4 +1,3 @@ -/* keep tidy */ import HttpClient from "./http-client.js"; export class TicketAPIClient extends HttpClient { diff --git a/koha-tmpl/intranet-tmpl/prog/js/form-submit.js b/koha-tmpl/intranet-tmpl/prog/js/form-submit.js index 5795891e4b..e52196c058 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/form-submit.js +++ b/koha-tmpl/intranet-tmpl/prog/js/form-submit.js @@ -1,4 +1,3 @@ -/* keep tidy */ $(document).ready(function () { $("body").on("click", ".submit-form-link", function (e) { e.preventDefault(); diff --git a/koha-tmpl/intranet-tmpl/prog/js/modals/add_catalog_concern.js b/koha-tmpl/intranet-tmpl/prog/js/modals/add_catalog_concern.js index 252103c3cf..013c0f1e3b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/modals/add_catalog_concern.js +++ b/koha-tmpl/intranet-tmpl/prog/js/modals/add_catalog_concern.js @@ -1,4 +1,3 @@ -/* keep tidy */ $(document).ready(function () { // Pre-populate empty message with template $("#addConcernModal").on("show.bs.modal", function (e) { diff --git a/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js b/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js index faa19cef3a..41e314f8f9 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js +++ b/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js @@ -1,4 +1,3 @@ -/* keep tidy */ $(document).ready(function () { document.addEventListener("click", function (event) { const detailTrigger = event.target.closest(".detail-trigger"); diff --git a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js index 2ba615b50a..8bbb4547e9 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js +++ b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js @@ -1,4 +1,3 @@ -/* keep tidy */ let dataFetched = false; let bookable_items, bookings, diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js index 58eae20d35..1427137090 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js @@ -1,4 +1,3 @@ -/* keep tidy */ /* global KOHA CodeMirror to_highlight search_jumped humanMsg dataTablesDefaults themelang */ // We can assume 'KOHA' exists, as we depend on KOHA.AJAX diff --git a/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js b/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js index 0a99991773..21c1b94ac7 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js +++ b/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js @@ -1,4 +1,3 @@ -/* keep tidy */ // Bookings var bookings_table; $(document).ready(function () { diff --git a/xt/js_tidy.t b/xt/js_tidy.t index 4fc2bff95f..3b4b348bb3 100755 --- a/xt/js_tidy.t +++ b/xt/js_tidy.t @@ -17,23 +17,16 @@ use Modern::Perl; use File::Slurp qw( read_file ); -use File::Find; -use FindBin(); -use Data::Dumper qw( Dumper ); -use Test::More tests => 1; +use Test::More; -my $cmd = q{git grep -l '/\* keep tidy \*/' -- '*.js'}; -my @js_files = qx{$cmd}; +my @js_files = + qx{git ls-files '*.js' '*.ts' ':(exclude)koha-tmpl/intranet-tmpl/lib' ':(exclude)koha-tmpl/intranet-tmpl/js/Gettext.js' ':(exclude)koha-tmpl/opac-tmpl/lib' ':(exclude)Koha/ILL/Backend/'}; + +plan tests => scalar @js_files; -my @not_tidy; foreach my $filepath (@js_files) { chomp $filepath; my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --arrow-parens avoid $filepath}; my $content = read_file $filepath; - if ( $content ne $tidy ) { - push @not_tidy, $filepath; - } + ok( $content eq $tidy, "$filepath should be kept tidy" ); } - -is( scalar(@not_tidy), 0, sprintf( 'No .js file should be messy %s/%s', scalar(@not_tidy), scalar(@js_files) ) ) - or diag Dumper \@not_tidy; diff --git a/xt/vue_tidy.t b/xt/vue_tidy.t index 5c1545b5cf..e4b1f9a613 100755 --- a/xt/vue_tidy.t +++ b/xt/vue_tidy.t @@ -17,39 +17,15 @@ use Modern::Perl; use File::Slurp qw( read_file ); -use File::Find; -use FindBin(); -use Data::Dumper qw( Dumper ); -use Test::More tests => 2; +use Test::More; -my @vue_files; -push @vue_files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/vue/*.vue'`; -my @js_files; -push @js_files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/vue/*.js'`; -push @js_files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/vue/*.ts'`; -push @js_files, `git ls-files 't/cypress/integration/*.ts'`; +my @vue_files = `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/vue/*.vue'`; +plan tests => scalar @vue_files; -my @not_tidy; foreach my $filepath (@vue_files) { chomp $filepath; - my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --semi false --arrow-parens avoid $filepath}; + my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --semi false --arrow-parens avoid $filepath}; my $content = read_file $filepath; - if ( $content ne $tidy ) { - push @not_tidy, $filepath; - } + ok( $content eq $tidy, "$filepath should be kept tidy" ); } - -is(scalar(@not_tidy), 0, 'No .vue file should be messy') or diag Dumper \@not_tidy; - -@not_tidy = (); -foreach my $filepath (@js_files) { - chomp $filepath; - my $tidy = qx{yarn --silent run prettier --trailing-comma es5 --arrow-parens avoid $filepath}; - my $content = read_file $filepath; - if ( $content ne $tidy ) { - push @not_tidy, $filepath; - } -} - -is(scalar(@not_tidy), 0, 'No js file from vue directory should be messy') or diag Dumper \@not_tidy;