{"id":19654,"library":"eslint-formatting-reporter","title":"eslint-formatting-reporter","description":"A utility library for ESLint plugins that report formatting differences between original and formatted code. Version 0.0.0, actively maintained by Anthony Fu. Extracted from eslint-plugin-prettier, it provides `reportDifferences` function and `messages` object to simplify creating custom formatting rules. Ships TypeScript types, peer dependency on ESLint >=8.40.0. Lightweight alternative to directly using prettier-linter-helpers.","status":"active","version":"0.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/antfu/eslint-formatting-reporter","tags":["javascript","typescript"],"install":[{"cmd":"npm install eslint-formatting-reporter","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-formatting-reporter","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-formatting-reporter","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for ESLint rule context","package":"eslint","optional":false}],"imports":[{"note":"ESM-only; CommonJS require will not work this package is ESM.","wrong":"const { reportDifferences } = require('eslint-formatting-reporter')","symbol":"reportDifferences","correct":"import { reportDifferences } from 'eslint-formatting-reporter'"},{"note":"Used for ESLint rule meta.messages.","symbol":"messages","correct":"import { messages } from 'eslint-formatting-reporter'"},{"note":"Rule type is from eslint, not this package.","wrong":"import { Rule } from 'eslint-formatting-reporter'","symbol":"Rule","correct":"import type { Rule } from 'eslint'"}],"quickstart":{"code":"import { messages, reportDifferences } from 'eslint-formatting-reporter';\nimport type { Rule } from 'eslint';\n\nexport default <Rule.RuleModule>{\n  meta: {\n    type: 'layout',\n    fixable: 'whitespace',\n    messages\n  },\n  create(context) {\n    return {\n      Program() {\n        const source = context.source.text;\n        const formatted = source.replace(/\\s+$/, ''); // example formatter\n        reportDifferences(context, source, formatted);\n      }\n    };\n  }\n};","lang":"typescript","description":"Creates a custom ESLint rule that reports formatting differences using reportDifferences."},"warnings":[{"fix":"Use context.source.text for ESLint 8.40+; for older versions, upgrade or pass source code manually.","message":"reportDifferences requires context.source.text. In older ESLint versions, use context.getSourceCode().getText().","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use import syntax or dynamic import().","message":"Package is ESM-only. Using require() will fail with ERR_REQUIRE_ESM.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install eslint-formatting-reporter","cause":"Package not installed or incorrect import path.","error":"Cannot find module 'eslint-formatting-reporter'"},{"fix":"Change to import { reportDifferences } from 'eslint-formatting-reporter'","cause":"Using require() for an ESM-only package.","error":"ERR_REQUIRE_ESM"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}