Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-jslint

Package Overview
Dependencies
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-jslint

Validates JavaScript files with JSLint

  • 1.1.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
908
decreased by-16.85%
Maintainers
2
Weekly downloads
 
Created
Source

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

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: {
          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.

Keywords

FAQs

Package last updated on 20 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc