{"id":42298,"library":"webhint-formatter-json-object","title":"Webhint JSON Object Formatter","description":"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.","status":"active","version":"1.6.0","language":"javascript","source_language":"en","source_url":"https://github.com/burgwyn/webhint-formatter-json-object","tags":["javascript","json","webhint","webhint-formatter","typescript"],"install":[{"cmd":"npm install webhint-formatter-json-object","lang":"bash","label":"npm"},{"cmd":"yarn add webhint-formatter-json-object","lang":"bash","label":"yarn"},{"cmd":"pnpm add webhint-formatter-json-object","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency — webhint runtime required to execute the formatter.","package":"hint","optional":false}],"imports":[{"note":"Default export only; named import will fail. ESM is preferred, but CJS require works for default.","wrong":"const { JsonObjectFormatter } = require('webhint-formatter-json-object')","symbol":"JsonObjectFormatter","correct":"import JsonObjectFormatter from 'webhint-formatter-json-object'"},{"note":"Use default import syntax, not destructured default.","wrong":"import { default } from 'webhint-formatter-json-object'","symbol":"default","correct":"import JsonObjectFormatter from 'webhint-formatter-json-object'"},{"note":"TypeScript: the type is not exported; use 'typeof import(...)' or rely on class inference. Avoid named type import as it doesn't exist.","wrong":"import { JsonObjectFormatter } from 'webhint-formatter-json-object' (for types)","symbol":"JsonObjectFormatter (type)","correct":"import type { JsonObjectFormatter as Formatter } from 'webhint-formatter-json-object'"}],"quickstart":{"code":"// Install: npm install webhint-formatter-json-object --save-dev\n// Use .hintrc configuration:\n{\n  \"connector\": { \"name\": \"jsdom\" },\n  \"formatters\": [\"webhint-formatter-json-object\"],\n  \"hints\": {\n    \"axe\": \"error\"\n  }\n}\n// Run: npx hint https://example.com\nimport JsonObjectFormatter from 'webhint-formatter-json-object';\nconst formatter = new JsonObjectFormatter();\n// formatter.format(results) returns a JSON array","lang":"typescript","description":"Configuration and programmatic usage of the JSON object formatter with webhint."},"warnings":[{"fix":"Replace 'webhint-formatter-json-object' with 'json' (built-in) in .hintrc.","message":"The 'json-object' formatter is deprecated in webhint v7; use 'json' formatter instead.","severity":"deprecated","affected_versions":">=7.0.0"},{"fix":"Wrap output in an object if needed: {\"results\": <array>}","message":"The formatter output is a JSON array (not pretty-printed), which may break scripts expecting a single object.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure webhint peer dependency is ^7.0.0.","message":"In v1.6.0, the default export may not be compatible with older webhint versions (<7).","severity":"breaking","affected_versions":">=1.6.0"},{"fix":"Do not attempt to pass arguments to the constructor.","message":"The formatter does not accept options; all configuration is done via .hintrc.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.6.0':18 '7.0.0':74 'array':16 'ci':61 'custom':64 'default':50 'definit':78 'depend':67,73 'design':37 'e.g':52 'ecosystem':35 'formatt':4,6,51,84 'hint':70 'infrequ':27 'integr':45 'javascript':79 'json':2,15,58,80 'latest':21 'lint':11 'machin':41 'machine-read':40 'object':3 'one':55 'output':10,43 'packag':25,71 'part':31 'peer':72 'pipelin':62 'process':65 'produc':39 'raw':57 'readabl':42 'releas':23 'result':12 'return':56 'see':26 'ship':76 'specif':36 'stabl':22 'stylish':53 'suitabl':59 'tool':48 'typescript':77,85 'unlik':49 'updat':28 'version':17 'webhint':1,8,34,81,83 'webhint-formatt':82","created_at":"2026-06-04T18:56:34.849269+00:00","updated_at":"2026-06-04T18:56:34.849269+00:00","problems":[{"fix":"Run 'npm install webhint-formatter-json-object --save-dev'","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'webhint-formatter-json-object'"},{"fix":"Use 'const JsonObjectFormatter = require('webhint-formatter-json-object').default;'","cause":"Using CommonJS require incorrectly with default export.","error":"TypeError: webhint_formatter_json_object_1.default is not a constructor"},{"fix":"Ensure the package is installed and the .hintrc formatters array contains the string exactly.","cause":"Formatters list in .hintrc is malformed or the package hasn't been installed.","error":"Warning: The formatter 'webhint-formatter-json-object' is not recognized. Using built-in 'json' formatter."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/burgwyn/webhint-formatter-json-object#readme","github":"https://github.com/burgwyn/webhint-formatter-json-object","docs":null,"changelog":null,"pypi":null,"npm":"webhint-formatter-json-object","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}