-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added jshint options to the command line interface using OptionParser
- Loading branch information
Showing
6 changed files
with
146 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require 'optparse' | ||
|
||
module JSLintV8 | ||
class OptionParser < ::OptionParser | ||
|
||
attr_reader :options | ||
|
||
def initialize | ||
super | ||
|
||
@options = {} | ||
@options[:lint_options] = {} | ||
|
||
self.version = JSLintV8::Version::STRING | ||
self.banner = "#{self.banner} <filepattern>..." | ||
|
||
Runner::DefaultOptions.keys.each do |option| | ||
default = Runner::DefaultOptions[option] ? "on" : "off" | ||
|
||
long = "--[no-]#{option}" | ||
desc = "#{Runner::OptionDescriptions[option]} (default=#{default})" | ||
|
||
on(long, desc) do |value| | ||
options[:lint_options][option] = value | ||
end | ||
end | ||
|
||
on("-h", "--help", "Show this message") do | ||
STDERR.puts self.help | ||
exit(-1) | ||
end | ||
|
||
on("-v", "--version", "Show version") do | ||
STDERR.puts "#{self.program_name} version #{JSLintV8::Version::STRING}" | ||
exit(-1) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Usage: jslint-v8 [options] <filepattern>... | ||
--[no-]asi if automatic semicolon insertion should be tolerated (default=off) | ||
--[no-]bitwise if bitwise operators should not be allowed (default=on) | ||
--[no-]boss if advanced usage of assignments should be allowed (default=off) | ||
--[no-]browser if the standard browser globals should be predefined (default=off) | ||
--[no-]couch if CouchDB globals should be predefined (default=off) | ||
--[no-]curly if curly braces around blocks should be required (even in if/for/while) (default=off) | ||
--[no-]debug if debugger statements should be allowed (default=off) | ||
--[no-]devel if logging globals should be predefined (console, alert, etc.) (default=off) | ||
--[no-]dojo if Dojo Toolkit globals should be predefined (default=off) | ||
--[no-]eqeqeq if === should be required (default=on) | ||
--[no-]eqnull if == null comparisons should be tolerated (default=off) | ||
--[no-]es5 if ES5 syntax should be allowed (default=off) | ||
--[no-]evil if eval should be allowed (default=off) | ||
--[no-]expr if ExpressionStatement should be allowed as Programs (default=off) | ||
--[no-]forin if for in statements must filter (default=off) | ||
--[no-]globalstrict if global "use strict"; should be allowed (also enables 'strict') (default=off) | ||
--[no-]immed if immediate invocations must be wrapped in parens (default=on) | ||
--[no-]jquery if jQuery globals should be predefined (default=off) | ||
--[no-]latedef if the use before definition should not be tolerated (default=off) | ||
--[no-]laxbreak if line breaks should not be checked (default=off) | ||
--[no-]loopfunc if functions should be allowed to be defined within loops (default=off) | ||
--[no-]mootools if MooTools globals should be predefined (default=off) | ||
--[no-]newcap if constructor names must be capitalized (default=on) | ||
--[no-]noarg if arguments.caller and arguments.callee should be disallowed (default=off) | ||
--[no-]node if the Node.js environment globals should be predefined (default=off) | ||
--[no-]noempty if empty blocks should be disallowed (default=off) | ||
--[no-]nonew if using `new` for side-effects should be disallowed (default=off) | ||
--[no-]nomen if names should be checked (default=on) | ||
--[no-]onevar if only one var statement per function should be allowed (default=on) | ||
--[no-]passfail if the scan should stop on first error (default=off) | ||
--[no-]plusplus if increment/decrement should not be allowed (default=on) | ||
--[no-]prototypejs if Prototype and Scriptaculous globals should be predefined (default=off) | ||
--[no-]regexdash if unescaped last dash (-) inside brackets should be tolerated (default=off) | ||
--[no-]regexp if the . should not be allowed in regexp literals (default=on) | ||
--[no-]rhino if the Rhino environment globals should be predefined (default=off) | ||
--[no-]undef if variables should be declared before used (default=on) | ||
--[no-]scripturl if script-targeted URLs should be tolerated (default=off) | ||
--[no-]shadow if variable shadowing should be tolerated (default=off) | ||
--[no-]strict require the "use strict"; pragma (default=off) | ||
--[no-]sub if all forms of subscript notation are tolerated (default=off) | ||
--[no-]supernew if `new function () { ... };` and `new Object;` should be tolerated (default=off) | ||
--[no-]trailing if trailing whitespace rules apply (default=off) | ||
--[no-]white if strict whitespace rules apply (default=off) | ||
--[no-]wsh if the Windows Scripting Host environment globals should be predefined (default=off) | ||
-h, --help Show this message | ||
-v, --version Show version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
jslint-v8 version <%= JSLintV8::Version::STRING %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters