{"name":"@es-joy/jsdoccomment","version":"0.10.0","keywords":["eslint","sourcecode"],"author":{"name":"Brett Zamir","email":"brettz9@yahoo.com"},"license":"MIT","_id":"@es-joy/jsdoccomment@0.10.0","maintainers":[{"name":"brettz9","email":"brettz9@yahoo.com"}],"contributors":[],"homepage":"https://github.com/es-joy/jsdoccomment","bugs":{"url":"https://github.com/es-joy/jsdoccomment/issues"},"c8":{"lines":100,"branches":100,"functions":100,"statements":100,"checkCoverage":true},"dist":{"shasum":"f282f44984c7dbe293f666f468449260a7a5c17f","tarball":"http://registry-npm.ywwl.com/@es-joy/jsdoccomment/download/@es-joy/jsdoccomment-0.10.0.tgz","fileCount":15,"integrity":"sha512-sEIC6uUdbsNth0xStQ9tONkYSLHjjYuqv16/c/nrgaoS/Eyo4oBfy3YHK3tFx4nWqbHbBCcYMvrwPUgZLzqzog==","signatures":[{"sig":"MEQCIA20IBTxaiM1aDoGe1A29SIYtXao1oF9GD/2FVgW3c1rAiAECyfB/9Vizp2TUeuzE1DHWxLOquGZnt9Qk5Ly9IBoYQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44656,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg/ksiCRA9TVsSAnZWagAAaAwP/1Z4c5rJwWQw9dcY2qBB\nj2uuUY0Y5XsQjDeD1DAzKiX/6UTgSmwgQ6rMI6nfegexAiGBSzx1cldr1P2w\nTpuZGDpl9vkX8OQsoZDnLFb6i3Ejx72h883831oRmeYFTidsXcoGjyeMlJTH\nzjzX9sVMZ+ct3M5xEVKgoCSJVVVM54LG+Gc1qK73fmQZC7kkMf6JJjmE/+9Q\nIIHRBdE9zIj2bdIJoyOY5wTBPsK3jJerWhU6s13+7cQpZah/TfTlE7+MIiYM\nxAlxWHlKJBathLScXyT2sjGxgtqEnQ2IhgtiFMGWlIWdX/jgItbQA0+X6yQO\nGtpn4oQHTkgZFk40jHHxHWJbHf4tBpf1rpS7v1jEed/pW7tkshH0DSObhN8u\nYUrifOb6pemV17pL9elZR2/OpYZFaQF6UxlNcB9+QTLc1pN2aZ/TzSoBs/Gq\nq530S9BMnTYXjqCW7iSom6dYvSvPF7JXTyecOhV6KDRiq6ILC27ycB7qkQ6S\nga/5oEfvaZtyvmfowQFrYF/o2maAOFa2X609zKzdMJHByldGHrNRJD/X5N1w\nCXPtLTAbraBzziRpvdGFnxk5mS1Jxe5e++6Xwi+jjcifeUaSlfP33BK3Sv0Q\nYZTooHI32HBBDB/z/xFllhH3rcYf/AhRUyWcxXT22VRrFIUF7+tq6O3yjVn4\nsEYe\r\n=n8ES\r\n-----END PGP SIGNATURE-----\r\n","size":11319,"noattachment":false,"key":"/@es-joy/jsdoccomment/-/@es-joy/jsdoccomment-0.10.0.tgz"},"main":"./dist/index.cjs.cjs","type":"module","engines":{"node":">=12.0.0"},"exports":{"import":"./src/index.js","require":"./dist/index.cjs.cjs"},"gitHead":"8bb32303c2cf7ab612314e74a74c4ea313b5f025","scripts":{"c8":"c8 npm run mocha","lint":"npm run eslint","test":"npm run lint && npm run rollup && npm run c8","mocha":"mocha --require chai/register-expect","eslint":"eslint --ext=js,cjs,md,html .","rollup":"rollup -c","prepublishOnly":"pnpm i && npm run rollup"},"_npmUser":{"name":"brettz9","email":"brettz9@yahoo.com"},"repository":{"url":"git+https://github.com/es-joy/jsdoccomment.git","type":"git"},"_npmVersion":"7.18.1","description":"Maintained replacement for ESLint's deprecated SourceCode#getJSDocComment along with other jsdoc utilities","directories":{},"_nodeVersion":"14.17.1","browserslist":["cover 100%"],"dependencies":{"esquery":"^1.4.0","comment-parser":"1.2.0","jsdoc-type-pratt-parser":"1.0.4"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^7.7.3","chai":"^4.3.4","mocha":"^9.0.2","eslint":"^7.31.0","rollup":"^2.53.3","@babel/core":"^7.14.8","@babel/preset-env":"^7.14.8","eslint-plugin-html":"^6.1.2","eslint-plugin-node":"^11.1.0","eslint-plugin-jsdoc":"^35.5.1","@rollup/plugin-babel":"^5.3.0","eslint-plugin-compat":"^3.11.1","eslint-plugin-import":"^2.23.4","eslint-plugin-promise":"^5.1.0","eslint-plugin-sonarjs":"^0.9.1","eslint-plugin-unicorn":"^34.0.1","@brettz9/eslint-plugin":"^1.0.3","eslint-config-ash-nazg":"31.0.0","eslint-config-standard":"^16.0.3","eslint-plugin-markdown":"^2.2.0","eslint-plugin-array-func":"^3.1.7","eslint-plugin-no-unsanitized":"^3.1.5","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-no-use-extend-native":"^0.5.0","@babel/plugin-syntax-class-properties":"^7.12.13"},"_npmOperationalInternal":{"tmp":"tmp/jsdoccomment_0.10.0_1627278113981_0.1741501778150356","host":"s3://npm-registry-packages"},"readme":"# @es-joy/jsdoccomment\n\n[![NPM](https://img.shields.io/npm/v/@es-joy/jsdoccomment.svg?label=npm)](https://www.npmjs.com/package/@es-joy/jsdoccomment)\n[![License](https://img.shields.io/badge/license-MIT-yellowgreen.svg?style=flat)](https://github.com/es-joy/jsdoccomment/blob/main/LICENSE-MIT.txt)\n[![Build Status](https://github.com/es-joy/jsdoccomment/workflows/CI/CD/badge.svg)](#)\n[![API Docs](https://img.shields.io/badge/API%20Documentation-476ff0)](https://es-joy.github.io/jsdoccomment/)\n\n\nThis project aims to preserve and expand upon the\n`SourceCode#getJSDocComment` functionality of the deprecated ESLint method.\n\nIt also exports a number of functions currently for working with JSDoc:\n\n## API\n\n### `parseComment`\n\nFor parsing `comment-parser` in a JSDoc-specific manner.\nMight wish to have tags with or without tags, etc. derived from a split off\nJSON file.\n\n### `commentParserToESTree`\n\nConverts [comment-parser](https://github.com/syavorsky/comment-parser)\nAST to ESTree/ESLint/Babel friendly AST. See the \"ESLint AST...\" section below.\n\n### `estreeToString`\n\nStringifies. In addition to the node argument, it accepts an optional second\noptions object with a single `preferRawType` key. If you don't need to modify\nJSDoc type AST, you might wish to set this to `true` to get the benefits of\npreserving the raw form, but for AST-based stringification of JSDoc types,\nkeep it `false` (the default).\n\n### `jsdocVisitorKeys`\n\nThe [VisitorKeys](https://github.com/eslint/eslint-visitor-keys)\nfor `JsdocBlock`, `JsdocDescriptionLine`, and `JsdocTag`. More likely to be\nsubject to change or dropped in favor of another type parser.\n\n### `jsdocTypeVisitorKeys`\n\nJust a re-export of [VisitorKeys](https://github.com/eslint/eslint-visitor-keys)\nfrom [`jsdoc-type-pratt-parser`](https://github.com/simonseyock/jsdoc-type-pratt-parser/).\n\n### `getDefaultTagStructureForMode`\n\nProvides info on JSDoc tags:\n\n- `nameContents` ('namepath-referencing'|'namepath-defining'|\n    'dual-namepath-referencing'|false) - Whether and how a name is allowed\n    following any type. Tags without a proper name (value `false`) may still\n    have a description (which can appear like a name); `descriptionAllowed`\n    in such cases would be `true`.\n    The presence of a truthy `nameContents` value is therefore only intended\n    to signify whether separate parsing should occur for a name vs. a\n    description, and what its nature should be.\n- `nameRequired` (boolean) - Whether a name must be present following any type.\n- `descriptionAllowed` (boolean) - Whether a description (following any name)\n    is allowed.\n- `typeAllowed` (boolean) - Whether the tag accepts a curly bracketed portion.\n    Even without a type, a tag may still have a name and/or description.\n- `typeRequired` (boolean) - Whether a curly bracketed type must be present.\n- `typeOrNameRequired` (boolean) - Whether either a curly bracketed type is\n    required or a name, but not necessarily both.\n\n### Miscellaneous\n\nAlso currently exports these utilities:\n\n- `getTokenizers` - Used with `parseComment` (its main core).\n- `hasSeeWithLink` - A utility to detect if a tag is `@see` and has a `@link`.\n- `commentHandler` - Used by `eslint-plugin-jsdoc`.\n- `commentParserToESTree`- Converts [comment-parser](https://github.com/syavorsky/comment-parser)\n    AST to ESTree/ESLint/Babel friendly AST.\n- `jsdocVisitorKeys` - The [VisitorKeys](https://github.com/eslint/eslint-visitor-keys)\n    for `JSDocBlock`, `JSDocDescriptionLine`, and `JSDocTag`.\n- `jsdocTypeVisitorKeys` - [VisitorKeys](https://github.com/eslint/eslint-visitor-keys)\n    for `jsdoc-type-pratt-parser`.\n- `defaultNoTypes` = The tags which allow no types by default:\n    `default`, `defaultvalue`, `description`, `example`, `file`,\n    `fileoverview`, `license`, `overview`, `see`, `summary`\n- `defaultNoNames` - The tags which allow no names by default:\n    `access`, `author`, `default`, `defaultvalue`, `description`, `example`,\n    `exception`, `file`, `fileoverview`, `kind`, `license`, `overview`,\n    `return`, `returns`, `since`, `summary`, `throws`, `version`, `variation`\n\n## ESLint AST produced for `comment-parser` nodes (`JsdocBlock`, `JsdocTag`, and `JsdocDescriptionLine`)\n\nNote: Although not added in this package, `@es-joy/jsdoc-eslint-parser` adds\na `jsdoc` property to other ES nodes (using this project's `getJSDocComment`\nto determine the specific comment-block that will be attached as AST).\n\n### `JsdocBlock`\n\nHas the following visitable properties:\n\n1. `descriptionLines` (an array of `JsdocDescriptionLine` for multiline\n    descriptions).\n2. `tags` (an array of `JsdocTag`; see below)\n3. `inlineTags` (an array of `JsdocInlineTag`; see below)\n\nHas the following custom non-visitable property:\n\n1. `delimiterLineBreak` - A string containing any line break after `delimiter`.\n2. `lastDescriptionLine` - A number\n3. `endLine` - A number representing the line number with `end`/`terminal`\n4. `descriptionStartLine` - A 0+ number indicating the line where any\n    description begins\n5. `descriptionEndLine` - A 0+ number indicating the line where the description\n    ends\n6. `hasPreterminalDescription` - Set to 0 or 1. On if has a block description\n    on the same line as the terminal `*/`.\n7. `hasPreterminalTagDescription` - Set to 0 or 1. On if has a tag description\n    on the same line as the terminal `*/`.\n8. `preterminalLineBreak` - A string containing any line break before `terminal`.\n\nMay also have the following non-visitable properties from `comment-parser`:\n\n1. `description` - Same as `descriptionLines` but as a string with newlines.\n2. `delimiter`\n3. `postDelimiter`\n4. `lineEnd`\n5. `initial` (from `start`)\n6. `terminal` (from `end`)\n\n### `JsdocTag`\n\nHas the following visitable properties:\n\n1. `parsedType` (the `jsdoc-type-pratt-parser` AST representation of the tag's\n    type (see the `jsdoc-type-pratt-parser` section below)).\n2. `typeLines` (an array of `JsdocTypeLine` for multiline type strings)\n3. `descriptionLines` (an array of `JsdocDescriptionLine` for multiline\n    descriptions)\n4. `inlineTags` (an array of `JsdocInlineTag`)\n\nMay also have the following non-visitable properties from `comment-parser`\n(note that all are included from `comment-parser` except `end` as that is only\nfor JSDoc blocks and note that `type` is renamed to `rawType` and `start` to\n`initial`):\n\n1. `description` - Same as `descriptionLines` but as a string with newlines.\n2. `rawType` - `comment-parser` has this named as `type`, but because of a\n    conflict with ESTree using `type` for Node type, we renamed it to\n    `rawType`. It is otherwise the same as in `comment-parser`, i.e., a string\n    with newlines, though with the initial `{` and final `}` stripped out.\n    See `typeLines` for the array version of this property.\n3. `initial` - Renamed from `start` to avoid potential conflicts with\n    Acorn-style parser processing tools\n4. `delimiter`\n5. `postDelimiter`\n6. `tag` (this does differ from `comment-parser` now in terms of our stripping\n    the initial `@`)\n7. `postTag`\n8. `name`\n9. `postName`\n10. `postType`\n\n### `JsdocDescriptionLine`\n\nNo visitable properties.\n\nMay also have the following non-visitable properties from `comment-parser`:\n\n1. `delimiter`\n2. `postDelimiter`\n3. `initial` (from `start`)\n4. `description`\n\n### `JsdocTypeLine`\n\nNo visitable properties.\n\nMay also have the following non-visitable properties from `comment-parser`:\n\n1. `delimiter`\n2. `postDelimiter`\n3. `initial` (from `start`)\n4. `rawType` - Renamed from `comment-parser` to avoid a conflict. See\n    explanation under `JsdocTag`\n\n### `JsdocInlineTag`\n\nNo visitable properties.\n\nHas the following non-visitable properties:\n\n1. `format`: 'pipe' | 'plain' | 'prefix' | 'space'. These follow the styles of [link](https://jsdoc.app/tags-inline-link.html) or [tutorial](https://jsdoc.app/tags-inline-tutorial.html).\n    1. `pipe`: `{@link namepathOrURL|link text}`\n    2. `plain`: `{@link namepathOrURL}`\n    3. `prefix`: `[link text]{@link namepathOrURL}`\n    4. `space`: `{@link namepathOrURL link text (after the first space)}`\n2. `namepathOrURL`: string\n3. `tag`: string. The standard allows `tutorial` or `link`\n4. `text`: string\n\n## ESLint AST produced for `jsdoc-type-pratt-parser`\n\nThe AST, including `type`, remains as is from [jsdoc-type-pratt-parser](https://github.com/simonseyock/jsdoc-type-pratt-parser/).\n\nThe type will always begin with a `JsdocType` prefix added, along with a\ncamel-cased type name, e.g., `JsdocTypeUnion`.\n\nThe `jsdoc-type-pratt-parser` visitor keys are also preserved without change.\n\nYou can get a sense of the structure of these types using the parser's\n[tester](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/).\n\n## Installation\n\n```shell\nnpm i @es-joy/jsdoccomment\n```\n\n## Changelog\n\nThe changelog can be found on the [CHANGES.md](https://github.com/es-joy/jsdoccomment/blob/main/CHANGES.md).\n<!--## Contributing\n\nEveryone is welcome to contribute. Please take a moment to review the [contributing guidelines](CONTRIBUTING.md).\n-->\n## Authors and license\n\n[Brett Zamir](http://brett-zamir.me/) and\n[contributors](https://github.com/es-joy/jsdoccomment/graphs/contributors).\n\nMIT License, see the included [LICENSE-MIT.txt](https://github.com/es-joy/jsdoccomment/blob/main/LICENSE-MIT.txt) file.\n\n## To-dos\n\n1. Get complete code coverage\n1. Given that `esquery` expects a `right` property to search for `>` (the\n    child selector), we should perhaps insist, for example, that params are\n    the child property for `JsdocBlock` or such. Where `:has()` is currently\n    needed, one could thus instead just use `>`.\n1. Might add `trailing` for `JsdocBlock` to know whether it is followed by a\n    line break or what not; `comment-parser` does not provide, however\n1. Fix and properly utilize `indent` argument (challenging for\n    `eslint-plugin-jsdoc` but needed for `jsdoc-eslint-parser` stringifiers\n    to be more faithful); should also then use the proposed `trailing` as well\n","publish_time":1627278114110,"_cnpm_publish_time":1627278114110,"dist-tags":{"latest":"1.2.2","v066.0-dev.1":"0.66.0-dev.1","v066.0-dev.2":"0.66.0-dev.2"}}