mimosa-jshint

2.2.0 • Public • Published

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.

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,
  executeAfterCompile: true,
  rules: {},
  jshintrc: ".jshintrc"  
}

jshint.exclude array of string/regex

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.

jshint.compiled boolean

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

jshint.copied boolean

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

jshint.vendor boolean

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.

executeAfterCompile boolean

Determines whether JSHint runs on code before or after it is compiled. This defaults to true which means that JSHint runs on compiled code. So, for instance, it would not run on CoffeeScript, instead it would run on the compiled JavaScript. You may find you want to run on pre-compiled code. Some compilers, like Babel will transform the style of the code when it compiles it. If running on the compiled output of Babel, JSHint will have many problems that cannot be avoided.

jshint.rules object

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.

jshint.jshintrc string

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
}

Package Sidebar

Install

npm i mimosa-jshint

Weekly Downloads

6

Version

2.2.0

License

MIT

Last publish

Collaborators

  • dbashford