Errors block the parse. Warnings point at a known trap.
Every finding carries a JSHint code. The first letter tells you how urgent the fix is.
| Prefix | Meaning | Example |
|---|---|---|
| E | The source breaks the grammar of the ES version you picked, or breaks a rule the language enforces, such as reassigning a const. Fix these first. | E019 Unmatched '{'. |
| W | The code parses. The pattern behind the warning is a common source of bugs: loose equality, a missing semicolon, a name with no declaration. | W117 'cart' is not defined. |
| I | Rare notes about options or directives. Safe to read last. | Option notices |
Codes you will meet most, with the usual fix
| Code | Message | Usual fix |
|---|---|---|
W033 | Missing semicolon. | Add the semicolon. If your team writes without semicolons on purpose, watch lines starting with (, [ or a backtick, the three spots where automatic insertion goes wrong. |
W117 | 'x' is not defined. | Declare the name. If x is a host global such as document or process, switch Environment instead. |
W116 | Expected '===' and instead saw '=='. | Use ===. Keep == null only where you mean to catch both null plus undefined. |
W084 | Expected a conditional expression and instead saw an assignment. | if (total = 0) assigns zero. Write ===. |
W083 | Functions declared within loops referencing an outer scoped variable... | Change var to let in the loop header, or move the callback out of the loop. |
W098 | 'x' is defined but never used. | Delete dead code. Untick Unused variables for files exposing functions through globals. |
W119 | 'x' is only available in ES6 (use 'esversion: 6'). | Raise ES version to match your build target, or transpile. |
E013 | Attempting to override 'x' which is a constant. | Declare with let, or stop reassigning. |
E041 | Unrecoverable syntax error. | JSHint stopped scanning. Fix the error listed right above this one, then check again. |
Reading the sample report line by line
Load sample fills the editor with a short cart script. It looks finished. Five of its findings would reach users as bugs, the rest are hygiene. Here is the order worth fixing them in.
- Line 24, E013.
TAX_RATE = 0.09reassigns a constant. Browsers throw a TypeError the moment this line runs. - Line 8, W084.
if (total = 0)sets total to zero, the branch never runs, then the function returns"0.00"for every cart. No exception, no console message. The linter is the only thing pointing at this one. - Lines 15 to 17, W083. With
var i, every click handler readsiafter the loop has finished, sobuttons[i]is undefined at click time. Swap tolet iand the warning goes away. - Lines 17 and 23, W117.
applyCouponandcarthave no declaration. If another script defines them, add/* global applyCoupon, cart */at the top. If not, you found a typo before production did. - Line 23, W116 twice. Loose
==compares a number with a string, plus theifhas no braces. Both rules come from the Extra rules boxes. Untick them and both findings disappear. - Line 4, W033, and line 14, W098. A missing semicolon and a function nothing calls. Neither breaks this file.
Settings above the editor change the verdict
- ES version
- Sets which syntax counts as legal. Under ES5 every arrow function,
let, template literal or class produces W119. Pick the oldest target your bundler or browser list ships to, not the newest one your editor understands. - Environment
- Browser predefines
window,document,fetch,localStorage. Node.js predefinesrequire,module,process,Buffer,__dirname. Both suits shared utility files.consoleexists in all three. - ES module
- Allows
importplusexportat the top level. Off by default since a classic script tag rejects both. Greyed out under ES5. - Extra rules
- Undeclared variables, unused variables, strict equality, braces on every block. Untick all four for a syntax-first pass. JSHint still reports its default warnings, W033 among them.
Fix from the top, then check again
- Clear E codes first, top to bottom. One missing brace shifts how the parser reads every line below, so later errors often vanish after the first fix.
- If the list ends with E041, scanning stopped there. Lines past the stop point have no findings yet. Absence of findings below E041 says nothing about those lines.
- Settle W117 next. Each one is either a missing declaration, a wrong Environment, or a typo.
- Work through the remaining warnings. Click any finding to jump the editor cursor to its line.
- The report caps at 100 findings. Past the cap, fix the first batch, then check again.
Which checker fits the job
| Tool | Best for | Blind spot |
|---|---|---|
| This page | One pasted snippet, a bug report, a script from a CMS field. Nothing to install. | Fixed JSHint rule set, no project config, no plugins. |
node --check app.js | The plain question "will this file load?", answered by the exact parser in your Node version. | Syntax only. No warnings about undeclared names or loose equality. |
| ESLint in the repo | Committed code, shared team rules, React or TypeScript plugins, autofix on save. | Needs a config file before a single finding appears. |
tsc --noEmit | Type errors in TypeScript or checkJs projects. | Ignores style rules unless paired with a linter. |
What a clean report does not prove
- Runtime behaviour. A null property read, a failed fetch, a wrong total. Run the code in the JavaScript Playground or your tests.
- JSX, Vue templates, TypeScript. JSHint parses plain JavaScript. The first
<Buttontag or: stringannotation stops the scan with an error. Use ESLint with the matching parser. - Syntax newer than ES2020. Features such as
??=or private#fieldssit outside the newest preset here. If one gets flagged, confirm withnode --checkbefore rewriting code which already runs. - Minified files. A bundle sits on one line, so every finding reports line 1. Run it through the JavaScript Beautifier first, then paste the formatted result here.
- Long files. Past 8,000 lines the automatic check pauses. Press Check to run. For a full vendor bundle,
node --checkon your machine finishes faster.