pronto-eslint_npm 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 852e2d2bf476e03010b4e9da7f4f6ded98307bf58f6ad78a415bd7fe471ef2cd
4
- data.tar.gz: ffd531b2bbcd076cb9001c621596c9f7d90de37298d895e2e688020e438039e0
3
+ metadata.gz: 9fbb79e85b18bde94ac570a75dd3fd44b5232e93ab78497b849ff083f6753ce3
4
+ data.tar.gz: 4865498e75f4d0506b64b357f9138f4bf7448978eb3b466c63f03146052fdb98
5
5
  SHA512:
6
- metadata.gz: 2a65ce537c3af8258a56a9d52a852b2c14c889b46f632b8d34dd6409a5b3c9a5992798ca3464e66848dac4992fe4e66bf936f690abf66b2db4cf3f26f2c3a11d
7
- data.tar.gz: a6098c18ac5bd9daf7038ce21e8b18273e31cf8ed627d19d251c1f2d5264cddab85237b48d757a8936d24fe4c91d8264e640530ad05853b0a4ed01b9169dc98d
6
+ metadata.gz: ca1d901a982516737e8662a6b688b6fa638f6a5c930ca40107784385ceae61c3d3291231012efdc1fca4cc2c7f71a86f979536219d2631542188ead8d051f3d7
7
+ data.tar.gz: 486983fb4c1325a3099b15a6f79e40c3467c3799c5c03a2e13e91b7d031cca628dfda00c4185f8d8245f57be93bb6fc613c500fdbf0402006ca236f94f51b0fa
data/README.md CHANGED
@@ -33,7 +33,7 @@ Following options are available:
33
33
  | Option | Meaning | Default |
34
34
  | ----------------- | ---------------------------------------------------------------------------------------- | ----------------------------------- |
35
35
  | eslint_executable | ESLint executable to call. | `eslint` (calls `eslint` in `PATH`) |
36
- | files_to_lint | What files to lint. Absolute path of offending file will be matched against this Regexp. | `(\.js|\.es6)$` |
36
+ | files_to_lint | What files to lint. Absolute path of offending file will be matched against this Regexp. | `(\.js\|\.es6)$` |
37
37
  | cmd_line_opts | Command line options to pass to eslint when running | '' |
38
38
 
39
39
  Example configuration to call custom eslint executable and only lint files ending with `.my_custom_extension`:
@@ -7,6 +7,7 @@ module Pronto
7
7
  class ESLintNpm < Runner
8
8
  CONFIG_FILE = '.pronto_eslint_npm.yml'.freeze
9
9
  CONFIG_KEYS = %w[eslint_executable files_to_lint cmd_line_opts].freeze
10
+ SEVERITY_LEVELS = [nil, :warning, :error].freeze
10
11
 
11
12
  attr_writer :eslint_executable, :cmd_line_opts
12
13
 
@@ -60,19 +61,19 @@ module Pronto
60
61
  end
61
62
 
62
63
  def inspect(patch)
64
+ lines = patch.added_lines
63
65
  offences = run_eslint(patch)
64
66
  clean_up_eslint_output(offences)
65
67
  .map do |offence|
66
- patch
67
- .added_lines
68
- .select { |line| line.new_lineno == offence['line'] }
69
- .map { |line| new_message(offence, line) }
68
+ range = offence['line']..(offence['endLine'] || offence['line'])
69
+ line = lines.select { |line| range.cover?(line.new_lineno) }.last
70
+ new_message(offence, line) if line
70
71
  end
71
72
  end
72
73
 
73
74
  def new_message(offence, line)
74
75
  path = line.patch.delta.new_file[:path]
75
- level = :warning
76
+ level = SEVERITY_LEVELS.fetch(offence['severity'], :warning)
76
77
 
77
78
  Message.new(path, line, level, offence['message'], nil, self.class)
78
79
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Pronto
4
4
  module ESLintNpmVersion
5
- VERSION = '0.10.0'.freeze
5
+ VERSION = '0.10.1'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pronto-eslint_npm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Doits
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-02-05 00:00:00.000000000 Z
12
+ date: 2019-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pronto