/
JSLint.pm
59 lines (35 loc) · 875 Bytes
/
JSLint.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package Code::TidyAll::Plugin::JSLint;
use IPC::Run3 qw(run3);
use Moo;
extends 'Code::TidyAll::Plugin';
our $VERSION = '0.31';
sub _build_cmd {'jslint'}
sub validate_file {
my ( $self, $file ) = @_;
my $cmd = sprintf( "%s %s %s", $self->cmd, $self->argv, $file );
my $output;
run3( $cmd, \undef, \$output, \$output );
die "$output\n" if $output !~ /is OK\./;
}
1;
# ABSTRACT: Use jslint with tidyall
__END__
=pod
=head1 SYNOPSIS
In configuration:
[JSLint]
select = static/**/*.js
argv = --white --vars --regex
=head1 DESCRIPTION
Runs L<jslint|http://www.jslint.com/>, a JavaScript validator, and dies if any
problems were found.
=head1 INSTALLATION
Install L<npm|https://npmjs.org/>, then run
npm install jslint
=head1 CONFIGURATION
=over
=item argv
Arguments to pass to jslint
=item cmd
Full path to jslint
=back