{"id":20163,"library":"jshint-loader","title":"jshint-loader","description":"jshint-loader is a Webpack loader that integrates JSHint linting into the Webpack build process. The current stable version is 0.8.4, released in February 2017, with no further updates. It runs JSHint as a pre-loader to check JavaScript files before bundling. Key differentiators: it supports custom reporters and can emit errors or warnings, but reporters are not compatible with standard JSHint reporters. It requires JSHint as a peer dependency.","status":"maintenance","version":"0.8.4","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/webpack/jshint-loader","tags":["javascript"],"install":[{"cmd":"npm install jshint-loader","lang":"bash","label":"npm"},{"cmd":"yarn add jshint-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add jshint-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to perform linting","package":"jshint","optional":false}],"imports":[{"note":"Loader is used via Webpack config, not imported directly.","wrong":"const jshintLoader = require('jshint-loader');","symbol":"default","correct":"module.exports = { module: { preLoaders: [{ test: /\\.js$/, exclude: /node_modules/, loader: 'jshint-loader' }] } }"},{"note":"Options are placed under the 'jshint' key in Webpack config.","wrong":"const jshint = require('jshint-loader').config;","symbol":"jshint config object","correct":"module.exports = { jshint: { camelcase: true } }"},{"note":"Reporter receives array of errors and uses loader context (this.emitWarning/Error). Standard JSHint reporters are not compatible.","wrong":"// Using standard JSHint reporter like 'jshint-stylish'","symbol":"reporter function","correct":"module.exports = { jshint: { reporter: function(errors) { this.emitWarning(errors[0].reason); } } }"}],"quickstart":{"code":"npm install jshint-loader jshint --save-dev\n\n// webpack.config.js\nmodule.exports = {\n  module: {\n    preLoaders: [\n      {\n        test: /\\.js$/,\n        exclude: /node_modules/,\n        loader: 'jshint-loader'\n      }\n    ]\n  },\n  jshint: {\n    curly: true,\n    eqeqeq: true,\n    emitErrors: true,\n    failOnHint: false\n  }\n};","lang":"javascript","description":"Install jshint-loader and jshint, then configure Webpack to run JSHint as a pre-loader with options."},"warnings":[{"fix":"For Webpack 2+, use: rules: [{ test: /\\.js$/, enforce: 'pre', exclude: /node_modules/, loader: 'jshint-loader' }]","message":"In Webpack 1, preLoaders key is used; in Webpack 2+ it has been replaced by 'rules' with 'enforce: pre'.","severity":"breaking","affected_versions":">=1.0.0 <2.0.0"},{"fix":"Use module.rules with enforce: 'pre' instead of preLoaders.","message":"Webpack 2+ deprecated preLoaders in favor of enforce: pre.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Implement a custom reporter function that uses this.emitWarning() or this.emitError()","message":"Standard JSHint reporters are not compatible with jshint-loader. They will not produce output.","severity":"gotcha","affected_versions":">=0.8.0"},{"fix":"Ensure test pattern includes files you want linted and exclude node_modules.","message":"Loader will not run on files excluded by /node_modules/ unless explicitly included.","severity":"gotcha","affected_versions":">=0.8.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Update config: module: { rules: [{ test: /\\.js$/, enforce: 'pre', loader: 'jshint-loader' }] }","cause":"jshint-loader is used as pre-loader but Webpack 2+ expects 'enforce: pre' instead of preLoaders.","error":"Module parse failed: Unexpected token (1:2)\nYou may need an appropriate loader to handle this file type."},{"fix":"Ensure jshint key in config is an object with valid options.","cause":"jshint options object is missing or malformed.","error":"ERROR in ./src/app.js\nModule build failed: TypeError: Cannot read property 'length' of undefined"},{"fix":"Check that reporter is a function set under jshint.reporter.","cause":"Custom reporter function may not be passed correctly or is not exporting properly.","error":"WARNING: No reporter specified. Using default."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}