pronto-eslint 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 24861194093c8f1e45f29f82282ea42ce542e326
4
+ data.tar.gz: 8a26422b1a839c58d5940c493f4e9481d6573594
5
+ SHA512:
6
+ metadata.gz: d995a96c9473d5e58052107c393b848c4e167fd58c4c32e4292ceb256640c1fb01620ea6a7aa8000e2043a4e74accdabe2ae9cb5c9b02ecfb35cf67b0ce7efa8
7
+ data.tar.gz: 1ccc3efd09a83b3fddcc54211485acac893c5e064166b9df0ceddee3bdc73703dd46e78d375deeaf27acb69fcbe84afa54cfb30e932eb1fdacae1ab84f8e65ac
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2016 Mindaugas Mozūras
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,16 @@
1
+ # Pronto runner for ESLint
2
+
3
+ [![Code Climate](https://codeclimate.com/github/mmozuras/pronto-eslint.png)](https://codeclimate.com/github/mmozuras/pronto-eslint)
4
+ [![Build Status](https://travis-ci.org/mmozuras/pronto-eslint.png)](https://travis-ci.org/mmozuras/pronto-eslint)
5
+ [![Gem Version](https://badge.fury.io/rb/pronto-eslint.png)](http://badge.fury.io/rb/pronto-eslint)
6
+ [![Dependency Status](https://gemnasium.com/mmozuras/pronto-eslint.png)](https://gemnasium.com/mmozuras/pronto-eslint)
7
+
8
+ Pronto runner for [ESlint](http://eslint.org), pluggable linting utility for JavaScript and JSX. [What is Pronto?](https://github.com/mmozuras/pronto)
9
+
10
+ ## Prerequisites
11
+
12
+ You'll need to install one of the runtimes supported by [ExecJS](https://github.com/sstephenson/execjs#execjs).
13
+
14
+ ## Configuration
15
+
16
+ Configuring ESLint via .eslintrc will work just fine with pronto-eslint.
@@ -0,0 +1,36 @@
1
+ require 'pronto'
2
+ require 'eslintrb'
3
+
4
+ module Pronto
5
+ class ESLint < Runner
6
+ def run(patches, _)
7
+ return [] unless patches
8
+
9
+ patches.select { |patch| patch.additions > 0 }
10
+ .select { |patch| js_file?(patch.new_file_full_path) }
11
+ .map { |patch| inspect(patch) }
12
+ .flatten.compact
13
+ end
14
+
15
+ def inspect(patch)
16
+ options = File.exist?('.eslintrc') ? :eslintrc : :defaults
17
+ offences = Eslintrb.lint(patch.new_file_full_path, options).compact
18
+
19
+ offences.map do |offence|
20
+ patch.added_lines.select { |line| line.new_lineno == offence['line'] }
21
+ .map { |line| new_message(offence, line) }
22
+ end
23
+ end
24
+
25
+ def new_message(offence, line)
26
+ path = line.patch.delta.new_file[:path]
27
+ level = :warning
28
+
29
+ Message.new(path, line, level, offence['message'])
30
+ end
31
+
32
+ def js_file?(path)
33
+ File.extname(path) == '.js'
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,5 @@
1
+ module Pronto
2
+ module ESLintVersion
3
+ VERSION = '0.5.0'.freeze
4
+ end
5
+ end
@@ -0,0 +1,42 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
4
+ require 'pronto/eslint/version'
5
+ require 'English'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'pronto-eslint'
9
+ s.version = Pronto::ESLintVersion::VERSION
10
+ s.platform = Gem::Platform::RUBY
11
+ s.author = 'Mindaugas Mozūras'
12
+ s.email = 'mindaugas.mozuras@gmail.com'
13
+ s.homepage = 'http://github.org/mmozuras/pronto-eslintt'
14
+ s.summary = <<-EOF
15
+ Pronto runner for ESLint, pluggable linting utility for JavaScript and JSX
16
+ EOF
17
+
18
+ s.licenses = ['MIT']
19
+ s.required_ruby_version = '>= 1.9.3'
20
+ s.rubygems_version = '1.8.23'
21
+
22
+ s.files = `git ls-files`.split($RS).reject do |file|
23
+ file =~ %r{^(?:
24
+ spec/.*
25
+ |Gemfile
26
+ |Rakefile
27
+ |\.rspec
28
+ |\.gitignore
29
+ |\.rubocop.yml
30
+ |\.travis.yml
31
+ )$}x
32
+ end
33
+ s.test_files = []
34
+ s.extra_rdoc_files = ['LICENSE', 'README.md']
35
+ s.require_paths = ['lib']
36
+
37
+ s.add_dependency('pronto', '~> 0.5.0')
38
+ s.add_dependency('eslintrb', '~> 2.0.0')
39
+ s.add_development_dependency('rake', '~> 10.4')
40
+ s.add_development_dependency('rspec', '~> 3.3')
41
+ s.add_development_dependency('rspec-its', '~> 1.2')
42
+ end
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pronto-eslint
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Mindaugas Mozūras
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pronto
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.5.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.5.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: eslintrb
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-its
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.2'
83
+ description:
84
+ email: mindaugas.mozuras@gmail.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files:
88
+ - LICENSE
89
+ - README.md
90
+ files:
91
+ - LICENSE
92
+ - README.md
93
+ - lib/pronto/eslint.rb
94
+ - lib/pronto/eslint/version.rb
95
+ - pronto-eslint.gemspec
96
+ homepage: http://github.org/mmozuras/pronto-eslintt
97
+ licenses:
98
+ - MIT
99
+ metadata: {}
100
+ post_install_message:
101
+ rdoc_options: []
102
+ require_paths:
103
+ - lib
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: 1.9.3
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ requirements: []
115
+ rubyforge_project:
116
+ rubygems_version: 2.4.5
117
+ signing_key:
118
+ specification_version: 4
119
+ summary: Pronto runner for ESLint, pluggable linting utility for JavaScript and JSX
120
+ test_files: []