JavaScript Validator
Check JavaScript syntax and selected defect rules by ECMAScript edition and environment without executing or rewriting the source.{{ summaryTitle }}
{{ summaryLine }}
{{ report.report_text }}
Scope and rule profiles
Acorn {{ report.parser_version }} parses standard JavaScript for the selected ECMAScript edition and resolved source type. JSX, TypeScript, decorators, package resolution, and project plugins are outside this tool.
Recommended checks syntax plus undeclared identifiers, debugger statements, duplicate object keys, unreachable statements, sparse arrays, and empty blocks. Strict review also flags var declarations, loose equality, console calls, dialog calls, and constant conditions.
Every finding is advisory and requires manual review; no source is rewritten or automatically fixed.
The chart renderer is unavailable. Counts remain available in the summary and findings ledger.
| Location | Rule | Severity | Finding | Fixability | Copy |
|---|---|---|---|---|---|
| L{{ finding.line }}:C{{ finding.column }} | {{ finding.rule }} | {{ finding.severity }} | {{ finding.message }}{{ finding.explanation }}Next: {{ finding.action }}{{ finding.source_excerpt }} | {{ finding.fixability }} |
Showing the first {{ findingRows.length }} findings. Fix them, then validate the updated source to continue.
JavaScript can be invalid before it ever reaches a browser or server. A missing bracket, an import in a classic script, or syntax from a newer language edition can stop parsing immediately. Other defects are legal JavaScript but still deserve review, such as an undeclared name, unreachable statement, duplicate object key, or stray debugger statement.
Static validation examines source text without running it. Parsing answers whether the program fits a selected ECMAScript grammar and source type. Lint-style rules then inspect the parsed structure for selected patterns. Neither step observes real network calls, package resolution, runtime types, DOM state, database results, or tests.
- Classic script and ES module are different grammars. Module syntax permits imports and exports and applies module-specific parsing rules.
- Language edition sets the syntax ceiling. A construct accepted under ECMAScript 2026 may be rejected under ECMAScript 2015.
- Environment changes known globals. A browser source can legitimately use
document, while a Node.js source may rely onprocessorBuffer. - A clean report is scoped evidence. It means no selected rule fired, not that the program will behave correctly.
Validation works best as an early review before project-specific linting, type checking, tests, and execution in the real target environment. A single-file checker cannot see declarations supplied by another file or the exact configuration used by a larger codebase.
How to Use This Tool:
Match the grammar and environment to the file’s intended destination before judging its findings.
- Choose Syntax only for parsing, Recommended core defects for six likely-defect rules, or Strict review for those rules plus five maintainability checks.
- Select the ECMAScript version required by the target runtime or build policy.
- Choose Browser globals, Node.js globals, or ECMAScript globals only. This changes undeclared-identifier findings but does not load or execute those APIs.
- Set Source type. Auto detection tries a classic script first and then an ES module; pin the type when the file contract is known.
- Paste one program or load a local JavaScript or text file. If the source is rejected for size or line count, split it into a smaller review unit.
- Read the first syntax error before other findings. A parse failure prevents the structural lint rules from examining a complete program.
- Correct findings in source order and validate again. Turn on Source excerpts only when matching lines help review; that choice does not change the result.
Interpreting Results:
Syntax valid means the pinned parser built a program structure under the selected edition and resolved source type. It does not mean the source imports successfully, passes a project’s ESLint configuration, satisfies TypeScript, or runs without throwing.
An undeclared-identifier error is local to one file and one global allowlist. Before changing the code, confirm that the name is not intentionally injected by a framework, test harness, host application, or adjacent source file. Warnings identify reviewable patterns; they are not automatic proof of a bug.
If the report reaches 200 findings, it is truncated. Fix the displayed issues and run the updated source again rather than treating the first 200 as the complete total.
Technical Details:
Parsing uses a pinned Acorn 8.17.0 grammar with location tracking, hashbang support, the selected ECMAScript edition, and either script or module semantics. Auto detection accepts a classic script when possible; only a script parse failure triggers a second attempt as a module.
Rule Core
| Profile | Rules | Main boundary |
|---|---|---|
| Syntax only | Selected grammar, edition, and source type. | No lint-style findings. |
| Recommended core defects | Undeclared identifiers, debugger, sparse arrays, duplicate object keys, empty blocks, and unreachable statements. |
Uses bounded lexical scopes and a fixed global allowlist rather than project configuration. |
| Strict review | All recommended rules, plus var, loose equality, console calls, browser dialog calls, and constant conditions. |
These additional warnings may be deliberate and require manual judgment. |
Scope tracking recognizes program, function, block, catch, import, class, and declaration bindings. An identifier reference is reported only when it is absent from those local scopes and from the selected ECMAScript, browser, or Node.js global set. This is intentionally narrower than module-graph or project-wide analysis.
Unreachable-statement checks look for code after break, continue, return, or throw, including terminal blocks and two-sided if branches. Duplicate-key checks allow a paired getter and setter but report later ordinary properties that replace an earlier key.
| Bound | Maximum | Behavior |
|---|---|---|
| Source characters | 100,000 | Larger input is rejected before parsing. |
| Source lines | 4,000 | Larger input is rejected before parsing. |
| Findings | 200 | The report marks itself truncated when more findings exist. |
References:
- ECMAScript 2026 Language Specification, Ecma International and TC39, 2026.
- Acorn JavaScript parser, Acorn project.
- ESLint Core Concepts, ESLint.