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

gulp-jslint

v1.0.10

Published

The classic and strict javascript lint-tool for gulp.js

Downloads

3,276

Readme

gulp-jslint Build Status View on NPM code climate code coverage

It's JSLint for Gulp.js.

NPM

Supports node >= 0.10.x.

Table of Contents

Installation

Simply install with npm by running npm install gulp-jslint.

Usage

var gulp = require('gulp');
var jslint = require('gulp-jslint');

gulp.task('default', function () {
    return gulp.src(['source.js'])
            .pipe(jslint({ /* this object represents the JSLint directives being passed down */ }))
            .pipe(jslint.reporter( 'my-reporter' ));
});

If you would like to specify a custom jslint edition to use, set the property 'edition' in your directives object. These versions should follow what the package node-jslint expects or this property can be set to a pre-loaded jslint function.

Directives

All directives being passed to the jslint() function are standard JSLint directives (for a list of directives, see the official JSLint docs).

However, to supply a list of global variables for your code, use the directive 'predef' or 'global' like so ('global' is an alias of 'predef' but 'predef' will be prefered since it is the official JSLint standard):

gulp.task('default', function () {
    return gulp.src(['source.js'])
            .pipe(jslint({
                predef: [ 'a_global' ],
                global: [ 'a_global' ]
            }));
});

Please see gulpfile.js for a more extensive sample gulpfile.

Reporters

By default, two reporters are provided by gulp-jslint. The first is the default reporter (appropriately named 'default') and the second report is the popular 'jshint-stylish' (named 'stylish').

To use either of these reporters, provide the name of the reporter followed by whatever arguments they expect to the function jslint.reporter().

For example:

gulp.task('default', function () {
    return gulp.src(['source.js'])
            .pipe(jslint())
            .pipe(jslint.reporter('default', errorsOnly))
            .pipe(jslint.reporter('stylish', options));
});

It's probably a good idea to use something like path.basename() on the file property to avoid lots of garbage in the command-line (i.e. path.basename('/path/to/index.js') === 'index.js').

Custom Reporters

Custom reporters should be either be synchronous or streams. Either way, the reporter will receive a results object and can output its report onto the console/logfile the way it wishes.

The results object will contain the following properties:

  • filename: the absolute path to the file being linted.
  • success: a boolean value representing whether the linting passed.
  • errors: an array of JSLint errors. Each element will contain the properties:
    • name: the string 'JSLintError'.
    • column: the column number of the error.
    • line: the line number of the error.
    • code: a code relating to the error.
    • message: a message describing the error.

Support and Licensing

Copyright (C) 2014-2016 Karim Alibhai. Code is licensed under the MIT license.

Please use the official issues section in GitHub to post issues or feature requests. Stars and helpful comments are much appreciated! :)