37 lines
521 B
Perl
Executable File
37 lines
521 B
Perl
Executable File
#!/usr/bin/env perl
|
|
|
|
use strict;
|
|
|
|
# check by default
|
|
my @mode;
|
|
|
|
my @files = grep {
|
|
$_ ne '--fix'or not (@mode = ('--fix'));
|
|
} @ARGV;
|
|
|
|
@files = qw/ src / unless @files;
|
|
|
|
my @ignore = (
|
|
qr/\.map$/,
|
|
qr!^docs/!,
|
|
qr/\.(css|html|md)$/,
|
|
qr/package\.(json|yaml)/,
|
|
qr#^scripts/#,
|
|
qr#^\.#,
|
|
qr#\.json$#
|
|
);
|
|
|
|
sub ignored {
|
|
my $file = shift;
|
|
|
|
for my $pattern ( @ignore ) {
|
|
return 1 if $file =~ $pattern;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
exec 'eslint', @mode, grep {
|
|
not ignored($_)
|
|
} @files;
|