Bug 36374: flag JS files to keep tidy

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2024-03-21 08:45:11 +01:00 committed by Katrin Fischer
parent f196f3cb70
commit eb498f636e
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
4 changed files with 9 additions and 5 deletions

View file

@ -1,3 +1,4 @@
/* keep tidy */
$(document).ready(function() {
// Pre-populate empty message with template

View file

@ -1,3 +1,4 @@
/* keep tidy */
$(document).ready(function() {
$('#ticketDetailsModal').on('show.bs.modal', function(event) {
let modal = $(this);

View file

@ -1,3 +1,4 @@
/* keep tidy */
let dataFetched = false;
let bookable_items,
bookings,

View file

@ -1,4 +1,4 @@
#!/usr/bin/perl
#/usr/bin/perl
# This file is part of Koha.
#
@ -22,17 +22,18 @@ use FindBin();
use Data::Dumper qw( Dumper );
use Test::More tests => 1;
my @js_files;
push @js_files, `git ls-files 'koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js'`;
my $cmd = q{git grep -l '/\* keep tidy \*/' -- '*.js'};
my @js_files = qx{$cmd};
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 $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 should be messy') or diag Dumper \@not_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;