Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add vim configs for javascriptlint

  • Loading branch information...
commit 270a7568a805ab58947b9c80fe44559815302fb2 1 parent 7cdd18c
Vincent Wang authored

Showing 2 changed files with 154 additions and 0 deletions. Show diff stats Hide diff stats

  1. +18 0 .vim/ftplugin/javascript/javascriptlint.vim
  2. +136 0 jsl.conf
18 .vim/ftplugin/javascript/javascriptlint.vim
... ... @@ -0,0 +1,18 @@
  1 +" javascriptlint.vim -- javascriptlint
  2 +" @Author: Vincent Wang (mailto:linsong.qizi@gmail.com)
  3 +" @Website: vincent-wang.blogspots.com
  4 +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
  5 +" @Created: 2007-04-28.
  6 +" @Last Change: 19-Mai-2005.
  7 +" @Revision: 0.0
  8 +
  9 +if &cp || exists("loaded_javascriptlint")
  10 + finish
  11 +endif
  12 +let loaded_javascriptlint = 1
  13 +
  14 +set makeprg=jsl\ -nologo\ -nofilelisting\ -nosummary\ -nocontext\ -conf\ '$HOME/jsl.conf'\ -process\ %
  15 +set errorformat=%f(%l):\ %m
  16 +
  17 +
  18 +
136 jsl.conf
... ... @@ -0,0 +1,136 @@
  1 +#
  2 +# Configuration File for JavaScript Lint 0.3.0
  3 +# Developed by Matthias Miller (http://www.JavaScriptLint.com)
  4 +#
  5 +# This configuration file can be used to lint a collection of scripts, or to enable
  6 +# or disable warnings for scripts that are linted via the command line.
  7 +#
  8 +
  9 +### Warnings
  10 +# Enable or disable warnings based on requirements.
  11 +# Use "+WarningName" to display or "-WarningName" to suppress.
  12 +#
  13 ++no_return_value # function {0} does not always return a value
  14 ++duplicate_formal # duplicate formal argument {0}
  15 ++equal_as_assign # test for equality (==) mistyped as assignment (=)?{0}
  16 ++var_hides_arg # variable {0} hides argument
  17 ++redeclared_var # redeclaration of {0} {1}
  18 ++anon_no_return_value # anonymous function does not always return a value
  19 ++missing_semicolon # missing semicolon
  20 ++meaningless_block # meaningless block; curly braces have no impact
  21 ++comma_separated_stmts # multiple statements separated by commas (use semicolons?)
  22 ++unreachable_code # unreachable code
  23 ++missing_break # missing break statement
  24 ++missing_break_for_last_case # missing break statement for last case in switch
  25 ++comparison_type_conv # comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)
  26 ++inc_dec_within_stmt # increment (++) and decrement (--) operators used as part of greater statement
  27 ++useless_void # use of the void type may be unnecessary (void is always undefined)
  28 ++multiple_plus_minus # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs
  29 ++use_of_label # use of label
  30 +-block_without_braces # block statement without curly braces
  31 ++leading_decimal_point # leading decimal point may indicate a number or an object member
  32 ++trailing_decimal_point # trailing decimal point may indicate a number or an object member
  33 ++octal_number # leading zeros make an octal number
  34 ++nested_comment # nested comment
  35 ++misplaced_regex # regular expressions should be preceded by a left parenthesis, assignment, colon, or comma
  36 ++ambiguous_newline # unexpected end of line; it is ambiguous whether these lines are part of the same statement
  37 ++empty_statement # empty statement or extra semicolon
  38 +-missing_option_explicit # the "option explicit" control comment is missing
  39 ++partial_option_explicit # the "option explicit" control comment, if used, must be in the first script tag
  40 ++dup_option_explicit # duplicate "option explicit" control comment
  41 ++useless_assign # useless assignment
  42 ++ambiguous_nested_stmt # block statements containing block statements should use curly braces to resolve ambiguity
  43 ++ambiguous_else_stmt # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent)
  44 ++missing_default_case # missing default case in switch statement
  45 ++duplicate_case_in_switch # duplicate case in switch statements
  46 ++default_not_at_end # the default case is not at the end of the switch statement
  47 ++legacy_cc_not_understood # couldn't understand control comment using /*@keyword@*/ syntax
  48 ++jsl_cc_not_understood # couldn't understand control comment using /*jsl:keyword*/ syntax
  49 ++useless_comparison # useless comparison; comparing identical expressions
  50 ++with_statement # with statement hides undeclared variables; use temporary variable instead
  51 ++trailing_comma_in_array # extra comma is not recommended in array initializers
  52 ++assign_to_function_call # assignment to a function call
  53 ++parseint_missing_radix # parseInt missing radix parameter
  54 +
  55 +
  56 +### Output format
  57 +# Customize the format of the error message.
  58 +# __FILE__ indicates current file path
  59 +# __FILENAME__ indicates current file name
  60 +# __LINE__ indicates current line
  61 +# __ERROR__ indicates error message
  62 +#
  63 +# Visual Studio syntax (default):
  64 ++output-format __FILE__(__LINE__): __ERROR__
  65 +# Alternative syntax:
  66 +#+output-format __FILE__:__LINE__: __ERROR__
  67 +
  68 +
  69 +### Context
  70 +# Show the in-line position of the error.
  71 +# Use "+context" to display or "-context" to suppress.
  72 +#
  73 ++context
  74 +
  75 +
  76 +### Semicolons
  77 +# By default, assignments of an anonymous function to a variable or
  78 +# property (such as a function prototype) must be followed by a semicolon.
  79 +#
  80 ++lambda_assign_requires_semicolon
  81 +
  82 +
  83 +### Control Comments
  84 +# Both JavaScript Lint and the JScript interpreter confuse each other with the syntax for
  85 +# the /*@keyword@*/ control comments and JScript conditional comments. (The latter is
  86 +# enabled in JScript with @cc_on@). The /*jsl:keyword*/ syntax is preferred for this reason,
  87 +# although legacy control comments are enabled by default for backward compatibility.
  88 +#
  89 ++legacy_control_comments
  90 +
  91 +
  92 +### JScript Function Extensions
  93 +# JScript allows member functions to be defined like this:
  94 +# function MyObj() { /*constructor*/ }
  95 +# function MyObj.prototype.go() { /*member function*/ }
  96 +#
  97 +# It also allows events to be attached like this:
  98 +# function window::onload() { /*init page*/ }
  99 +#
  100 +# This is a Microsoft-only JavaScript extension. Enable this setting to allow them.
  101 +#
  102 +-jscript_function_extensions
  103 +
  104 +
  105 +### Defining identifiers
  106 +# By default, "option explicit" is enabled on a per-file basis.
  107 +# To enable this for all files, use "+always_use_option_explicit"
  108 +-always_use_option_explicit
  109 +
  110 +# Define certain identifiers of which the lint is not aware.
  111 +# (Use this in conjunction with the "undeclared identifier" warning.)
  112 +#
  113 +# Common uses for webpages might be:
  114 +#+define window
  115 +#+define document
  116 +
  117 +
  118 +### Files
  119 +# Specify which files to lint
  120 +# Use "+recurse" to enable recursion (disabled by default).
  121 +# To add a set of files, use "+process FileName", "+process Folder\Path\*.js",
  122 +# or "+process Folder\Path\*.htm".
  123 +#
  124 +#+process jsl-test.js
  125 +
  126 ++define window
  127 ++define document
  128 ++define alert
  129 ++define XMLHttpRequest
  130 ++define ActiveXObject
  131 ++define Image
  132 ++define parent
  133 ++define dispatchEvent
  134 ++define screen
  135 ++define navigator
  136 ++define setTimeout

0 comments on commit 270a756

Please sign in to comment.
Something went wrong with that request. Please try again.