# jshint-loader

> jshint loader module for webpack

Latest version **0.8.4** (published 2017-02-25) · 0 weekly downloads

## Install

```sh
npm install jshint-loader
pnpm add jshint-loader
yarn add jshint-loader
bun add jshint-loader
```

## 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.8.4 |
| Published | 2017-02-25 |
| First published | 2012-10-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 66 |
| Author | Tobias Koppers @sokra |
| Maintainers | bebraw, d3viant0ne, ericclemmons, jhnns, sokra, thelarkinn |

## Links

- npm: https://www.npmjs.com/package/jshint-loader
- Repository: https://github.com/webpack/jshint-loader
- Homepage: https://github.com/webpack/jshint-loader#readme
- Issues: https://github.com/webpack/jshint-loader/issues
- npm.io page: https://npm.io/package/jshint-loader

## Dependencies (3)

- [rcloader](https://npm.io/package/rcloader.md) =0.1.2
- [loader-utils](https://npm.io/package/loader-utils.md) ^1.0.2
- [strip-json-comments](https://npm.io/package/strip-json-comments.md) 0.1.x

## Recent versions

- 0.8.4 (latest) — 2017-02-25
- 0.8.3 — 2015-02-22
- 0.8.2 — 2015-02-05
- 0.8.1 — 2015-01-19
- 0.8.0 — 2014-07-16
- 0.7.0 — 2014-07-04
- 0.6.0 — 2013-10-28
- 0.5.0 — 2013-02-01
- 0.1.4 — 2012-11-06
- 0.1.3 — 2012-11-02
- 0.1.2 — 2012-10-23
- 0.1.1 — 2012-10-21
- 0.1.0 — 2012-10-20

## README

[![npm][npm]][npm-url]
[![deps][deps]][deps-url]
[![test][test]][test-url]
[![chat][chat]][chat-url]

<div align="center">
  <!-- replace with accurate logo e.g from https://worldvectorlogo.com/ -->
  <a href="https://github.com/webpack/webpack">
    <img width="200" height="200" vspace="" hspace="25"
      src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon.svg">
  </a>
  <h1>jshint Loader</h1>
  <p>jshint loader for Webpack.<p>
</div>

<h2 align="center">Install</h2>

```bash
npm i jshint-loader --save
```

<h2 align="center">Usage</h2>

Apply the jshint loader as pre/postLoader in your webpack configuration:

``` javascript
module.exports = {
	module: {
		preLoaders: [
			{
				test: /\.js$/, // include .js files
				exclude: /node_modules/, // exclude any and all files in the node_modules folder
				loader: "jshint-loader"
			}
		]
	},

	// more options in the optional jshint object
	jshint: {
		// any jshint option http://www.jshint.com/docs/options/
		// i. e.
		camelcase: true,

		// jshint errors are displayed by default as warnings
		// set emitErrors to true to display them as errors
		emitErrors: false,

		// jshint to not interrupt the compilation
		// if you want any file with jshint errors to fail
		// set failOnHint to true
		failOnHint: false,

		// custom reporter function
		reporter: function(errors) { }
	}
}
```

<h2 align="center">Custom reporter</h2>

By default, `jshint-loader` will provide a default reporter.

However, if you prefer a custom reporter, pass a function under the `reporter` key in `jshint` options. (see *usage* above)

The reporter function will be passed an array of errors/warnings produced by jshint
with the following structure:
```js
[
{
    id:        [string, usually '(error)'],
    code:      [string, error/warning code],
    reason:    [string, error/warning message],
    evidence:  [string, a piece of code that generated this error]
    line:      [number]
    character: [number]
    scope:     [string, message scope;
                usually '(main)' unless the code was eval'ed]

    [+ a few other legacy fields that you don't need to worry about.]
},
// ...
// more errors/warnings
]
```

The reporter function will be excuted with the loader context as `this`. You may emit messages using `this.emitWarning(...)` or `this.emitError(...)`. See [webpack docs on loader context](http://webpack.github.io/docs/loaders.html#loader-context).

**Note:** jshint reporters are **not compatible** with jshint-loader!
This is due to the fact that reporter input is only processed from one file; not multiple files. Error reporting in this manner differs from [tranditional reporters](http://www.jshint.com/docs/reporters/) for jshint
since the loader plugin (i.e. jshint-loader) is executed for each source file; and thus the reporter is executed for each file.

The output in webpack CLI will usually be:
```js
...

WARNING in ./path/to/file.js
<reporter output>

...
```
`

<h2 align="center">Maintainers</h2>

<table>
  <tbody>
    <tr>
      <td align="center">
        <img width="150" height="150"
        src="https://avatars3.githubusercontent.com/u/166921?v=3&s=150">
        </br>
        <a href="https://github.com/bebraw">Juho Vepsäläinen</a>
      </td>
      <td align="center">
        <img width="150" height="150"
        src="https://avatars2.githubusercontent.com/u/8420490?v=3&s=150">
        </br>
        <a href="https://github.com/d3viant0ne">Joshua Wiens</a>
      </td>
      <td align="center">
        <img width="150" height="150"
        src="https://avatars3.githubusercontent.com/u/533616?v=3&s=150">
        </br>
        <a href="https://github.com/SpaceK33z">Kees Kluskens</a>
      </td>
      <td align="center">
        <img width="150" height="150"
        src="https://avatars3.githubusercontent.com/u/3408176?v=3&s=150">
        </br>
        <a href="https://github.com/TheLarkInn">Sean Larkin</a>
      </td>
    </tr>
  <tbody>
</table>


[npm]: https://img.shields.io/npm/v/jshint-loader.svg
[npm-url]: https://npmjs.com/package/jshint-loader

[deps]: https://david-dm.org/webpack-contrib/jshint-loader.svg
[deps-url]: https://david-dm.org/webpack-contrib/jshint-loader

[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
[chat-url]: https://gitter.im/webpack/webpack

[test]: http://img.shields.io/travis/webpack-contrib/jshint-loader.svg
[test-url]: https://travis-ci.org/webpack-contrib/jshint-loader

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