Registry / testing / webhint-formatter-json-object

webhint-formatter-json-object

JSON →
library1.6.0jsnpmunverified

A formatter for webhint that outputs linting results as a JSON array. Version 1.6.0 is the latest stable release; the package sees infrequent updates. It is part of the webhint ecosystem, specifically designed to produce machine-readable output for integration with other tools. Unlike default formatters (e.g., stylish), this one returns raw JSON suitable for CI pipelines or custom processing. It depends on the hint package (peer dependency ^7.0.0) and ships TypeScript definitions.

npm install webhint-formatter-json-object
INSTALL
IMPORT
SIG · WEBHINT-FORMATTER-
W
webhint-formatter-json-object
testingjavascriptv1.6.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

JsonObjectFormatter
import JsonObjectFormatter from 'webhint-formatter-json-object'
const { JsonObjectFormatter } = require('webhint-formatter-json-object')
Default export only; named import will fail. ESM is preferred, but CJS require works for default.
default
import JsonObjectFormatter from 'webhint-formatter-json-object'
import { default } from 'webhint-formatter-json-object'
Use default import syntax, not destructured default.
JsonObjectFormatter (type)
import type { JsonObjectFormatter as Formatter } from 'webhint-formatter-json-object'
import { JsonObjectFormatter } from 'webhint-formatter-json-object' (for types)
TypeScript: the type is not exported; use 'typeof import(...)' or rely on class inference. Avoid named type import as it doesn't exist.

Configuration and programmatic usage of the JSON object formatter with webhint.

// Install: npm install webhint-formatter-json-object --save-dev // Use .hintrc configuration: { "connector": { "name": "jsdom" }, "formatters": ["webhint-formatter-json-object"], "hints": { "axe": "error" } } // Run: npx hint https://example.com import JsonObjectFormatter from 'webhint-formatter-json-object'; const formatter = new JsonObjectFormatter(); // formatter.format(results) returns a JSON array
Debug
Known issues
deprecatedThe 'json-object' formatter is deprecated in webhint v7; use 'json' formatter instead.
fix
Replace 'webhint-formatter-json-object' with 'json' (built-in) in .hintrc.
affects: >=7.0.0
gotchaThe formatter output is a JSON array (not pretty-printed), which may break scripts expecting a single object.
fix
Wrap output in an object if needed: {"results": <array>}
affects: >=1.0.0
breakingIn v1.6.0, the default export may not be compatible with older webhint versions (<7).
fix
Ensure webhint peer dependency is ^7.0.0.
affects: >=1.6.0
gotchaThe formatter does not accept options; all configuration is done via .hintrc.
fix
Do not attempt to pass arguments to the constructor.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'webhint-formatter-json-object'
Package not installed or not in node_modules.
fix
Run 'npm install webhint-formatter-json-object --save-dev'
TypeError: webhint_formatter_json_object_1.default is not a constructor
Using CommonJS require incorrectly with default export.
fix
Use 'const JsonObjectFormatter = require('webhint-formatter-json-object').default;'
Warning: The formatter 'webhint-formatter-json-object' is not recognized. Using built-in 'json' formatter.
Formatters list in .hintrc is malformed or the package hasn't been installed.
fix
Ensure the package is installed and the .hintrc formatters array contains the string exactly.
Upgrade
Version history
1.6.0latest on npm
Audit
Dependencies
hintrequiredPeer dependency — webhint runtime required to execute the formatter.
Agent activity
18 hits · last 30 days
node
16
Resources
webhint-formatter-json-object — npm install webhint-formatter-json-object · libregistry