eslintrb 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,56 @@
1
+ # encoding: UTF-8
2
+ require "eslintrb"
3
+
4
+ def gen_file source, option, value
5
+ "/*eslint " + option.to_s + ": " + value.to_s + "*/\n" + source
6
+ end
7
+
8
+ describe "Eslintrb" do
9
+
10
+ it "support options" do
11
+ options = {
12
+ 'no-bitwise' => "var a = 1|1;",
13
+ 'curly' => "while (true)\n var a = 'a';",
14
+ 'no-unused-vars' => "if (a == 'a') { var b = 'b'; }"
15
+ }
16
+
17
+ options.each do |option, source|
18
+ expect(Eslintrb.lint(source, rules: { option => 0 } ).length).to eq 0
19
+ expect(Eslintrb.lint(source, rules: { option => 2 } ).length).to eq 1
20
+ end
21
+
22
+ options.each do |option, source|
23
+ expect(Eslintrb.lint(gen_file(source, option, 0)).length).to eq 0
24
+ expect(Eslintrb.lint(gen_file(source, option, 1)).length).to eq 1
25
+ end
26
+ end
27
+
28
+ it "supports globals" do
29
+ source = "foo();"
30
+ expect(Eslintrb.lint(source, :defaults, [:foo]).length).to eq 0
31
+ expect(Eslintrb.lint(source, :defaults).length).to eq 1
32
+ end
33
+
34
+ it "supports .eslintrc" do
35
+ basedir = File.join(File.dirname(__FILE__), "fixtures")
36
+ source = "var hoge;"
37
+ Dir.chdir basedir do
38
+ expect(Eslintrb.lint(source, :jshintrc).length).to eq 1
39
+ end
40
+ end
41
+
42
+ it "supports globals from .eslintrc" do
43
+ basedir = File.join(File.dirname(__FILE__), "fixtures")
44
+ source = "foo();"
45
+ Dir.chdir basedir do
46
+ expect(Eslintrb.lint(source, :jshintrc).length).to eq 0
47
+ end
48
+ end
49
+
50
+ describe "Eslintrb#report" do
51
+ it "accepts a single argument" do
52
+ expect{ Eslintrb.report('var working = false;') }.to_not raise_error
53
+ end
54
+ end
55
+
56
+ end
@@ -0,0 +1,8 @@
1
+ {
2
+ "rules": {
3
+ "no-unused-vars": 2
4
+ },
5
+ "globals": {
6
+ "foo": false
7
+ }
8
+ }
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eslintrb
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - stereobooster
8
+ - ocke
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-12-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: submodule
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 0.0.3
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 0.0.3
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: multi_json
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '1.3'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '1.3'
70
+ - !ruby/object:Gem::Dependency
71
+ name: execjs
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ description: Ruby wrapper for JSHint. The main difference from jshint gem it does
85
+ not depend on Java. Instead, it uses ExecJS
86
+ email:
87
+ - stereobooster@gmail.com
88
+ - ocke@exploder.nl
89
+ executables: []
90
+ extensions: []
91
+ extra_rdoc_files: []
92
+ files:
93
+ - ".gitignore"
94
+ - ".gitmodules"
95
+ - ".travis.yml"
96
+ - Gemfile
97
+ - LICENSE
98
+ - README.md
99
+ - Rakefile
100
+ - eslintrb.gemspec
101
+ - lib/eslintrb.rb
102
+ - lib/eslintrb/eslinttask.rb
103
+ - lib/eslintrb/lint.rb
104
+ - lib/eslintrb/reporter/default.rb
105
+ - lib/eslintrb/version.rb
106
+ - lib/js/eslint.js
107
+ - spec/eslintrb_spec.rb
108
+ - spec/fixtures/.eslintrc
109
+ homepage: https://github.com/ocke/eslintrb
110
+ licenses:
111
+ - MIT
112
+ metadata: {}
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubyforge_project:
129
+ rubygems_version: 2.4.5.1
130
+ signing_key:
131
+ specification_version: 4
132
+ summary: Ruby wrapper for JSHint
133
+ test_files:
134
+ - spec/eslintrb_spec.rb
135
+ - spec/fixtures/.eslintrc