# grunt-linter

> Validates JavaScript files with JSLint or JSHint

Latest version **0.3.3** (published 2014-03-29) · 0 weekly downloads

## Install

```sh
npm install grunt-linter
pnpm add grunt-linter
yarn add grunt-linter
bun add grunt-linter
```

Provides the command `grunt-linter`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.3 |
| Published | 2014-03-29 |
| First published | 2012-10-19 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Maintainers | circusbred |
| Keywords | gruntplugin, jslint, lint, jshint, code quality |

## Links

- npm: https://www.npmjs.com/package/grunt-linter
- Repository: https://github.com/circusbred/grunt-linter
- Issues: https://github.com/circusbred/grunt-linter/issues
- npm.io page: https://npm.io/package/grunt-linter

## Dependencies (2)

- [grunt](https://npm.io/package/grunt.md) ~0.4.0
- [jshint](https://npm.io/package/jshint.md) ~2.4.0

## 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
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 0.3.3 (latest) — 2014-03-29
- 0.3.2 — 2013-04-22
- 0.3.1 — 2013-02-23
- 0.3.0 — 2013-02-17
- 0.2.1 — 2013-02-17
- 0.2.0 — 2012-12-24
- 0.1.4 — 2012-12-04
- 0.1.3 — 2012-12-03
- 0.1.2 — 2012-11-02
- 0.1.1 — 2012-10-19
- 0.1.0 — 2012-10-19

## README

# grunt-linter

Validates JavaScript files with [JSHint](https://github.com/jshint/jshint) or [JSLint](https://github.com/douglascrockford/JSLint) as a [grunt](https://github.com/cowboy/grunt) task.  JSHint is bundled with the plugin.

## Installation
Install this grunt plugin next to your project's [grunt.js gruntfile][getting_started] with: `npm install grunt-linter`

Then add this line to your project's `grunt.js` gruntfile:

```javascript
grunt.loadNpmTasks('grunt-linter');
```

[npm_registry_page]: http://search.npmjs.org/#/grunt-linter
[grunt]: https://github.com/cowboy/grunt
[getting_started]: https://github.com/cowboy/grunt/blob/master/docs/getting_started.md

## Documentation

A single-task to validate your JavaScript files with JSHint or JSLint.

Supports the following options:

<dl>
	<dt>files</dt>
	<dd>An array of files or <a href="https://github.com/gruntjs/grunt/blob/master/docs/api_file.md#file-lists-and-wildcards">wildcards</a> which you want to be validated with the linter.</dd>

	<dt>exclude</dt>
	<dd>A String/filepath/wildcard option which, when provided, tells the plugin which files should be ignored (not scanned).
	</dd>

	<dt>directives</dt>
	<dd>Configuration options/settings to pre-define in JSHint.</dd>

	<dt>globals</dt>
	<dd>Pre-defined globals; should be an object: <code>{
		jQuery: true
	}</code></dd>

	<dt>options</dt>
	<dd>Configuration options/settings for the plugin itself.  Currently supports the following:

		<dl>
			<dt>errorsOnly</dt>
			<dd>A Boolean option which tells the plugin to only display errors when set to `true`.</dd>

			<dt>log</dt>
			<dd>A String/filepath option which, when provided, tells the plugin where to write a verbose log to.</dd>

			<dt>junit</dt>
			<dd>A String/filepath option which, when provided, tells the plugin where to write a JUnit-style XML file to.</dd>

			<dt>linter</dt>
			<dd>A String/filepath option which, when provided, tells the plugin where to load JSHint or JSLint from.</dd>

		</dl>

	</dd>
</dl>


## Example Usage
```javascript
/*jslint node:true*/

module.exports = function (grunt) {

	'use strict';

	grunt.loadNpmTasks('grunt-linter'); // load the task

	grunt.initConfig({
		watch: {
			files: '<config:linter.files>',
			tasks: 'linter'
		},

		// TAKE NOTE - this has changed since 0.1.8

		linter: { // configure the task
			files: [ // some example files
				'grunt.js',
				'src/**/*.js'
			],
			exclude: [
				'**/ignore-*.js',
				'bananas.js'
			],
			directives: { // example directives
				browser: true,
				todo: true
			},
			globals: {
				jQuery: true
			},
			options: {
				junit: 'out/junit.xml', // write the output to a JUnit XML
				log: 'out/lint.log',
				errorsOnly: true, // only display errors
				linter: '/path/to/jshint.js'
			}
		}

	});

	grunt.registerTask('default', 'watch');
};
```


## Release History
* 0.3.3 - JSHint updated to 2.4.x
* 0.3.2 - JSHint updated to 1.1.x
* 0.3.1 - JSHint 1.0.0 released on npm. Removed JSHint submodule and replaced with an npm dependency.
* 0.3.0 - Removed Grunt 0.3.x support, updated to JSHint 1.0.0 and improved .jshintrc support. `/*exported` directive is now supported!
* 0.2.1 - Actual Grunt 0.4.0 support (expandFiles issue)
* 0.2.0 - Grunt 0.4.0 support.
* 0.1.2 - Added `.jshintrc` support. [Example .jshintrc](https://github.com/circusbred/grunt-linter/blob/master/.jshintrc)
* 0.1.1 - Made `options` optional
* 0.1.0 - Forked from grunt-jslint; first release

## License
Copyright (c) 2012 David Sturley, Stephen Mathieson
Licensed under the MIT license.

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