# jslint

> The JavaScript Code Quality Tool

Latest version **0.12.1** (published 2019-01-29) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install jslint
pnpm add jslint
yarn add jslint
bun add jslint
```

Provides the command `jslint`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.12.1 |
| Published | 2019-01-29 |
| First published | 2011-05-03 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8.0 |
| Dependencies | 4 |
| Unpacked size | 3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Reid Burke |
| Maintainers | okuryu, reid, smikes |
| Keywords | lint, jslint, code-quality, static-analysis, jshint, eslint |

## Links

- npm: https://www.npmjs.com/package/jslint
- Repository: https://github.com/reid/node-jslint
- Issues: https://github.com/reid/node-jslint/issues
- npm.io page: https://npm.io/package/jslint

## Dependencies (4)

- [exit](https://npm.io/package/exit.md) ~0.1.2
- [glob](https://npm.io/package/glob.md) ~7.1.3
- [nopt](https://npm.io/package/nopt.md) ~4.0.1
- [readable-stream](https://npm.io/package/readable-stream.md) ~2.1.5

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 0.12.1 (latest) — 2019-01-29
- 0.12.0 — 2018-02-03
- 0.11.0 — 2017-07-18
- 0.10.3 — 2016-08-03
- 0.10.1 — 2016-05-24
- 0.10.0 — 2016-05-16
- 0.9.8 — 2016-05-16
- 0.9.7 — 2016-05-16
- 0.9.6 — 2016-01-08
- 0.9.5 — 2015-11-04
- 0.9.3 — 2015-07-30
- 0.9.2 — 2015-07-29
- 0.9.1 — 2015-06-26
- 0.9.0 — 2015-05-15
- 0.9.0-pre006 — 2015-03-25
- … 50 more at https://npm.io/package/jslint/versions

## README

## node-jslint

Easily use [JSLint][] from the command line.

      jslint bin/jslint.js

## What's New

Added latest jslint, 2018-01-27.

Version 0.12.0 contains the latest jslint-es6

See CHANGELOG.md for detailed change history

## Use the command-line client

### Install (both local and global are supported)

   npm i jslint

### Use the default jslint

    jslint lib/color.js

### Always use the latest jslint

    jslint --edition=latest lib/color.js

### Use a specific edition

For example, edition 2013-02-03 which shipped with node-jslint 0.1.9:

    jslint --edition=2013-02-03 lib/color.js

## Use node-jslint programmatically

### Streams interface

As of node-jslint 0.4.0, a streams interface is exposed.  You can use it in client code like this:

Install as a dependency:

    $ npm install --save jslint

Pull it into your code with require:

    var LintStream = require('jslint').LintStream;

Create and configure the stream linter:

    var options = {
        "edition": "latest",
        "length": 100
    },
        l = new LintStream(options);

Send files to the linter:

    var fileName, fileContents;
    l.write({file: fileName, body: fileContents});

Receive lint from the linter:

    l.on('data', function (chunk, encoding, callback) {
        // chunk is an object

        // chunk.file is whatever you supplied to write (see above)
        assert.deepEqual(chunk.file, fileName);

        // chunk.linted is an object holding the result from running JSLint
        // chunk.linted.ok is the boolean return code from JSLINT()
        // chunk.linted.errors is the array of errors, etc.
        // see JSLINT for the complete contents of the object

        callback();
    });

You can only pass options to the LintStream when creating it.  The `edition` option can be
used to select different editions of JSLint.

The LintStream is in object mode (objectMode: true).  It expects an
object with two properties: `file` and `body`.  The `file` property
can be used to pass metadata along with the file.  The `body` property
contains the file to be linted; it can be either a string or a Buffer.

The LintStream emits `'data'` events containing an object with two properties.
The `file` property is copied from the `file` property that is passed in.  The
`linted` property contains the results of running JSLINT.

### Simple interface

The simple interface provides an edition-aware loader.  This can be used as a frontend to
node-jslint's collection of editions of the JSLINT code.

    var node_jslint = require('jslint'),
        JSLINT = node_jslint.load(edition);

This exposes the same loading interface used in node-jslint, so it supports the special
edition names `default` and `latest` as well as date-based edition names such as `2013-08-26`

As of version 0.5.0, the `load` function also accepts filenames.  To be recognized as a filename,
the argument to load must contain a path-separator character (`/` or `\`) or end with the extension
`.js`.


## Usage examples

Multiple files

    jslint lib/color.js lib/reporter.js

All JSLint options supported

    jslint --white --vars --regexp lib/color.js

Defaults to true, but you can specify false

    jslint --bitwise false lib/color.js

Pass arrays

    jslint --predef $ --predef Backbone lib/color.js

JSLint your entire project

    jslint '**/*.js'

## Using JSLint with a config file

Start with the included `jslint.conf.example` file, name it `jslint.conf` and customize your options
per project or copy it to `$HOME/.jslint.conf` to apply your setting globally

## License

See LICENSE file.

[JSLint]: http://jslint.com/

---
_Source: https://npm.io/package/jslint · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
