{"name":"unified-diff","version":"1.0.0","description":"Unified plugin to ignore unrelated messages","license":"MIT","keywords":["unified","plugin","travis","difference","diff","pr"],"repository":{"type":"git","url":"git+https://github.com/wooorm/unified-diff.git"},"bugs":{"url":"https://github.com/wooorm/unified-diff/issues"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}],"files":["index.js"],"dependencies":{"git-diff-tree":"^1.0.0","has":"^1.0.1","vfile-find-up":"^2.0.0"},"devDependencies":{"execa":"^0.4.0","has":"^1.0.1","nlcst-to-string":"^2.0.0","nyc":"^8.1.0","remark-cli":"^2.0.0","remark-preset-wooorm":"^1.0.0","retext":"^4.0.0","rimraf":"^2.5.4","tape":"^4.0.0","to-vfile":"^2.0.0","trough":"^1.0.0","unist-util-visit":"^1.1.0","xo":"^0.16.0"},"scripts":{"build-md":"remark . --quiet --frail","build":"npm run build-md","lint":"xo","test-api":"node test","test-coverage":"nyc --reporter lcov tape test/index.js","test":"npm run build && npm run lint && npm run test-coverage"},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"xo":{"space":true},"remarkConfig":{"output":true,"presets":"wooorm"},"gitHead":"291c32e23abcf67ea2525ef3e132d8f9aa92b380","homepage":"https://github.com/wooorm/unified-diff#readme","_id":"unified-diff@1.0.0","_shasum":"ba4af082a647616e40dfb4e4342e056e0d808c16","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"dist":{"shasum":"ba4af082a647616e40dfb4e4342e056e0d808c16","tarball":"http://registry-npm.ywwl.com/unified-diff/download/unified-diff-1.0.0.tgz","integrity":"sha512-n1Pa8j0mzOeuINYUSLrVXkv0NiiTGHKRBSKfiZsoKGEXEuI7Fv90zgGyy1Wh4OJhHUHmznrxUIlUYURY7chZxg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDsfDejhDZjP2dc/j2z5toMasgh2e6tMYhiche28p5IvgIgBP6QPPssxDtkjEYyi1/nN3Q+bXGVL98lCmYtSzuUhgI="}],"size":4220,"noattachment":false,"key":"/unified-diff/-/unified-diff-1.0.0.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/unified-diff-1.0.0.tgz_1473265965720_0.7738341486547142"},"directories":{},"readme":"# unified-diff\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n**[unified][]** plugin to ignore unrelated messages in GitHub Actions and\nTravis.\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`unified().use(unifiedDiff)`](#unifieduseunifieddiff)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package is a [unified][] plugin to ignore unrelated lint messages in a CI.\n\n**unified** is a project that transforms content with abstract syntax trees\n(ASTs).\n**vfile** is the virtual file interface used in unified which manages messages.\nThis is a unified plugin that filters messages on the vfile.\n\n## When should I use this?\n\nYou can use this plugin when you are dealing with a large, existing project.\n\nUsing tools that check whether things follow a style guide is typically very\nuseful.\nHowever, it can be hard to start using something in a large existing project.\nThis plugin helps, because it ignores messages that occur in lines that are not\ntouched by a PR in a CI.\nWhen this plugin is used outside of a supported CIs, it doesn’t do anything.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install unified-diff\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport unifiedDiff from 'https://esm.sh/unified-diff@5'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import unifiedDiff from 'https://esm.sh/unified-diff@5?bundle'\n</script>\n```\n\n## Use\n\nSay our document `example.md` contains:\n\n```markdown\nThis is an an example.\n```\n\n> 👉 **Note**: `an an` is a typo.\n\n…and our module `example.js` looks as follows:\n\n```js\nimport process from 'node:process'\nimport remarkParse from 'remark-parse'\nimport remarkRetext from 'remark-retext'\nimport remarkStringify from 'remark-stringify'\nimport retextEnglish from 'retext-english'\nimport retextIndefiniteArticle from 'retext-indefinite-article'\nimport retextRepeatedWords from 'retext-repeated-words'\nimport {read} from 'to-vfile'\nimport {unified} from 'unified'\nimport unifiedDiff from 'unified-diff'\nimport {reporter} from 'vfile-reporter'\n\nconst file = await unified()\n  .use(remarkParse)\n  .use(\n    remarkRetext,\n    unified()\n      .use(retextEnglish)\n      .use(retextRepeatedWords)\n      .use(retextIndefiniteArticle)\n  )\n  .use(remarkStringify)\n  .use(unifiedDiff)\n  .process(await read('example.md'))\n\nconsole.error(reporter(file))\nprocess.exitCode = file.messages.length > 0 ? 1 : 0\n```\n\n…and our Travis configuration `.travis.yml` contains:\n\n```yml\n# …\nscript:\n- npm test\n- node example.js\n# …\n```\n\n> 👉 **Note**: an equivalent GH Actions workflow file is also supported.\n\nThen, say someone creates a PR which adds the following diff:\n\n```diff\ndiff --git a/example.md b/example.md\nindex 360b225..5a96b86 100644\n--- a/example.md\n+++ b/example.md\n@@ -1 +1,3 @@\n This is an an example.\n+\n+Some more more text. A error.\n```\n\n> 👉 **Note**: `more more` and `A` before `error` are typos.\n\nWhen run in CI, we’ll see the following printed on **stderr**(4).\n\n```txt\nexample.md\n   3:6-3:15  warning  Expected `more` once, not twice   retext-repeated-words      retext-repeated-words\n  3:22-3:23  warning  Use `An` before `error`, not `A`  retext-indefinite-article  retext-indefinite-article\n\n⚠ 2 warnings\n```\n\n> 👉 **Note**: `an an` on L1 is not included because it’s unrelated to this PR.\n\nThe build exits with `1` as there are messages, thus failing CI.\nThe user sees this and amends the PR to the following:\n\n```diff\ndiff --git a/example.md b/example.md\nindex 360b225..5a96b86 100644\n--- a/example.md\n+++ b/example.md\n@@ -1 +1,3 @@\n This is an an example.\n+\n+Some more text. An error.\n```\n\nThis time our lint task exits successfully, even though L1 would normally emit\nan error, but it’s unrelated to the PR.\n\n## API\n\nThis package exports no identifiers.\nThe default export is [`unifiedDiff`][api-unified-diff].\n\n### `unified().use(unifiedDiff)`\n\nIgnore unrelated messages in GitHub Actions and Travis.\n\nThere are no options.\nIf there’s a `TRAVIS_COMMIT_RANGE`, `GITHUB_BASE_REF` and `GITHUB_HEAD_REF`, or\n`GITHUB_SHA` environment variable, then this plugin runs, otherwise it does\nnothing.\n\n###### To do\n\n*   [ ] Add support for other CIs (ping if you want to work on this)\n*   [ ] Add non-CI support (I’m not sure how though)\n\nPRs welcome!\n\n###### Returns\n\nTransform ([`Transformer`][transformer]).\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `unified-diff@^5`,\ncompatible with Node.js 16.\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`unifiedjs/.github`][health] for ways\nto get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n<!-- Definitions -->\n\n[build-badge]: https://github.com/unifiedjs/unified-diff/workflows/main/badge.svg\n\n[build]: https://github.com/unifiedjs/unified-diff/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/unifiedjs/unified-diff.svg\n\n[coverage]: https://codecov.io/github/unifiedjs/unified-diff\n\n[downloads-badge]: https://img.shields.io/npm/dm/unified-diff.svg\n\n[downloads]: https://www.npmjs.com/package/unified-diff\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/unifiedjs/unified/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[health]: https://github.com/unifiedjs/.github\n\n[contributing]: https://github.com/unifiedjs/.github/blob/main/contributing.md\n\n[support]: https://github.com/unifiedjs/.github/blob/main/support.md\n\n[coc]: https://github.com/unifiedjs/.github/blob/main/code-of-conduct.md\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[unified]: https://github.com/unifiedjs/unified\n\n[transformer]: https://github.com/unifiedjs/unified?tab=readme-ov-file#transformer\n\n[api-unified-diff]: #unifieduseunifieddiff\n","publish_time":1473265966866,"_cnpm_publish_time":1473265966866,"dist-tags":{"latest":"5.0.0"}}