npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-jslint

v1.1.15

Published

Validates JavaScript files with JSLint

Downloads

4,698

Readme

grunt-jslint

Build Status Dependency Status

Validates JavaScript files with JSLint as a grunt task.

Installation

Install this grunt plugin next to your project's Gruntfile with: npm install grunt-jslint

Then add this line to your project's gruntfile:

grunt.loadNpmTasks('grunt-jslint');

Documentation

A multi-task to validate your JavaScript files with JSLint.

Supports the following options:

  • files An array of files or wildcards which you want to be validated by JSLint
  • exclude An array of files or wildcards which you do not want to be validated by JSLint
  • directives Configuration options/settings to pre-define in JSLint. Pre-defined globals are included within this object as predef: ['myglobal']
  • options
    • errorsOnly A Boolean option which tells the plugin to only display errors when set to true
    • log A String/filepath option which, when provided, tells the plugin where to write a verbose log to
    • junit A String/filepath option which, when provided, tells the plugin where to write a JUnit-style XML file to
    • failOnError A Boolean option - defaults to true; when set to false, grunt will not fail if JSLint detects an error
    • checkstyle A String/filepath option which, when provided, tells the plugin where to write a CheckStyle-XML file to
    • shebang Ignore shebang lines (#!/usr/bin/whatever) from files
    • edition Specify edition of jslint to use. Either a date which is a JSLint edition (see node_modules/jslint/lib for valid choices), or 'latest' for the latest version, or a path (absolute or relative to process current directory) to the JSLint

Example Usage

module.exports = function (grunt) {
  'use strict';

  grunt.loadNpmTasks('grunt-jslint'); // load the task

  grunt.initConfig({
    jslint: { // configure the task
      // lint your project's server code
      server: {
        src: [ // some example files
          'server/lib/*.js',
          'server/routes/*.js',
          'server/*.js',
          'server/test/*.js'
        ],
        exclude: [
          'server/config.js'
        ],
        directives: { // example directives
          node: true,
          todo: true
        },
        options: {
          edition: 'latest', // specify an edition of jslint or use 'dir/mycustom-jslint.js' for own path
          junit: 'out/server-junit.xml', // write the output to a JUnit XML
          log: 'out/server-lint.log',
          jslintXml: 'out/server-jslint.xml',
          errorsOnly: true, // only display errors
          failOnError: false, // defaults to true
          checkstyle: 'out/server-checkstyle.xml' // write a checkstyle-XML
        }
      },
      // lint your project's client code
      client: {
        src: [
          'client/**/*.js'
        ],
        directives: {
          browser: true,
          predef: [
            'jQuery'
          ]
        },
        options: {
          junit: 'out/client-junit.xml'
        }
      }
    }
  });

  grunt.registerTask('default', 'jslint');
};

Contributing

All files should be validated with JSLint. Bug fixes and/or new features must be accompanied by a passing test. Tests are written with vows.

Validating coding style

Run grunt jslint in the root of your repository.

Running the tests

Run make test in the root of your repository.

License

Copyright (c) 2013 Stephen Mathieson Licensed under the WTFPL license.