mimosa-jshint

A JSHint module for Mimosa

mimosa-jshint

This is Mimosa's JavaScript hinting module. It is soon to be a Mimosa default module but can be used in any scenario.

  • For more information regarding Mimosa, see http://mimosa.io
  • For more info about jshint, check out http://www.jshint.com/

Usage

Add 'jshint' to your list of modules. That's all! Mimosa will install the module for you when you start mimosa watch or mimosa build.

Functionality

When mimosa watch or mimosa build are executed this module will run jshint over your project's JavaScript files. This includes both regular .css as well as the output of transpilers like CoffeeScript or Esperanto. jshint can be run on vendor files, but that is by default turned off.

Default Config

jshint: {
  exclude:[],
  compiled: true,
  copied: true,
  vendor: false,
  rules: {},
  jshintrc: ".jshintrc"  
}

Files to exclude from linting. This setting is an array and can be comprised of strings or regexes. Strings are paths that can be relative to the watch.compiledDir or absolute. String paths must include the file name.

When this property is set to true, compiled JavaScript (i.e. CoffeeScript/LiveScript) will be jshinted.

When this property is set to true, copied JS will be jshinted.

When this property is set to true, vendor JS will be jshinted. What files are vendor is determined by Mimosa core. Mimosa has a vendor setting which indicates where vendor files are located.

If you disagree with any of the jshint settings, or want to turn some of the rules off, add overrides as key/value pairs underneath this property.

Location of a .jshintrc file if one exists. Mimosa will look up the file structure in an attempt to find this file, eventually stopping at the file system root.

Default rules for CoffeeScript and Iced CoffeeScript

Both CoffeeScript and Iced CoffeeScript compile to JavaScript that fail several JS hint validations. There is no way around the compiled code triggering the jshint validations. Because of this, this module automatically sets the following rules when validating Coffee/Iced files.

{
  boss: true,
  eqnull: true,
  shadow: true,
  expr: true
}