]>
git.immae.eu Git - github/fretlink/pronto-hlint.git/blob - lib/pronto/eslint.rb
b6ccff1fee5f2c17b51393f6b70ce1d59f0b4697
7 return [] unless @patches
9 @patches.select
{ |patch
| patch
.additions
> 0 }
10 .select
{ |patch
| js_file
?(patch
.new_file_full_path
) }
11 .map
{ |patch
| inspect(patch
) }
16 options
= File
.exist
?('.eslintrc') ? :eslintrc : :defaults
17 offences
= Eslintrb
.lint(patch
.new_file_full_path
, options
).compact
19 offences
.map
do |offence
|
20 patch
.added_lines
.select
{ |line
| line
.new_lineno
== offence
['line'] }
21 .map
{ |line
| new_message(offence
, line
) }
25 def new_message(offence
, line
)
26 path
= line
.patch
.delta
.new_file
[:path]
29 Message
.new(path
, line
, level
, offence
['message'], nil, self.class)
33 File
.extname(path
) == '.js'