{"id":14968124,"url":"https://github.com/postcss/postcss-reporter","last_synced_at":"2025-05-15T18:07:23.125Z","repository":{"id":33395453,"uuid":"37040512","full_name":"postcss/postcss-reporter","owner":"postcss","description":"Log PostCSS messages in the console","archived":false,"fork":false,"pushed_at":"2024-06-21T22:24:00.000Z","size":777,"stargazers_count":159,"open_issues_count":4,"forks_count":14,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-29T13:27:28.763Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/postcss.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"postcss","github":"ai"}},"created_at":"2015-06-08T01:52:53.000Z","updated_at":"2025-03-25T07:30:45.000Z","dependencies_parsed_at":"2024-11-06T15:39:04.719Z","dependency_job_id":"c4403ef0-8cca-4fa2-aff1-6405adc1d714","html_url":"https://github.com/postcss/postcss-reporter","commit_stats":{"total_commits":135,"total_committers":19,"mean_commits":7.105263157894737,"dds":0.6814814814814815,"last_synced_commit":"5d4a102347bf6a78365d50cb1675969cb549153f"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postcss%2Fpostcss-reporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postcss%2Fpostcss-reporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postcss%2Fpostcss-reporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postcss%2Fpostcss-reporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postcss","download_url":"https://codeload.github.com/postcss/postcss-reporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252266022,"owners_count":21720783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T13:39:20.668Z","updated_at":"2025-05-15T18:07:23.067Z","avatar_url":"https://github.com/postcss.png","language":"JavaScript","readme":"# postcss-reporter\n\nA PostCSS plugin to `console.log()` the messages (warnings, etc.) registered by other PostCSS plugins.\n\n---\n\n**SEEKING A NEW MAINTAINER!** Interested in contributing to the ecosystem of PostCSS and Stylelint? Please open an issue if you'd like to take over maintenance of this package.\n\n---\n\n## Purpose\n\nAs of PostCSS 4.1, a single PostCSS process can accumulate messages from all of the plugins it uses.\nMost of these messages are [warnings](https://github.com/postcss/postcss/blob/main/docs/guidelines/plugin.md#32-use-resultwarn-for-warnings).\nPresumably, plugin authors want you to see those messages.\nSo this plugin exists to read the accumulated messages (or messages from only the plugins you've specified), format them, and print them to the console.\n\nBy default, the messages are formatted for human legibility and sorted according to the line/column positions attached to the messages. But another formatting function can be passed in with an option, and sorting can be turned off with an option.\n\n*By default, only warnings are logged*. If you would like to see more messages, you can change the `filter` function.\n\n## Example Output\n\n![Example](example.png?raw=true)\n\n## Installation\n\n```shell\nnpm install --save-dev postcss postcss-reporter\n```\n\nVersion 1.0.0+ is compatible with PostCSS 5+. (Earlier versions are compatible with PostCSS 4.)\n\n## Usage\n\nAdd it to your plugin list *after any plugins whose messages you want to log*, and optionally pass it an object of options.\n\nFor example, using [gulp-postcss](https://github.com/postcss/gulp-postcss):\n\n```js\ngulp.task('css', function() {\n  return gulp.src('./src/*.css')\n    .pipe(postcss([\n      bemLinter(),\n      customProperties(),\n      calc(),\n      rejectAllColors(),\n      reporter(myOptions) // \u003c------ ding\n    ]))\n    .pipe(gulp.dest('./dist'));\n});\n```\n\n## Options\n\n**clearReportedMessages** (boolean, default = `false`)\n\nIf true, the plugin will clear the result's messages after it logs them. This prevents other plugins, or the task runner you use, from logging the same information again and causing confusion.\n\nSee also `clearAllMessages`.\n\n**formatter** (function, default = the default formatter)\n\nBy default, this reporter will format the messages for human legibility in the console.\nTo use another formatter, pass a function that\n\n  - accepts an object containing a `messages` array and a `source` string\n  - returns the string to report\n\nFor example, you could write a formatter like this:\n\n```js\nreporter({\n  formatter: function(input) {\n    return input.source + ' produced ' + input.messages.length + ' messages';\n  }\n})\n```\n\n**plugins** (array of strings, default = `[]`)\n\nIf `plugins` is empty (as it is by default), the reporter will log messages from every PostCSS plugin.\n\nThere are 2 ways to limit output:\n\n- **Whitelist:** Provide an array of the plugins whose messages you would like to show.\n  For example, `{ plugins: ['postcss-bem-linter'] }` will only log messages from the `postcss-bem-linter` plugin.\n- **Blacklist:** Prefix all plugins in the array with `!` to specify only those plugins whose messages you would like to hide.\n  (All other plugins will be shown.)\n  For example, `{ plugins: ['!postcss-bem-linter'] }` will never log messages from the `postcss-bem-linter` plugin; but will log messages from every other plugin.\n\n**filter** (function)\n\nProvide a filter function. It receives the message object and returns a truthy or falsy value, indicating whether that particular message should be reported or not.\n\nBy default, only messages with `type: \"warning\"` are logged. (These are the messages produced when the plugin author uses PostCSS's `warn()` function.)\n\nFor example, `function(message) { return true }` will return every message, regardless of whether or not the plugin declares it as a warning.\n\n**clearAllMessages** (boolean, default = `false`)\n\nIf `true`, the plugin won't pass any messages into other plugins, or the task runner you use.\n\nSee also `clearReportedMessages`.\n\n**throwError** (boolean, default = `false`)\n\nIf `true`, after the plugin logs your messages it will throw an error if it found any warnings.\n\n**sortByPosition** (boolean, default = `true`)\n\nIf `false`, messages will not be sorted by line/column position.\n\n**positionless** (`\"first\"|\"last\"|\"any\"`, default = `\"first\"`)\n\nBy default, messages without line/column positions will be grouped at the beginning of the output.\nTo put them at the end, instead, use `\"last\"`.\nTo not bother sorting these, use `\"any\"`.\n\n**noIcon** (boolean, default = `false`)\n\nIf `true`, no exclamatory triangle icons will be printed next to warnings.\n\n**noPlugin** (boolean, default = `false`)\n\nIf `true`, plugin names will not be printed in brackets after messages.\n\n## How to get output without colors\n\nIf you would like no colors in the console output, simply pass `--no-colors` when you invoke whatever command runs this plugin. (This works because of [chalk](https://github.com/sindresorhus/chalk).)\n\n## Standalone formatter\n\nYou can also use this module's formatter as a library, with following API:\n\n```js\nvar formatter = require('postcss-reporter/lib/formatter');\nvar myFormatter = formatter(myOptions);\n// to use defaults, just pass no options: `formatter()`\nvar warningLog = myFormatter({\n  messages: someMessages,\n  source: someSource\n});\nconsole.log(warningLog);\n```\n\nThese are the formatter's options:\n\n- sortByPosition (boolean, default = `true`)\n- noIcon (boolean, default = `false`) - Do not print any warning exclamatory triangle icons\n- noPlugin (boolean, default = `false`) - Do not print plugin names\n","funding_links":["https://opencollective.com/postcss","https://github.com/sponsors/ai"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostcss%2Fpostcss-reporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostcss%2Fpostcss-reporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostcss%2Fpostcss-reporter/lists"}