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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gulp-custom-lint

v1.0.5

Published

Use regexp or custom functions to create your own custom lint rules or ocd checks (gulp plugin)

Readme

gulp-custom-lint

Use regexp or custom functions to create your own custom lint rules or ocd checks (gulp plugin)

screenshot

Install

$ npm install --save-dev gulp-custom-lint

Usage

Gulpfile

var gulp = require('gulp');
var customLint = require('gulp-custom-lint');

gulp.task('default', function() {
  return gulp.src('./code/*.*')
    .pipe(customLint())
    .pipe(customLint.reporter());
});

.jsclintrc

Create a ".jsclintrc"-file for your custom rules (place it at the same level as your gruntfile.js-file)

module.exports = [
  {
    regexp: /pattern/g,
    message: 'Message to show on failures'
  },
  {
    func: function (content, file) {
      ... code ...
      return {
        failed: true/false
      }
    },
    message: 'Message to show on failures'
  }
];

Instead of the .jsclintrc"-file you can pass a rules object:

var gulp = require('gulp');
var customLint = require('gulp-custom-lint');

gulp.task('default', function() {
  return gulp.src('./code/*.*')
    .pipe(customLint([
      {
        regexp: /pattern/g,
        message: 'Message to show on failures'
      }
    ]))
    .pipe(customLint.reporter());
});

API

As seen above you can either use a regexp pattern or a custom function to validate content/files

Regexp (regular expression) pattern

{
  regexp: /pattern/,
  message: 'Message to show on failures'
}

rule.regexp

type: RegExp

A valid JavaScript regular expressen (with or without g-flag)

rule.message

type: String

The message to show if the pattern matches some content, the failure message

rule.ignore (optional)

type: Array<RegExp>

An array of regexp that will be matched against the file path, so if you want to ignore all files in the "./lib/"-folder, add [/\/lib\//]

Custom function

The custom function will be called with the files content (as a string) and the original vinyl file object. (Don't call toString on the file.content since is has already been done for the content-parameter, performance reasons).

{
  func: function (content, file) {
    return {
      failed: true/false,
      indexes: [index]
    }
  },
  message: 'Message to show if the function returns failed === true'
}

rule.func

type: Function

In this function you will do your custom linting/checking. The function must return a object with the following format:

return {
  failed: true/false
}
returnObject.failed

type: Boolean

True or false value

returnObject.indexes

type: Array<int>

An array of indexes where the problem was found. E.g. if the validation failed at char index 12, set indexes to [12]. If you don't have any index you can skip it or set it to [0]

rule.message

Same as for regexp pattern, please see above

rule.ignore (optional)

Same as for regexp pattern, please see above

Some examples

(from https://github.com/archive/gulp-custom-lint/tree/master/examples)

module.exports = [
  {
    regexp: /z-index: [0-9]/g,
    message: 'Use z-index value from constants file'
  },
  {
    regexp: /debugger;/g,
    message: 'Remove debugger from js file',
    ignore: [/test\-logger/]
  },
  {
    func: function(content, file) {
      return {
        failed: file.path.indexOf('_') !== -1,
        indexes: [1]
      };
    },
    message: 'Use "-" instead of "_" in file names'
  }
];