{"name":"unified-diff","version":"3.0.1","description":"unified plugin to ignore unrelated messages","license":"MIT","keywords":["unified","unified-plugin","remark","retext","rehype","plugin","travis","difference","diff","pr"],"repository":{"type":"git","url":"git+https://github.com/unifiedjs/unified-diff.git"},"bugs":{"url":"https://github.com/unifiedjs/unified-diff/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"dependencies":{"git-diff-tree":"^1.0.0","vfile-find-up":"^5.0.0"},"devDependencies":{"nlcst-to-string":"^2.0.0","nyc":"^15.0.0","prettier":"^2.0.0","remark-cli":"^7.0.0","remark-preset-wooorm":"^6.0.0","retext":"^7.0.0","rimraf":"^3.0.0","tape":"^4.0.0","to-vfile":"^6.0.0","unist-util-visit":"^2.0.0","xo":"^0.28.0"},"scripts":{"format":"remark . -qfo && prettier --write \"**/*.js\" && xo --fix","test-api":"node test","test-coverage":"nyc --reporter lcov tape test/index.js","test":"npm run format && npm run test-coverage"},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"esnext":false,"rules":{"unicorn/string-content":"off"}},"remarkConfig":{"plugins":["preset-wooorm"]},"gitHead":"a816e19e860e1300ee2926e1190f8bf26847dab8","homepage":"https://github.com/unifiedjs/unified-diff#readme","_id":"unified-diff@3.0.1","_nodeVersion":"13.10.1","_npmVersion":"6.14.3","dist":{"integrity":"sha512-oDngdkrYYNRUYi19GqyvWNZmOGGsdu1GEOKYy+6iXGphvaoDDidVj3frOC7SumQ2SCWixaHELiXQe7fwcLrMAA==","shasum":"96654d2da8f141849a2917e05d8f35f251c59668","tarball":"http://registry-npm.ywwl.com/unified-diff/download/unified-diff-3.0.1.tgz","fileCount":4,"unpackedSize":11072,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJee4UHCRA9TVsSAnZWagAAMKcQAIvJeV81ekiemJjm29TZ\nOP3YgKGeqrgtQfpexIqSmESb2GOAbchD20G3HgNHFHsdeO7ff1TwstNUBn2i\nmdtk671LheuGTThIDEc4clLc78Lha6hUEXSqQnue4pOxiSyOQxT2MADoFWsZ\nsAyiBlGF+0euljwBbrG/uo6Jcd2w56aZZXUZ5uuf2KwJVptGQWZfNdiy+kfc\n7xGFlmmrW9nsRIeBKBdbAGPSAqARANHV3Gb3Ee6ky4VWGtp8IWhAnVLRLmei\nDW7xJcwmCOUqeSu0v0nGbOSdvQN8icMLrbOhR2Ur/yZviEIgpX9LU5wkX5P9\n96KGVNXn6+FgZ+CUc1p5cCIpm1tT+we/4mVzGt8rzSoVUsJ2XDVxlV16SI7S\nyKCpA2IVqOEMXfb1rADcjFcYBwvwcy6qPWadB5J51gNnnrJl6P32EcK1S/w/\nftvB/HWU+I0exhylTd8TQc3KiVKqQHWsWRvuoYgfUZsmNci6Mn6ReO7Ka3PJ\nDrCeMVEflt7cOTIhCX8+lteMoEE0QN89cy0v87QLxa+lVpnwbZVGMgRpOFf+\njUEi+R6SVa2/l5NI/BwUGIcJMd6K888Md5m25yxsR2j/3WvyWOxI1ZeKKxAG\nEtFJHU7q+fdBxt8gOueBiGIAX4WfPQrAFvyrLAojBaYQlF6jmgbO9nYeih2Y\nV4As\r\n=bZpA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCA5KEUqUjYS7+nJ22InSnW102KTADmjcPfRXOVdfUeIQIhAP57BF9sV8nqxZ2yOqnIR9zTqxwIIH2J4Xr8ocZdki3n"}],"size":4650,"noattachment":false,"key":"/unified-diff/-/unified-diff-3.0.1.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/unified-diff_3.0.1_1585153287262_0.6946747502919717"},"_hasShrinkwrap":false,"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":1585153287711,"_cnpm_publish_time":1585153287711,"dist-tags":{"latest":"5.0.0"}}