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

lint

Package Overview
Dependencies
Maintainers
0
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lint

This package provide lint validation library + node-lint command line tool allows you to check for problems using JSLint. You can specify your own --config file to use alternate JSLint options and your own --formatter file if you want to customize the generated output.

  • 0.1.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
28K
decreased by-44.55%
Maintainers
0
Weekly downloads
 
Created
Source

node-lint

  • Node is a V8 based framework for writing Javascript applications outside the browser.

  • JSLint is a code quality tool that checks for problems in Javascript programs.

  • node-lint lets you run JSLint from the command line.

  • node-lint currently supports node version 0.2.1

installation

npm:

$ npm install lint

usage

You can use node-lint directly if you have node in your $PATH:

$ ./node-lint path/to/your/file.js

Or if you installed it using npm:

$ node-lint path/to/your/file.js

Otherwise, you need to run it with node:

$ node node-lint path/to/your/file.js

You can also specify a directory param and node-lint will find all .js files under that directory and its subdirectories:

$ node node-lint dir1/ dir2/

Enjoy!

config

You can set JSLint options by modifying the default config.js file or even override the default config by passing another config file with the optional --config parameter, e.g.

$ node-lint file1 file2 dir1 dir2 --config path/to/your/config/file.json

For example, if the default config.json has:

{
    "adsafe"       : false,
    "bitwise"      : true,
    "error_prefix" : "\u001b[1m",
    "error_suffix" : ":\u001b[0m "
}

And your own path/to/your/config/file.json looks like:

{
    "bitwise"      : false,
    "browser"      : false
};

Then the final options used will be:

{
    "adsafe"       : false,
    "bitwise"      : false,
    "browser"      : false,
    "error_prefix" : "\u001b[1m",
    "error_suffix" : ":\u001b[0m "
};

Take a look at JSLint's Options to see what to put in the options variable.

reporters

By default node-lint uses an internal reporter function to output it's results to the console. For basic use it's possible to alter the error_prefix and error_suffix colors within your config.js file. This will prepend or append coloring information to the results when JSLint complains about your code. There may be times when a more customizable reporting system might be needed (i.e. IDE/Text Editor integrations or customized console outputs).

node-lint allows you to designate a custom reporter for outputting the results from JSLint's run. This reporter function will override the default function built into node-lint. To utilize a custom reporter first create a js file that has a function in it named reporter:

example-reporter.js:

var sys = require('sys');

function reporter(results) {
    var len = results.length;
    sys.puts(len + ' error' + ((len === 1) ? '' : 's'));
}

Then when you run node-lint from the command line, pass in the customized reporter:

$ ./node-lint path/to/file.js --reporter path/to/file/example-reporter.js

For brevity sake, this is a fairly simple reporter. For more elaborate examples see the examples/reporters/ directory or examples/textmate/.

The sample XML reporter examples\reporters\xml.js produces reports which can also be integrated with a Continuous Integration server like Hudson using the Violations Plugin.

Please see the wiki for integration with various editors.

contribute

To contribute any patches, simply fork this repository using GitHub and send a pull request to me <http://github.com/tav>. Thanks!

credits

  • tav, wrote node-lint

  • Felix Geisendörfer, clarified Node.js specific details

  • Douglas Crockford, wrote the original JSLint and rhino.js runner

  • Nathan Landis, updated node-lint to Node's new API.

  • Oleg Efimov, added support for overridable configurations, running node-lint from a symlink and updates to reflect Node.js API changes.

  • Matthew Kitt, added support for configurable reporters, various code cleanups and improvements including updates to reflect Node.js API changes.

  • Corey Hart, updated node-lint with multiple files and config support.

  • Mamading Ceesay, added support for using node-lint within Emacs.

  • Matt Ranney, updated node-lint to use sys.error.

  • Cliffano Subagio, added npm installation support, XML reporter, and directory param support.

FAQs

Package last updated on 03 Jan 2011

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