pronto-eslint_npm 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/pronto/eslint_npm.rb +6 -5
- data/lib/pronto/eslint_npm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fbb79e85b18bde94ac570a75dd3fd44b5232e93ab78497b849ff083f6753ce3
|
4
|
+
data.tar.gz: 4865498e75f4d0506b64b357f9138f4bf7448978eb3b466c63f03146052fdb98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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`:
|
data/lib/pronto/eslint_npm.rb
CHANGED
@@ -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
|
-
|
67
|
-
|
68
|
-
|
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
|
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.
|
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-
|
12
|
+
date: 2019-05-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pronto
|