Socket
Socket
Sign inDemoInstall

@es-joy/jsdoccomment

Package Overview
Dependencies
4
Maintainers
1
Versions
94
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.1 to 0.4.2

.github/workflows/node.js.yml

17

CHANGES.md
# CHANGES for `@es-joy/jsdoccomment`
## 0.4.2
- Fix: Ensure replacement of camel-casing (used in `jsdoctypeparser` nodes and
visitor keys is global. The practical effect is that
`JSDocTypeNamed_parameter` -> `JSDocTypeNamedParameter`,
`JSDocTypeRecord_entry` -> `JSDocTypeRecordEntry`
`JSDocTypeNot_nullable` -> `JSDocTypeNotNullable`
`JSDocTypeInner_member` -> `JSDocTypeInnerMember`
`JSDocTypeInstance_member` -> `JSDocTypeInstanceMember`
`JSDocTypeString_value` -> `JSDocTypeStringValue`
`JSDocTypeNumber_value` -> `JSDocTypeNumberValue`
`JSDocTypeFile_path` -> `JSDocTypeFilePath`
`JSDocTypeType_query` -> `JSDocTypeTypeQuery`
`JSDocTypeKey_query` -> `JSDocTypeKeyQuery`
- Fix: Add missing `JSDocTypeLine` to visitor keys
- Docs: Explain AST structure/differences
## 0.4.1

@@ -4,0 +21,0 @@

9

package.json
{
"name": "@es-joy/jsdoccomment",
"version": "0.4.1",
"version": "0.4.2",
"author": "Brett Zamir <brettz9@yahoo.com>",

@@ -18,2 +18,9 @@ "contributors": [],

},
"c8": {
"checkCoverage": true,
"branches": 100,
"statements": 100,
"lines": 100,
"functions": 100
},
"browserslist": [

@@ -20,0 +27,0 @@ "cover 100%"

# @es-joy/jsdoccomment
[![Node.js CI status](https://github.com/brettz9/getJSDocComment/workflows/Node.js%20CI/badge.svg)](https://github.com/brettz9/getJSDocComment/actions)
This project aims to preserve and expand upon the

@@ -21,2 +23,90 @@ `SourceCode#getJSDocComment` functionality of the deprecated ESLint method.

## ESLint AST produced for `comment-parser` nodes (`JSDocBlock`, `JSDocTag`, and `JSDocDescriptionLine`)
### `JSDocBlock`
Has two visitable properties:
1. `tags` (an array of `JSDocTag`; see below)
2. `descriptionLines` (an array of `JSDocDescriptionLine` for multiline
descriptions).
Has the following custom non-visitable property:
1. `lastDescriptionLine` - A number
May also have the following non-visitable properties from `comment-parser`:
1. `description` - Same as `descriptionLines` but as a string with newlines.
2. `delimiter`
3. `end`
4. `postDelimiter`
### `JSDocTag`
Has three visitable properties:
1. `parsedType` (the `jsdoctypeparser` AST representaiton of the tag's
type (see the `jsdoctypeparser` section below)).
2. `descriptionLines`' (an array of `JSDocDescriptionLine` for multiline
descriptions)
3. `typeLines` (an array of `JSDocDescriptionLine` for multiline type
strings)
May also have the following non-visitable properties from `comment-parser`
(note that all are included from `comment-parser` except `end` as that is only
for JSDoc blocks and note that `type` is renamed to `rawType`):
1. `description` - Same as `descriptionLines` but as a string with newlines.
2. `rawType` - `comment-parser` has this named as `type`, but because of a
conflict with ESTree using `type` for Node type, we renamed it to
`rawType`. It is otherwise the same as in `comment-parser`, i.e., a string
with newlines, though with the initial `{` and final `}` stripped out.
See `typeLines` for the array version of this property.
3. `start`
4. `delimiter`
5. `postDelimiter`
6. `tag`
7. `postTag`
8. `name`
9. `postName`
10. `type`
11. `postType`
### `JSDocDescriptionLine`
No visitable properties.
May also have the following non-visitable properties from `comment-parser`:
1. `delimiter`
2. `postDelimiter`
3. `start`
4. `description`
### `JSDocTypeLine`
No visitable properties.
May also have the following non-visitable properties from `comment-parser`:
1. `delimiter`
2. `postDelimiter`
3. `start`
4. `rawType` - Renamed from `comment-parser` to avoid a conflict. See
explanation under `JSDocTag`
## ESLint AST produced for `jsdoctypeparser`
The `type` has been changed for the type AST. Relative to `jsdoctypeparser`
nodes, the type will have a `JSDocType` prefix added plus a camel-casing of the
old type name, so, e.g., `INSTANCE_MEMBER` will become
`JSDocTypeInstanceMember`.
See [jsdoctypeparser](https://github.com/jsdoctypeparser/jsdoctypeparser)
for the current list of node types which are transformed in this manner.
Otherwise, the node properties are as in `jsdoctypeparser`.
The `jsdoctypeparser` visitor keys are also modified accordingly.
## Installation

@@ -23,0 +113,0 @@

@@ -143,2 +143,3 @@ import {parse as jsdoctypeParse} from 'jsdoctypeparser';

JSDocDescriptionLine: [],
JSDocTypeLine: [],
JSDocTag: ['descriptionLines', 'typeLines', 'parsedType']

@@ -145,0 +146,0 @@ };

2

src/toCamelCase.js
const toCamelCase = (str) => {
return str.toLowerCase().replace(/^[a-z]/u, (init) => {
return str.toLowerCase().replace(/^[a-z]/gu, (init) => {
return init.toUpperCase();

@@ -4,0 +4,0 @@ }).replace(/_(?:<wordInit>[a-z])/u, (_, n1, o, s, {wordInit}) => {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc