@qz/user-test-handyjs

1.0.0 · Public · Published Nov 30, 2026

A small JavaScript checker that explains common beginner mistakes with file and line locations.

handyjs

handyjs is a small, dependency-free checker that points out common JavaScript beginner mistakes and explains what to try instead. It is an educational aid, not a complete linter or proof that code is correct.

Install

sh
npm install handyjs

Command line

sh
npx handyjs src/app.js
npx handyjs src/app.js src/helpers.js

The command prints a file, line, column, rule name, and explanation for each possible issue. It exits with status 1 when it finds issues, 2 when a file cannot be read or no files were provided, and 0 when no issues are found. Run npx handyjs --help for usage.

JavaScript API

js
const { inspect } = require('handyjs');
const result = inspect('var count = 1;\nif (count == "1") console.log(count);', { filename: 'example.js' });
console.log(result.summary);
for (const finding of result.findings) console.log(`${finding.file}:${finding.line}:${finding.column} ${finding.ruleId}\n${finding.message}`);

Each finding contains ruleId, message, file, line, column, and excerpt. The result contains filename, findings, and summary.

Checks

  • no-var: recommends block-scoped const or let.
  • no-loose-equality: flags == and !=, leaving === and !== alone.
  • no-console-log: points out debugging output that may be left in shared code.
  • no-debugger: flags debugger statements that can pause execution.
  • parse-int-radix: recommends an explicit radix for parseInt.
  • assignment-in-condition: catches a simple assignment in an if or while condition.
  • string-timeout: recommends a function callback for setTimeout and setInterval.

Checks are intentionally small, line-based heuristics. They skip ordinary quoted strings and same-line comments, but template interpolation and complex or multi-line expressions can produce missed findings or false positives. Use a parser-based linter for comprehensive analysis.

License

MIT. See LICENSE.