prefer-response-static-json

March 27, 2026 ยท View on GitHub

๐Ÿ“ Prefer Response.json() over new Response(JSON.stringify()).

๐Ÿ’ผ This rule is enabled in the following configs: โœ… recommended, โ˜‘๏ธ unopinionated.

๐Ÿ”ง This rule is automatically fixable by the --fix CLI option.

Prefer using Response.json() when possible.

Examples

// โŒ
const response = new Response(JSON.stringify(data));

// โœ…
const response = Response.json(data);