jshintrb 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/Rakefile +3 -5
- data/lib/js/jshint.js +11546 -10314
- data/lib/jshintrb.rb +1 -1
- data/lib/jshintrb/lint.rb +3 -0
- data/lib/jshintrb/reporter/default.rb +2 -2
- data/lib/jshintrb/version.rb +2 -2
- data/spec/fixtures/.jshintrc +4 -0
- data/spec/jshintrb_spec.rb +23 -1
- metadata +22 -19
data/lib/jshintrb.rb
CHANGED
@@ -18,7 +18,7 @@ module Jshintrb
|
|
18
18
|
source.each do |src|
|
19
19
|
if !src.is_a?(String) then
|
20
20
|
p src.to_s
|
21
|
-
raise
|
21
|
+
raise ArgumentError, 'Expected array of strings. Instead get ' + src.class.to_s
|
22
22
|
end
|
23
23
|
errors = linter.lint(File.read(src))
|
24
24
|
rep = reporter.format errors, src
|
data/lib/jshintrb/lint.rb
CHANGED
@@ -34,6 +34,9 @@ module Jshintrb
|
|
34
34
|
|
35
35
|
if options == :defaults then
|
36
36
|
@options = DEFAULTS.dup
|
37
|
+
elsif options == :jshintrc then
|
38
|
+
raise '`.jshintrc` is not exist on current working directory.' unless File.exist?('./.jshintrc')
|
39
|
+
@options = MultiJson.load(File.read('./.jshintrc'))
|
37
40
|
elsif options.instance_of? Hash then
|
38
41
|
@options = options.dup
|
39
42
|
# @options = DEFAULTS.merge(options)
|
data/lib/jshintrb/version.rb
CHANGED
data/spec/jshintrb_spec.rb
CHANGED
@@ -6,7 +6,7 @@ def gen_file source, option, value
|
|
6
6
|
end
|
7
7
|
|
8
8
|
describe "Jshintrb" do
|
9
|
-
|
9
|
+
|
10
10
|
it "support options" do
|
11
11
|
options = {
|
12
12
|
:bitwise => "var a = 1|1;",
|
@@ -44,4 +44,26 @@ describe "Jshintrb" do
|
|
44
44
|
Jshintrb.lint(source, :defaults).length.should eq 1
|
45
45
|
end
|
46
46
|
|
47
|
+
it "supports .jshintrc" do
|
48
|
+
basedir = File.join(File.dirname(__FILE__), "fixtures")
|
49
|
+
source = "var hoge;"
|
50
|
+
Dir.chdir basedir do
|
51
|
+
Jshintrb.lint(source, :jshintrc).length.should eq 1
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
it "supports globals from .jshintrc" do
|
56
|
+
basedir = File.join(File.dirname(__FILE__), "fixtures")
|
57
|
+
source = "foo();"
|
58
|
+
Dir.chdir basedir do
|
59
|
+
Jshintrb.lint(source, :jshintrc).length.should eq 0
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "Jshintrb#report" do
|
64
|
+
it "accepts a single argument" do
|
65
|
+
expect{ Jshintrb.report('var working = false;') }.to_not raise_error
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
47
69
|
end
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jshintrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- stereobooster
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: submodule
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.0.3
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.0.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: multi_json
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.3'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: execjs
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: Ruby wrapper for JSHint. The main difference from jshint gem it does
|
@@ -88,9 +88,9 @@ executables: []
|
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
-
- .gitignore
|
92
|
-
- .gitmodules
|
93
|
-
- .travis.yml
|
91
|
+
- ".gitignore"
|
92
|
+
- ".gitmodules"
|
93
|
+
- ".travis.yml"
|
94
94
|
- Gemfile
|
95
95
|
- LICENSE
|
96
96
|
- README.md
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- lib/jshintrb/lint.rb
|
103
103
|
- lib/jshintrb/reporter/default.rb
|
104
104
|
- lib/jshintrb/version.rb
|
105
|
+
- spec/fixtures/.jshintrc
|
105
106
|
- spec/jshintrb_spec.rb
|
106
107
|
homepage: https://github.com/stereobooster/jshintrb
|
107
108
|
licenses:
|
@@ -113,18 +114,20 @@ require_paths:
|
|
113
114
|
- lib
|
114
115
|
required_ruby_version: !ruby/object:Gem::Requirement
|
115
116
|
requirements:
|
116
|
-
- -
|
117
|
+
- - ">="
|
117
118
|
- !ruby/object:Gem::Version
|
118
119
|
version: '0'
|
119
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
121
|
requirements:
|
121
|
-
- -
|
122
|
+
- - ">="
|
122
123
|
- !ruby/object:Gem::Version
|
123
124
|
version: '0'
|
124
125
|
requirements: []
|
125
126
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.2.2
|
127
128
|
signing_key:
|
128
129
|
specification_version: 4
|
129
130
|
summary: Ruby wrapper for JSHint
|
130
|
-
test_files:
|
131
|
+
test_files:
|
132
|
+
- spec/fixtures/.jshintrc
|
133
|
+
- spec/jshintrb_spec.rb
|