jokeyrhyme / grunt-jqlint

Grunt.JS automation for https://github.com/jokeyrhyme/jqlint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

grunt-jqlint

Grunt.JS automation for https://github.com/jokeyrhyme/jqlint

Getting Started

This plugin requires Grunt 0.4

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-jqlint --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-jqlint');

The "jqlint" task

Overview

In your project's Gruntfile, add a section named jqlint to the data object passed into grunt.initConfig().

grunt.initConfig({
  jqlint: {
    configName1: {
      options: {
        // Task-specific options go here.
      },
      src: [
        // list files or file patterns here
      ]
    },
    // additional configurations
  },
});

Options

options.errorsOnly

Type: String Default value: true

Log each file as it is scanned, or only if errors were encountered.

options.failOnError

Type: String Default value: true

Fail the task (ending the Grunt run) if any errors were encountered, or continue regardless.

Usage Examples

Default Options

grunt.initConfig({
  jqlint: {
    all: {
      options: {
        errorsOnly: true,
        failOnError: true
      },
      src: [
        // list files or file patterns here
      ]
    }
  }
});

For a Node.JS web server, you might only want to scan your client-side files (if that's the only place you use jQuery):

src: [
  'public/**/*.js',
  '!**/bower_components/**/*',
  '!**/*.min.js'
]

Alternatively, you might want to scan everything except test files:

src: [
  '**/*.js',
  '!**/bower_components/**/*',
  '!**/node_modules/**/*',
  '!**/*.min.js',
  '!tests/**/*.js'
]

Note: with the src array, all exclusions (with the leading "!") need to be at the end.

It's important for test feedback performance that you reduce the jqlint scope to only the files that contain your code that uses jQuery.

Contributing

Formal style-guide for this project is JSLint. See JSLint settings at the top of each file.

Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

grunt test

This project uses Git Flow, so the master branch always reflects what is in production (i.e. what is in the NPM repository). New code should be merged into the develop branch.

Release History

See the releases page on GitHub.

About

Grunt.JS automation for https://github.com/jokeyrhyme/jqlint


Languages

Language:JavaScript 100.0%