jslintrb 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +5 -0
- data/README.rdoc +4 -0
- data/lib/jslintrb.rb +1 -1
- data/lib/jslintrb/fulljslint.js +3 -1
- data/lib/jslintrb/jslintrb.wk +14 -15
- metadata +3 -3
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -25,6 +25,10 @@ The file is JSON-formatted. See the jslint documentation
|
|
25
25
|
(http://www.jslint.com/lint.html#options) for allowed options and an
|
26
26
|
example at http://github.com/smparkes/env-js/blob/envjsrb/.jslintrbrc.
|
27
27
|
|
28
|
+
== Differences from upstream
|
29
|
+
|
30
|
+
JSLint warns against using new to be evaluated soley for side-effects. jslintrb allows this if you set the "newside" option.
|
31
|
+
|
28
32
|
== Copyright
|
29
33
|
|
30
34
|
jslintrb copyright (c) 2010 Steven Parkes. See LICENSE for details.
|
data/lib/jslintrb.rb
CHANGED
data/lib/jslintrb/fulljslint.js
CHANGED
@@ -306,6 +306,8 @@ var JSLINT = (function () {
|
|
306
306
|
// These are the JSLint boolean options.
|
307
307
|
|
308
308
|
boolOptions = {
|
309
|
+
newside : false,
|
310
|
+
|
309
311
|
adsafe : true, // if ADsafe should be enforced
|
310
312
|
bitwise : true, // if bitwise operators should not be allowed
|
311
313
|
browser : true, // if the standard browser globals should be predefined
|
@@ -2523,7 +2525,7 @@ loop: for (;;) {
|
|
2523
2525
|
warning(
|
2524
2526
|
"Expected an assignment or function call and instead saw an expression.",
|
2525
2527
|
token);
|
2526
|
-
} else if (r.id === '(' && r.left.id === 'new') {
|
2528
|
+
} else if (!option.newside && (r.id === '(' && r.left.id === 'new')) {
|
2527
2529
|
warning("Do not use 'new' for side effects.");
|
2528
2530
|
}
|
2529
2531
|
if (nexttoken.id !== ';') {
|
data/lib/jslintrb/jslintrb.wk
CHANGED
@@ -8,16 +8,12 @@ class JSLintRb::Plugin < Wake::Plugin
|
|
8
8
|
|
9
9
|
default :regexp => /\.js$/
|
10
10
|
|
11
|
-
def out_of_date? node, flag
|
12
|
-
return true if super
|
13
|
-
return flag
|
14
|
-
end
|
15
|
-
|
16
11
|
def watcher
|
17
12
|
default = super
|
18
13
|
lambda do |path, graph|
|
19
14
|
if node = default.call( path, graph )
|
20
|
-
create graph, Node::Virtual.new( node, cls.default[:options][:virtual] ),
|
15
|
+
create graph, Node::Virtual.new( graph, node, cls.default[:options][:virtual] ),
|
16
|
+
:from => node, :plugin => self
|
21
17
|
end
|
22
18
|
end
|
23
19
|
end
|
@@ -25,27 +21,30 @@ class JSLintRb::Plugin < Wake::Plugin
|
|
25
21
|
def fire_all
|
26
22
|
lambda do |nodes|
|
27
23
|
succeeded = nodes.inject({}) { |hash, node| hash[node] = true; hash }
|
28
|
-
cmd = "jslintrb #{nodes.map { |node| node.
|
24
|
+
cmd = "jslintrb #{nodes.map { |node| node.primary.path }.uniq.join(' ')}"
|
29
25
|
puts cmd
|
30
|
-
|
26
|
+
now = Time.now();
|
27
|
+
open("|"+cmd) do |f|
|
31
28
|
f.each do |line|
|
32
29
|
$stderr.puts line
|
33
30
|
m = /^([^ ]+) line \d+ character \d+:/.match(line)
|
34
31
|
path = m[1] if m
|
35
32
|
if path
|
36
|
-
array = nodes.select { |node| node.
|
33
|
+
array = nodes.select { |node| node.primary.path == path }
|
37
34
|
succeeded[array[0]] = false
|
38
35
|
end
|
39
36
|
end
|
40
37
|
end
|
38
|
+
puts "\nFinished in #{Time.now()-now} seconds"
|
39
|
+
# require 'pp'
|
40
|
+
# pp (succeeded.map { |k,v| [ k.path, v ] })
|
41
|
+
success = true
|
41
42
|
succeeded.each do |node, v|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
f.write({:succeded => v}.to_json)
|
46
|
-
end
|
43
|
+
node.succeeded = v
|
44
|
+
success &&= v
|
45
|
+
node.save!
|
47
46
|
end
|
48
|
-
|
47
|
+
success
|
49
48
|
end
|
50
49
|
end
|
51
50
|
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 5
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.5.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Steven Parkes
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-17 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|