eslintrb 2.0.0 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fad2cfbd4d08f35e745eaf7eebbad1231d97a689
4
- data.tar.gz: 587a569c8f4e2efa7b92e0f344e505e21a004245
3
+ metadata.gz: a5809b14dc2b24fb0b80431519d9b10c3982aa50
4
+ data.tar.gz: 2855acfb8114de558d639f60a7d5210027d7a86a
5
5
  SHA512:
6
- metadata.gz: 82edb0a6d9b3f77d9a6e591af3a2bdc7633e12dd2b29930ea54d0415833f3dbedb7b842f56eba2f2b1a5d2cf9e18867d4e651cd3d234483afd8d63d94162ce66
7
- data.tar.gz: eb0ab434ae303d2083efbbd5f14206cb58e58f852e2763d542212f4ae5662ee0f63cae52c2a5e4c288ea14873ef10e471312e631faedfa23bbd905028beedfa1
6
+ metadata.gz: dbe83ba1523ded6f7dc44e0ae1b4f28338e0a2894ae82367cb11f04a2294f09816641433c9bdf8d46f1170fbdce3a94910c2bb316e7ab5714b1c9720e4aeef81
7
+ data.tar.gz: 816ecff047f90034d9ad85bdd7c2a0446e369e583367ad18cbd8b1665381d549915a5a0b678f97e7a23278386f19272c94a3dd8c1cbcf0ee00847fa875603e9d
data/.travis.yml CHANGED
@@ -1,6 +1,4 @@
1
1
  rvm:
2
- - 1.8.7
3
- - 1.9.2
4
2
  - 1.9.3
5
3
  - 2.0.0
6
4
  - 2.1
data/Gemfile CHANGED
@@ -13,4 +13,3 @@ execjs_runtimes = {
13
13
  if ENV["EXECJS_RUNTIME"] && execjs_runtimes[ENV["EXECJS_RUNTIME"]]
14
14
  gem execjs_runtimes[ENV["EXECJS_RUNTIME"]], :group => :development
15
15
  end
16
-
data/README.md CHANGED
@@ -18,10 +18,10 @@ Ensure that your environment has a JavaScript interpreter supported by [ExecJS](
18
18
  ```ruby
19
19
  require 'eslintrb'
20
20
 
21
- eslintrb.lint(File.read("source.js"))
21
+ Eslintrb.lint(File.read("source.js"), :defaults)
22
22
  # => array of warnings
23
23
 
24
- eslintrb.report(File.read("source.js"))
24
+ Eslintrb.report(File.read("source.js"), :defaults)
25
25
  # => string
26
26
  ```
27
27
 
@@ -29,7 +29,7 @@ Or you can use it with rake
29
29
 
30
30
  ```ruby
31
31
  require "eslintrb/eslinttask"
32
- eslintrb::eslintTask.new :eslint do |t|
32
+ Eslintrb::EslintTask.new :eslint do |t|
33
33
  t.pattern = 'javascript/**/*.js'
34
34
  t.options = :defaults
35
35
  end
@@ -38,33 +38,32 @@ end
38
38
  When initializing `eslintrb`, you can pass options
39
39
 
40
40
  ```ruby
41
- eslintrb::Lint.new(:undef => true).lint(source)
41
+ Eslintrb::Lint.new('no-undef' => true).lint(source)
42
42
  # Or
43
- eslintrb.lint(source, :undef => true)
43
+ Eslintrb.lint(source, 'no-undef' => true)
44
44
  ```
45
45
 
46
- [List of all available options](http://www.eslint.com/docs/options/)
46
+ [List of all available options](http://eslint.org/docs/rules/)
47
47
 
48
48
  If you pass `:defaults` as option, it is the same as if you pass following
49
49
 
50
50
  ```
51
51
  {
52
- :bitwise => true,
53
- :curly => true,
54
- :eqeqeq => true,
55
- :forin => true,
56
- :immed => true,
57
- :latedef => true,
58
- :newcap => true,
59
- :noarg => true,
60
- :noempty => true,
61
- :nonew => true,
62
- :plusplus => true,
63
- :regexp => true,
64
- :undef => true,
65
- :strict => true,
66
- :trailing => true,
67
- :browser => true
52
+ rules: {
53
+ 'no-bitwise' => 2,
54
+ 'curly' => 2,
55
+ 'eqeqeq' => 2,
56
+ 'guard-for-in' => 2,
57
+ 'no-use-before-define' => 2,
58
+ 'no-caller' => 2,
59
+ 'no-new-func' => 2,
60
+ 'no-plusplus' => 2,
61
+ 'no-undef' => 2,
62
+ 'strict' => 2
63
+ },
64
+ env: {
65
+ 'browser' => true
66
+ }
68
67
  }
69
68
  ```
70
69
 
data/eslintrb.gemspec CHANGED
@@ -5,11 +5,11 @@ require "eslintrb/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "eslintrb"
7
7
  s.version = Eslintrb::VERSION
8
- s.authors = ["stereobooster", "ocke"]
9
- s.email = ["stereobooster@gmail.com", "ocke@exploder.nl"]
8
+ s.authors = ["ocke", "stereobooster"]
9
+ s.email = ["ocke@exploder.nl", "stereobooster@gmail.com"]
10
10
  s.homepage = "https://github.com/ocke/eslintrb"
11
- s.summary = %q{Ruby wrapper for JSHint}
12
- s.description = %q{Ruby wrapper for JSHint. The main difference from jshint gem it does not depend on Java. Instead, it uses ExecJS}
11
+ s.summary = %q{Ruby wrapper for ESLint}
12
+ s.description = %q{Ruby wrapper for ESLint. The main difference from eslint gem it does not depend on Java. Instead, it uses ExecJS}
13
13
  s.license = "MIT"
14
14
 
15
15
  s.files = `git ls-files`.split("\n")
@@ -1,4 +1,4 @@
1
- # Define a task library for running JSHint contexts.
1
+ # Define a task library for running ESLint contexts.
2
2
 
3
3
  require 'rake'
4
4
  require 'rake/tasklib'
@@ -8,7 +8,7 @@ require 'eslintrb'
8
8
  module Eslintrb
9
9
 
10
10
  class EslintTask < ::Rake::TaskLib
11
- # Name of JSHint task. (default is :jshint)
11
+ # Name of ESLint task. (default is :eslint)
12
12
  attr_accessor :name
13
13
 
14
14
  # Glob pattern to match JavaScript files. (default is './**/*.js')
@@ -19,7 +19,7 @@ module Eslintrb
19
19
 
20
20
  attr_accessor :globals
21
21
 
22
- # Whether or not to fail Rake when an error occurs (typically when Jshint check fail).
22
+ # Whether or not to fail Rake when an error occurs (typically when ESLint check fail).
23
23
  # Defaults to true.
24
24
  attr_accessor :fail_on_error
25
25
 
@@ -34,7 +34,7 @@ module Eslintrb
34
34
  attr_accessor :exclude_js_files
35
35
 
36
36
  # Defines a new task, using the name +name+.
37
- def initialize(name=:jshint)
37
+ def initialize(name=:eslint)
38
38
  @name = name
39
39
  @pattern = nil
40
40
  @js_files = nil
@@ -53,13 +53,13 @@ module Eslintrb
53
53
 
54
54
  actual_name = Hash === name ? name.keys.first : name
55
55
  unless ::Rake.application.last_comment
56
- desc "Run JShint"
56
+ desc "Run ESLint"
57
57
  end
58
58
  task name do
59
59
  unless js_file_list.empty?
60
60
  result = Eslintrb::report(js_file_list, @options, @globals, STDERR)
61
61
  if result.size > 0
62
- abort("JSHint check failed") if fail_on_error
62
+ abort("ESLint check failed") if fail_on_error
63
63
  end
64
64
  end
65
65
  end
data/lib/eslintrb/lint.rb CHANGED
@@ -12,10 +12,18 @@ module Eslintrb
12
12
  DEFAULTS = {
13
13
  rules: {
14
14
  'no-bitwise' => 2,
15
+ 'curly' => 2,
16
+ 'eqeqeq' => 2,
17
+ 'guard-for-in' => 2,
18
+ 'no-use-before-define' => 2,
19
+ 'no-caller' => 2,
20
+ 'no-new-func' => 2,
21
+ 'no-plusplus' => 2,
15
22
  'no-undef' => 2,
16
- :curly => 2,
17
- :eqeqeq => 2,
18
- :strict => 2
23
+ 'strict' => 2
24
+ },
25
+ env: {
26
+ 'browser' => true
19
27
  }
20
28
  }
21
29
 
@@ -25,7 +33,7 @@ module Eslintrb
25
33
 
26
34
  if options == :defaults then
27
35
  @options = DEFAULTS.dup
28
- elsif options == :jshintrc then
36
+ elsif options == :eslintrc then
29
37
  raise '`.eslintrc` is not exist on current working directory.' unless File.exist?('./.eslintrc')
30
38
  @options = MultiJson.load(File.read('./.eslintrc'))
31
39
  elsif options.instance_of? Hash then
@@ -14,7 +14,7 @@ module Eslintrb
14
14
  result += indent + 'fatal error'
15
15
  else
16
16
  result += indent + 'line ' + error["line"].to_s + ', col ' +
17
- error["character"].to_s + ', ' + error["reason"].to_s + "\n"
17
+ error["column"].to_s + ', ' + error["message"].to_s + "\n"
18
18
  end
19
19
  end
20
20
 
@@ -1,4 +1,4 @@
1
1
  module Eslintrb
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  SUBMODULE = "3b9fe1f6aeb95a8b70535de4b9c143869fe53ce1"
4
4
  end
@@ -35,7 +35,7 @@ describe "Eslintrb" do
35
35
  basedir = File.join(File.dirname(__FILE__), "fixtures")
36
36
  source = "var hoge;"
37
37
  Dir.chdir basedir do
38
- expect(Eslintrb.lint(source, :jshintrc).length).to eq 1
38
+ expect(Eslintrb.lint(source, :eslintrc).length).to eq 1
39
39
  end
40
40
  end
41
41
 
@@ -43,7 +43,7 @@ describe "Eslintrb" do
43
43
  basedir = File.join(File.dirname(__FILE__), "fixtures")
44
44
  source = "foo();"
45
45
  Dir.chdir basedir do
46
- expect(Eslintrb.lint(source, :jshintrc).length).to eq 0
46
+ expect(Eslintrb.lint(source, :eslintrc).length).to eq 0
47
47
  end
48
48
  end
49
49
 
@@ -3,6 +3,6 @@
3
3
  "no-unused-vars": 2
4
4
  },
5
5
  "globals": {
6
- "foo": false
6
+ "foo": true
7
7
  }
8
8
  }
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eslintrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - stereobooster
8
7
  - ocke
8
+ - stereobooster
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-23 00:00:00.000000000 Z
12
+ date: 2015-12-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -81,11 +81,11 @@ dependencies:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
- description: Ruby wrapper for JSHint. The main difference from jshint gem it does
84
+ description: Ruby wrapper for ESLint. The main difference from eslint gem it does
85
85
  not depend on Java. Instead, it uses ExecJS
86
86
  email:
87
- - stereobooster@gmail.com
88
87
  - ocke@exploder.nl
88
+ - stereobooster@gmail.com
89
89
  executables: []
90
90
  extensions: []
91
91
  extra_rdoc_files: []
@@ -129,7 +129,7 @@ rubyforge_project:
129
129
  rubygems_version: 2.4.5.1
130
130
  signing_key:
131
131
  specification_version: 4
132
- summary: Ruby wrapper for JSHint
132
+ summary: Ruby wrapper for ESLint
133
133
  test_files:
134
134
  - spec/eslintrb_spec.rb
135
135
  - spec/fixtures/.eslintrc