jshintrb 0.1.4 → 0.1.6
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.
- data/.gitignore +5 -5
- data/.gitmodules +0 -0
- data/.travis.yml +19 -19
- data/Gemfile +0 -0
- data/README.md +73 -73
- data/Rakefile +16 -10
- data/jshintrb.gemspec +26 -27
- data/lib/js/jshint.js +4523 -4397
- data/lib/jshintrb/jshinttask.rb +84 -84
- data/lib/jshintrb/lint.rb +64 -64
- data/lib/jshintrb/reporter/default.rb +29 -29
- data/lib/jshintrb/version.rb +2 -1
- data/lib/jshintrb.rb +0 -0
- data/spec/jshintrb_spec.rb +28 -28
- metadata +91 -56
data/.gitignore
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
*.gem
|
2
|
-
.bundle
|
3
|
-
Gemfile.lock
|
4
|
-
pkg/*
|
5
|
-
/.project
|
1
|
+
*.gem
|
2
|
+
.bundle
|
3
|
+
Gemfile.lock
|
4
|
+
pkg/*
|
5
|
+
/.project
|
data/.gitmodules
CHANGED
File without changes
|
data/.travis.yml
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
rvm:
|
2
|
-
- 1.8.7
|
3
|
-
- 1.9.2
|
4
|
-
- 1.9.3
|
5
|
-
- jruby
|
6
|
-
before_script: "git submodule update --init --recursive"
|
7
|
-
env:
|
8
|
-
- EXECJS_RUNTIME=RubyRacer
|
9
|
-
- EXECJS_RUNTIME=RubyRhino
|
10
|
-
matrix:
|
11
|
-
exclude:
|
12
|
-
- rvm: 1.8.7
|
13
|
-
env: EXECJS_RUNTIME=RubyRhino
|
14
|
-
- rvm: 1.9.2
|
15
|
-
env: EXECJS_RUNTIME=RubyRhino
|
16
|
-
- rvm: 1.9.3
|
17
|
-
env: EXECJS_RUNTIME=RubyRhino
|
18
|
-
- rvm: jruby
|
19
|
-
env: EXECJS_RUNTIME=RubyRacer
|
1
|
+
rvm:
|
2
|
+
- 1.8.7
|
3
|
+
- 1.9.2
|
4
|
+
- 1.9.3
|
5
|
+
- jruby
|
6
|
+
before_script: "git submodule update --init --recursive"
|
7
|
+
env:
|
8
|
+
- EXECJS_RUNTIME=RubyRacer
|
9
|
+
- EXECJS_RUNTIME=RubyRhino
|
10
|
+
matrix:
|
11
|
+
exclude:
|
12
|
+
- rvm: 1.8.7
|
13
|
+
env: EXECJS_RUNTIME=RubyRhino
|
14
|
+
- rvm: 1.9.2
|
15
|
+
env: EXECJS_RUNTIME=RubyRhino
|
16
|
+
- rvm: 1.9.3
|
17
|
+
env: EXECJS_RUNTIME=RubyRhino
|
18
|
+
- rvm: jruby
|
19
|
+
env: EXECJS_RUNTIME=RubyRacer
|
data/Gemfile
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -1,73 +1,73 @@
|
|
1
|
-
# jshintrb
|
2
|
-
[](http://travis-ci.org/stereobooster/jshintrb)
|
3
|
-
|
4
|
-
Ruby wrapper for [JSHint](https://github.com/jshint/jshint/). The main difference from [jshint](https://github.com/liquid/jshint_on_rails) it does not depend on Java. Instead it uses [ExecJS](https://github.com/sstephenson/execjs).
|
5
|
-
|
6
|
-
## Installation
|
7
|
-
|
8
|
-
jshintrb is available as ruby gem.
|
9
|
-
|
10
|
-
$ gem install jshintrb
|
11
|
-
|
12
|
-
Ensure that your environment has a JavaScript interpreter supported by [ExecJS](https://github.com/sstephenson/execjs). Usually, installing therubyracer gem is the best alternative.
|
13
|
-
|
14
|
-
## Usage
|
15
|
-
|
16
|
-
```ruby
|
17
|
-
require 'jshintrb'
|
18
|
-
|
19
|
-
Jshintrb.lint(File.read("source.js"))
|
20
|
-
# => array of warnings
|
21
|
-
|
22
|
-
Jshintrb.report(File.read("source.js"))
|
23
|
-
# => string
|
24
|
-
```
|
25
|
-
|
26
|
-
Or you can use it with rake
|
27
|
-
|
28
|
-
```ruby
|
29
|
-
require "jshintrb/jshinttask"
|
30
|
-
Jshintrb::JshintTask.new :jshint do |t|
|
31
|
-
t.pattern = 'javascript/**/*.js'
|
32
|
-
t.options = :defaults
|
33
|
-
end
|
34
|
-
```
|
35
|
-
|
36
|
-
When initializing `Jshintrb`, you can pass options
|
37
|
-
|
38
|
-
```ruby
|
39
|
-
Jshintrb.new(:undef => true).compile(source)
|
40
|
-
# Or
|
41
|
-
Jshintrb.compile(source, :undef => true)
|
42
|
-
```
|
43
|
-
|
44
|
-
[List of all available options](http://www.jshint.com/options/)
|
45
|
-
|
46
|
-
If you pass `:defaults` as option, it is the same as if you pass following
|
47
|
-
|
48
|
-
```
|
49
|
-
{
|
50
|
-
:bitwise => true,
|
51
|
-
:curly => true,
|
52
|
-
:eqeqeq => true,
|
53
|
-
:forin => true,
|
54
|
-
:immed => true,
|
55
|
-
:latedef => true,
|
56
|
-
:newcap => true,
|
57
|
-
:noarg => true,
|
58
|
-
:noempty => true,
|
59
|
-
:nonew => true,
|
60
|
-
:plusplus => true,
|
61
|
-
:regexp => true,
|
62
|
-
:undef => true,
|
63
|
-
:strict => true,
|
64
|
-
:trailing => true,
|
65
|
-
:browser => true
|
66
|
-
}
|
67
|
-
```
|
68
|
-
|
69
|
-
## TODO
|
70
|
-
|
71
|
-
- add more tests
|
72
|
-
- add color reporter. Maybe [colorize](https://github.com/fazibear/colorize)
|
73
|
-
- add cli. Support same options as [jshint/node-jshint](https://github.com/jshint/node-jshint/blob/master/lib/cli.js)
|
1
|
+
# jshintrb
|
2
|
+
[](http://travis-ci.org/stereobooster/jshintrb)
|
3
|
+
|
4
|
+
Ruby wrapper for [JSHint](https://github.com/jshint/jshint/). The main difference from [jshint](https://github.com/liquid/jshint_on_rails) it does not depend on Java. Instead it uses [ExecJS](https://github.com/sstephenson/execjs).
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
jshintrb is available as ruby gem.
|
9
|
+
|
10
|
+
$ gem install jshintrb
|
11
|
+
|
12
|
+
Ensure that your environment has a JavaScript interpreter supported by [ExecJS](https://github.com/sstephenson/execjs). Usually, installing therubyracer gem is the best alternative.
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
require 'jshintrb'
|
18
|
+
|
19
|
+
Jshintrb.lint(File.read("source.js"))
|
20
|
+
# => array of warnings
|
21
|
+
|
22
|
+
Jshintrb.report(File.read("source.js"))
|
23
|
+
# => string
|
24
|
+
```
|
25
|
+
|
26
|
+
Or you can use it with rake
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require "jshintrb/jshinttask"
|
30
|
+
Jshintrb::JshintTask.new :jshint do |t|
|
31
|
+
t.pattern = 'javascript/**/*.js'
|
32
|
+
t.options = :defaults
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
When initializing `Jshintrb`, you can pass options
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
Jshintrb.new(:undef => true).compile(source)
|
40
|
+
# Or
|
41
|
+
Jshintrb.compile(source, :undef => true)
|
42
|
+
```
|
43
|
+
|
44
|
+
[List of all available options](http://www.jshint.com/options/)
|
45
|
+
|
46
|
+
If you pass `:defaults` as option, it is the same as if you pass following
|
47
|
+
|
48
|
+
```
|
49
|
+
{
|
50
|
+
:bitwise => true,
|
51
|
+
:curly => true,
|
52
|
+
:eqeqeq => true,
|
53
|
+
:forin => true,
|
54
|
+
:immed => true,
|
55
|
+
:latedef => true,
|
56
|
+
:newcap => true,
|
57
|
+
:noarg => true,
|
58
|
+
:noempty => true,
|
59
|
+
:nonew => true,
|
60
|
+
:plusplus => true,
|
61
|
+
:regexp => true,
|
62
|
+
:undef => true,
|
63
|
+
:strict => true,
|
64
|
+
:trailing => true,
|
65
|
+
:browser => true
|
66
|
+
}
|
67
|
+
```
|
68
|
+
|
69
|
+
## TODO
|
70
|
+
|
71
|
+
- add more tests
|
72
|
+
- add color reporter. Maybe [colorize](https://github.com/fazibear/colorize)
|
73
|
+
- add cli. Support same options as [jshint/node-jshint](https://github.com/jshint/node-jshint/blob/master/lib/cli.js)
|
data/Rakefile
CHANGED
@@ -4,11 +4,23 @@ require "bundler/gem_tasks"
|
|
4
4
|
Rake::Task[task_name].prerequisites << :spec
|
5
5
|
end
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
require 'submodule'
|
8
|
+
class JshintSubmodule < Submodule::Task
|
9
|
+
def test
|
10
|
+
# sudo apt-get update
|
11
|
+
# sudo apt-get install npm
|
12
|
+
# sudo npm -g install expresso
|
13
|
+
expresso = "/usr/bin/expresso"
|
14
|
+
sh "#{expresso} tests/unit/*.js"
|
15
|
+
sh "#{expresso} tests/regression/*.js"
|
16
|
+
end
|
17
|
+
|
18
|
+
def after_pull
|
19
|
+
cp "vendor/jshint/jshint.js", "lib/js/jshint.js"
|
20
|
+
sh "git add lib/js/jshint.js"
|
21
|
+
end
|
11
22
|
end
|
23
|
+
JshintSubmodule.new
|
12
24
|
|
13
25
|
require "rspec/core/rake_task"
|
14
26
|
RSpec::Core::RakeTask.new
|
@@ -20,9 +32,3 @@ task :default => :spec
|
|
20
32
|
# t.rcov = true
|
21
33
|
# t.rcov_opts = ["--exclude", "spec"]
|
22
34
|
# end
|
23
|
-
|
24
|
-
require "./lib/jshintrb/jshinttask"
|
25
|
-
Jshintrb::JshintTask.new :jshint do |t|
|
26
|
-
t.pattern = 'vendor/jshint/tests/unit/fixtures/*.js'
|
27
|
-
t.options = :defaults
|
28
|
-
end
|
data/jshintrb.gemspec
CHANGED
@@ -1,27 +1,26 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "jshintrb/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "jshintrb"
|
7
|
-
s.version = Jshintrb::VERSION
|
8
|
-
s.authors = ["stereobooster"]
|
9
|
-
s.email = ["stereobooster@gmail.com"]
|
10
|
-
s.homepage = "https://github.com/stereobooster/jshintrb"
|
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}
|
13
|
-
|
14
|
-
s.
|
15
|
-
|
16
|
-
s.
|
17
|
-
s.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
s.
|
23
|
-
|
24
|
-
|
25
|
-
s.add_dependency "
|
26
|
-
|
27
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "jshintrb/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "jshintrb"
|
7
|
+
s.version = Jshintrb::VERSION
|
8
|
+
s.authors = ["stereobooster"]
|
9
|
+
s.email = ["stereobooster@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/stereobooster/jshintrb"
|
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}
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
# specify any dependencies here; for example:
|
20
|
+
s.add_development_dependency "rspec"
|
21
|
+
s.add_development_dependency "submodule"
|
22
|
+
s.add_runtime_dependency "rake"
|
23
|
+
|
24
|
+
s.add_dependency "multi_json", ">= 1.3"
|
25
|
+
s.add_dependency "execjs"
|
26
|
+
end
|