danger-eslint 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +17 -0
- data/Gemfile.lock +3 -3
- data/README.md +22 -3
- data/danger-eslint.gemspec +4 -4
- data/lib/eslint/gem_version.rb +1 -1
- data/lib/eslint/plugin.rb +21 -25
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f75306f444e29ba6a23da7b7249efe6d1ac455aa
|
4
|
+
data.tar.gz: 1ff629f993c4a7ca1c5debbe9c4224173edffc78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a6e78d3e64ddaa1b360af3b8dc0664cbebffc19f1f67b601171b3042ece4260e3ffdc620ab4af50a94bc05eee5dc2293f57ced6a3e65a1f944ba6b4dbab17bb
|
7
|
+
data.tar.gz: 25f1d6d34311c3bec5ee6d1a075278f903ee1bc8422eb15962e720c80704aa593faadd0266ff8480c03c79954bd2343317c2ecba75a4aab0bb763120b7644be7
|
data/.rubocop.yml
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-eslint (0.1.
|
4
|
+
danger-eslint (0.1.1)
|
5
5
|
danger-plugin-api (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
colored2 (3.1.2)
|
20
20
|
cork (0.3.0)
|
21
21
|
colored2 (~> 3.1)
|
22
|
-
danger (5.3.
|
22
|
+
danger (5.3.1)
|
23
23
|
claide (~> 1.0)
|
24
24
|
claide-plugins (>= 0.9.2)
|
25
25
|
colored2 (~> 3.1)
|
@@ -132,4 +132,4 @@ DEPENDENCIES
|
|
132
132
|
yard (~> 0.8)
|
133
133
|
|
134
134
|
BUNDLED WITH
|
135
|
-
1.15.
|
135
|
+
1.15.1
|
data/README.md
CHANGED
@@ -1,15 +1,34 @@
|
|
1
|
+
[![Gem](https://img.shields.io/gem/v/danger-eslint.svg)](https://rubygems.org/gems/danger-eslint)
|
2
|
+
[![Gem](https://img.shields.io/gem/dt/danger-eslint.svg)](https://rubygems.org/gems/danger-eslint)
|
3
|
+
[![Gem](https://img.shields.io/gem/dtv/danger-eslint.svg)](https://rubygems.org/gems/danger-eslint)
|
4
|
+
[![Travis branch](https://img.shields.io/travis/leonhartX/danger-eslint/master.svg)](https://travis-ci.org/leonhartX/danger-eslint)
|
1
5
|
# danger-eslint
|
2
6
|
|
3
|
-
A
|
7
|
+
A [Danger](https://github.com/danger/danger) plugin for [eslint](http://eslint.org/).
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
7
11
|
$ gem install danger-eslint
|
12
|
+
|
13
|
+
`eslint` also needs to be installed(global or local) before you run Danger, Please check the [installation guide](http://eslint.org/docs/user-guide/getting-started)
|
14
|
+
`danger-eslint` will first try local `node_module/.bin/eslint` then the global `eslint`.
|
8
15
|
|
9
16
|
## Usage
|
17
|
+
Run lint without and configuration will do the samething as run `eslint .`
|
18
|
+
All lint result will send as individual comment. If your are using Github, the comment will show as a inline comment directly on the violation's position if possiable.
|
10
19
|
|
11
|
-
|
12
|
-
|
20
|
+
eslint.lint
|
21
|
+
|
22
|
+
Also, you can pass a config file or eslintignore file to danger-eslint with:
|
23
|
+
|
24
|
+
eslint.config_file = /path/yourconfig
|
25
|
+
eslint.ignore_file = /path/yourigonre
|
26
|
+
eslint.lint
|
27
|
+
|
28
|
+
If you want to lint only new/modified files. You can achieve that with setting the `filtering` parameter to `true`.
|
29
|
+
|
30
|
+
eslint.filtering = true
|
31
|
+
eslint.lint
|
13
32
|
|
14
33
|
## Development
|
15
34
|
|
data/danger-eslint.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Eslint::VERSION
|
9
9
|
spec.authors = ['leonhartX']
|
10
10
|
spec.email = ['leonhartx.k@gmail.com']
|
11
|
-
spec.description = %q{A
|
12
|
-
spec.summary = %q{A
|
11
|
+
spec.description = %q{A Danger plugin for linting javascript with eslint.}
|
12
|
+
spec.summary = %q{A Danger plugin for linting javascript with eslint.}
|
13
13
|
spec.homepage = 'https://github.com/leonhartX/danger-eslint'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
@@ -28,8 +28,8 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'rspec', '~> 3.4'
|
29
29
|
|
30
30
|
# Linting code and docs
|
31
|
-
spec.add_development_dependency "rubocop", "~> 0.
|
32
|
-
spec.add_development_dependency "yard", "~> 0.
|
31
|
+
spec.add_development_dependency "rubocop", "~> 0.49"
|
32
|
+
spec.add_development_dependency "yard", "~> 0.9.11"
|
33
33
|
|
34
34
|
# Makes testing easy via `bundle exec guard`
|
35
35
|
spec.add_development_dependency 'guard', '~> 2.14'
|
data/lib/eslint/gem_version.rb
CHANGED
data/lib/eslint/plugin.rb
CHANGED
@@ -2,23 +2,16 @@ require 'mkmf'
|
|
2
2
|
require 'json'
|
3
3
|
|
4
4
|
module Danger
|
5
|
-
#
|
6
|
-
#
|
5
|
+
# Lint javascript files using [eslint](http://eslint.org/).
|
6
|
+
# Results are send as inline commen.
|
7
7
|
#
|
8
|
-
#
|
9
|
-
# the public interface documented. Danger uses [YARD](http://yardoc.org/)
|
10
|
-
# for generating documentation from your plugin source, and you can verify
|
11
|
-
# by running `danger plugins lint` or `bundle exec rake spec`.
|
8
|
+
# @example Run eslint with changed files only
|
12
9
|
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
# @example Ensure people are well warned about merging on Mondays
|
16
|
-
#
|
17
|
-
# my_plugin.warn_on_mondays
|
10
|
+
# eslint.filtering = true
|
11
|
+
# eslint.lint
|
18
12
|
#
|
19
13
|
# @see leonhartX/danger-eslint
|
20
|
-
# @tags
|
21
|
-
#
|
14
|
+
# @tags lint, javaxctipt
|
22
15
|
class DangerEslint < Plugin
|
23
16
|
# An path to eslint's config file
|
24
17
|
# @return [String]
|
@@ -40,18 +33,8 @@ module Danger
|
|
40
33
|
# @return [void]
|
41
34
|
#
|
42
35
|
def lint
|
43
|
-
|
44
|
-
|
45
|
-
if filtering
|
46
|
-
results = ((git.modified_files - git.deleted_files) + git.added_files)
|
47
|
-
.select { |f| f.end_with? '.js' }
|
48
|
-
.map { |f| f.gsub("#{Dir.pwd}/", '') }
|
49
|
-
.map { |f| run_lint(bin, f).first }
|
50
|
-
else
|
51
|
-
results = run_lint(bin, '.')
|
52
|
-
end
|
53
|
-
results
|
54
|
-
.reject { |r| r['messages'].length.zero? }
|
36
|
+
lint_results
|
37
|
+
.reject { |r| r.nil? || r['messages'].length.zero? }
|
55
38
|
.reject { |r| r['messages'].first['message'].include? 'matching ignore pattern' }
|
56
39
|
.map { |r| send_comment r }
|
57
40
|
end
|
@@ -66,6 +49,19 @@ module Danger
|
|
66
49
|
File.exist?(local) ? local : find_executable('eslint')
|
67
50
|
end
|
68
51
|
|
52
|
+
# Get lint result regards the filtering option
|
53
|
+
#
|
54
|
+
# return [Hash]
|
55
|
+
def lint_results
|
56
|
+
bin = eslint_path
|
57
|
+
raise 'eslint is not installed' unless bin
|
58
|
+
return run_lint(bin, '.') unless filtering
|
59
|
+
((git.modified_files - git.deleted_files) + git.added_files)
|
60
|
+
.select { |f| f.end_with? '.js' }
|
61
|
+
.map { |f| f.gsub("#{Dir.pwd}/", '') }
|
62
|
+
.map { |f| run_lint(bin, f).first }
|
63
|
+
end
|
64
|
+
|
69
65
|
# Run eslint aginst a single file.
|
70
66
|
#
|
71
67
|
# @param [String] bin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-eslint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- leonhartX
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
@@ -72,28 +72,28 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.49'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.49'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: yard
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 0.9.11
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 0.9.11
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: guard
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,7 +150,7 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
-
description: A
|
153
|
+
description: A Danger plugin for linting javascript with eslint.
|
154
154
|
email:
|
155
155
|
- leonhartx.k@gmail.com
|
156
156
|
executables: []
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- ".eslintignore"
|
161
161
|
- ".eslintrc.json"
|
162
162
|
- ".gitignore"
|
163
|
+
- ".rubocop.yml"
|
163
164
|
- ".travis.yml"
|
164
165
|
- Gemfile
|
165
166
|
- Gemfile.lock
|
@@ -206,10 +207,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
207
|
version: '0'
|
207
208
|
requirements: []
|
208
209
|
rubyforge_project:
|
209
|
-
rubygems_version: 2.
|
210
|
+
rubygems_version: 2.5.2
|
210
211
|
signing_key:
|
211
212
|
specification_version: 4
|
212
|
-
summary: A
|
213
|
+
summary: A Danger plugin for linting javascript with eslint.
|
213
214
|
test_files:
|
214
215
|
- spec/eslint_spec.rb
|
215
216
|
- spec/fixtures/config/.eslintignore
|