jslintrb 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -17,10 +17,14 @@ top-level project directory that sets options for my project, then one
17
17
  in my spec directory (like a test directory) which adds the globals
18
18
  that exist for the tests but not for the core application code.
19
19
 
20
- The file is JSON-formatted. See the
20
+ The file is JSON-formatted. See the
21
21
  jslint documentation (http://www.jslint.com/lint.html) for allowed
22
22
  options.
23
23
 
24
+ jslintrb adds support for JavaScript with statements. They are parsed
25
+ but produce a warning. The "withstmt" option will suppress that
26
+ warning. Note that this does not endorse the use of with statements.
27
+
24
28
  == Copyright
25
29
 
26
30
  jslintrb copyright (c) 2010 Steven Parkes. See LICENSE for details.
data/bin/jslintrb CHANGED
@@ -10,7 +10,8 @@ ENV["JSLINTRB_JS_PATH"] =
10
10
 
11
11
  args = [ "env",
12
12
  "JSLINT_FILES=#{ARGV.join(':')}",
13
- "johnson",
13
+ "JOHNSON_RUNTIME=tracemonkey",
14
+ "johnson",
14
15
  File.join(JSLINT_DIR,"fulljslint.js"),
15
16
  File.join(JSLINT_DIR,"json2.js"),
16
17
  File.join(JSLINT_DIR,"jslintrb.js") ]
@@ -330,7 +330,8 @@ var JSLINT = (function () {
330
330
  strict : true, // require the "use strict"; pragma
331
331
  sub : true, // if all forms of subscript notation are tolerated
332
332
  white : true, // if strict whitespace rules apply
333
- widget : true // if the Yahoo Widgets globals should be predefined
333
+ widget : true, // if the Yahoo Widgets globals should be predefined
334
+ withstmt : true // if with statements should be allowd
334
335
  },
335
336
 
336
337
  // browser contains a set of global names which are commonly provided by a
@@ -4583,6 +4584,28 @@ loop: for (;;) {
4583
4584
  return p;
4584
4585
  }
4585
4586
  }
4587
+ };
4588
+
4589
+ function withparams() {
4590
+ var i, t = nexttoken, p = [];
4591
+ advance('(');
4592
+ nospace();
4593
+ if (nexttoken.id === ')') {
4594
+ advance(')');
4595
+ nospace(prevtoken, token);
4596
+ return;
4597
+ }
4598
+ for (;;) {
4599
+ i = parse(20);
4600
+ p.push(i);
4601
+ if (nexttoken.id === ',') {
4602
+ comma();
4603
+ } else {
4604
+ advance(')', t);
4605
+ nospace(prevtoken, token);
4606
+ return p;
4607
+ }
4608
+ }
4586
4609
  }
4587
4610
 
4588
4611
  function doFunction(i) {
@@ -4667,6 +4690,15 @@ loop: for (;;) {
4667
4690
  return this;
4668
4691
  });
4669
4692
 
4693
+ blockstmt('with', function () {
4694
+ if (!option.withstmt) {
4695
+ warning("Don't use with statements");
4696
+ }
4697
+ withparams();
4698
+ block(true);
4699
+ return this;
4700
+ });
4701
+
4670
4702
  blockstmt('try', function () {
4671
4703
  var b, e, s;
4672
4704
  if (option.adsafe) {
@@ -5149,6 +5181,7 @@ loop: for (;;) {
5149
5181
  o.sub = false;
5150
5182
  o.undef = true;
5151
5183
  o.widget = false;
5184
+ o.withstmt= false;
5152
5185
  predefined.Date = null;
5153
5186
  predefined['eval'] = null;
5154
5187
  predefined.Function = null;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jslintrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Parkes
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: "0"
23
+ version: 1.1.2.6
24
24
  version:
25
25
  description: jslintrb is a packaged version of Douglas Crockford's JSLint JavaScript code checker. jslintrb uses SpiderMonkey via the Johnson Ruby gem to interpret the JSLint javascript.
26
26
  email: smparkes@smparkes.net