Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. # @es-joy/jsdoccomment
  2. [![Node.js CI status](https://github.com/brettz9/getJSDocComment/workflows/Node.js%20CI/badge.svg)](https://github.com/brettz9/getJSDocComment/actions)
  3. This project aims to preserve and expand upon the
  4. `SourceCode#getJSDocComment` functionality of the deprecated ESLint method.
  5. It also exports a number of functions currently for working with JSDoc:
  6. ## API
  7. ### `parseComment`
  8. For parsing `comment-parser` in a JSDoc-specific manner.
  9. Might wish to have tags with or without tags, etc. derived from a split off
  10. JSON file.
  11. ### `commentParserToESTree`
  12. Converts [comment-parser](https://github.com/syavorsky/comment-parser)
  13. AST to ESTree/ESLint/Babel friendly AST. See the "ESLint AST..." section below.
  14. ### `jsdocVisitorKeys`
  15. The [VisitorKeys](https://github.com/eslint/eslint-visitor-keys)
  16. for `JsdocBlock`, `JsdocDescriptionLine`, and `JsdocTag`. More likely to be
  17. subject to change or dropped in favor of another type parser.
  18. ### `jsdocTypeVisitorKeys`
  19. Just a re-export of [VisitorKeys](https://github.com/eslint/eslint-visitor-keys)
  20. from [`jsdoc-type-pratt-parser`](https://github.com/simonseyock/jsdoc-type-pratt-parser/).
  21. ### `getDefaultTagStructureForMode`
  22. Provides info on JSDoc tags:
  23. - `nameContents` ('namepath-referencing'|'namepath-defining'|
  24. 'dual-namepath-referencing'|false) - Whether and how a name is allowed
  25. following any type. Tags without a proper name (value `false`) may still
  26. have a description (which can appear like a name); `descriptionAllowed`
  27. in such cases would be `true`.
  28. The presence of a truthy `nameContents` value is therefore only intended
  29. to signify whether separate parsing should occur for a name vs. a
  30. description, and what its nature should be.
  31. - `nameRequired` (boolean) - Whether a name must be present following any type.
  32. - `descriptionAllowed` (boolean) - Whether a description (following any name)
  33. is allowed.
  34. - `typeAllowed` (boolean) - Whether the tag accepts a curly bracketed portion.
  35. Even without a type, a tag may still have a name and/or description.
  36. - `typeRequired` (boolean) - Whether a curly bracketed type must be present.
  37. - `typeOrNameRequired` (boolean) - Whether either a curly bracketed type is
  38. required or a name, but not necessarily both.
  39. ### Miscellaneous
  40. Also currently exports these utilities, though they might be removed in the
  41. future:
  42. - `getTokenizers` - Used with `parseComment` (its main core)
  43. - `toCamelCase` - Convert to CamelCase.
  44. - `hasSeeWithLink` - A utility to detect if a tag is `@see` and has a `@link`
  45. - `commentHandler` - Used by `eslint-plugin-jsdoc`. Might be removed in future.
  46. - `commentParserToESTree`- Converts [comment-parser](https://github.com/syavorsky/comment-parser)
  47. AST to ESTree/ESLint/Babel friendly AST
  48. - `jsdocVisitorKeys` - The [VisitorKeys](https://github.com/eslint/eslint-visitor-keys)
  49. for `JSDocBlock`, `JSDocDescriptionLine`, and `JSDocTag`. Might change.
  50. - `jsdocTypeVisitorKeys` - [VisitorKeys](https://github.com/eslint/eslint-visitor-keys)
  51. for `jsdoc-type-pratt-parser`.
  52. - `getTokenizers` - A utility. Might be removed in future.
  53. - `toCamelCase` - A utility. Might be removed in future.
  54. - `hasSeeWithLink` - A utility to detect if a tag is `@see` and has a `@link`
  55. - `defaultNoTypes` = The tags which allow no types by default:
  56. `default`, `defaultvalue`, `see`;
  57. - `defaultNoNames` - The tags which allow no names by default:
  58. `access`, `author`, `default`, `defaultvalue`, `description`, `example`,
  59. `exception`, `license`, `return`, `returns`, `since`, `summary`, `throws`,
  60. `version`, `variation`
  61. ## ESLint AST produced for `comment-parser` nodes (`JsdocBlock`, `JsdocTag`, and `JsdocDescriptionLine`)
  62. Note: Although not added in this package, `@es-joy/jsdoc-eslint-parser` adds
  63. a `jsdoc` property to other ES nodes (using this project's `getJSDocComment`
  64. to determine the specific comment-block that will be attached as AST).
  65. ### `JsdocBlock`
  66. Has two visitable properties:
  67. 1. `tags` (an array of `JsdocTag`; see below)
  68. 2. `descriptionLines` (an array of `JsdocDescriptionLine` for multiline
  69. descriptions).
  70. Has the following custom non-visitable property:
  71. 1. `lastDescriptionLine` - A number
  72. May also have the following non-visitable properties from `comment-parser`:
  73. 1. `description` - Same as `descriptionLines` but as a string with newlines.
  74. 2. `delimiter`
  75. 3. `postDelimiter`
  76. 4. `end`
  77. ### `JsdocTag`
  78. Has three visitable properties:
  79. 1. `parsedType` (the `jsdoc-type-pratt-parser` AST representaiton of the tag's
  80. type (see the `jsdoc-type-pratt-parser` section below)).
  81. 2. `descriptionLines`' (an array of `JsdocDescriptionLine` for multiline
  82. descriptions)
  83. 3. `typeLines` (an array of `JsdocTypeLine` for multiline type strings)
  84. May also have the following non-visitable properties from `comment-parser`
  85. (note that all are included from `comment-parser` except `end` as that is only
  86. for JSDoc blocks and note that `type` is renamed to `rawType`):
  87. 1. `description` - Same as `descriptionLines` but as a string with newlines.
  88. 2. `rawType` - `comment-parser` has this named as `type`, but because of a
  89. conflict with ESTree using `type` for Node type, we renamed it to
  90. `rawType`. It is otherwise the same as in `comment-parser`, i.e., a string
  91. with newlines, though with the initial `{` and final `}` stripped out.
  92. See `typeLines` for the array version of this property.
  93. 3. `start`
  94. 4. `delimiter`
  95. 5. `postDelimiter`
  96. 6. `tag` (this does differ from `comment-parser` now in terms of our stripping
  97. the initial `@`)
  98. 7. `postTag`
  99. 8. `name`
  100. 9. `postName`
  101. 10. `type`
  102. 11. `postType`
  103. ### `JsdocDescriptionLine`
  104. No visitable properties.
  105. May also have the following non-visitable properties from `comment-parser`:
  106. 1. `delimiter`
  107. 2. `postDelimiter`
  108. 3. `start`
  109. 4. `description`
  110. ### `JsdocTypeLine`
  111. No visitable properties.
  112. May also have the following non-visitable properties from `comment-parser`:
  113. 1. `delimiter`
  114. 2. `postDelimiter`
  115. 3. `start`
  116. 4. `rawType` - Renamed from `comment-parser` to avoid a conflict. See
  117. explanation under `JsdocTag`
  118. ## ESLint AST produced for `jsdoc-type-pratt-parser`
  119. The AST, including `type`, remains as is from [jsdoc-type-pratt-parser](https://github.com/simonseyock/jsdoc-type-pratt-parser/).
  120. The type will always begin with a `JsdocType` prefix added, along with a
  121. camel-cased type name, e.g., `JsdocTypeUnion`.
  122. The `jsdoc-type-pratt-parser` visitor keys are also preserved without change.
  123. ## Installation
  124. ```shell
  125. npm i @es-joy/jsdoccomment
  126. ```
  127. ## Changelog
  128. The changelog can be found on the [CHANGES.md](./CHANGES.md).
  129. <!--## Contributing
  130. Everyone is welcome to contribute. Please take a moment to review the [contributing guidelines](CONTRIBUTING.md).
  131. -->
  132. ## Authors and license
  133. [Brett Zamir](http://brett-zamir.me/) and
  134. [contributors](https://github.com/es-joy/jsdoc-eslint-parser/graphs/contributors).
  135. MIT License, see the included [LICENSE-MIT.txt](LICENSE-MIT.txt) file.
  136. ## To-dos
  137. 1. Get complete code coverage