Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSDocs can't parse some njs-types #664

Open
ivanitskiy opened this issue Aug 18, 2023 · 0 comments
Open

JSDocs can't parse some njs-types #664

ivanitskiy opened this issue Aug 18, 2023 · 0 comments

Comments

@ivanitskiy
Copy link

We were experimenting with adding JSDocs for nginx-s3-gateway project in this PR nginxinc/nginx-s3-gateway#165. After adding a such configuration:

package.json:

{
  "scripts": {
    "prettier": "prettier --check --write common/etc/nginx/include",
    "eslint": "npx eslint .",
    "docs": "jsdoc -c 'jsdoc.json'"
  },
  "devDependencies": {
    "better-docs": "^2.7.2",
    "jsdoc": "^4.0.2",
    "njs-types": "^0.8",
    "taffydb": "^2.7.3",
    "eslint": "^7.32.0",
    "eslint-config-prettier": "^8.8.0",
    "eslint-plugin-prettier": "^4.2.1",
    "prettier": "^2.8.8"
  }
}

jsdocs.json looks like:

{
    "plugins": [
        "node_modules/better-docs/typescript"
    ],
    "source": {
        "include": ["./common/etc/nginx/include", "./node_modules/njs-types"],
        "includePattern": "\\.(jsx|js|ts|tsx)$",
        "excludePattern": "(^|\\/|\\\\)_"
    },
    "opts": {
        "template": "./node_modules/better-docs",
        "readme": "README.md",
        "verbose": true
    }
}
npm run docs

> docs
> jsdoc -c 'jsdoc.json'

Parsing /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/common/etc/nginx/include/awscredentials.js ...
Parsing /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/common/etc/nginx/include/awssig2.js ...
Parsing /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/common/etc/nginx/include/awssig4.js ...
Parsing /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/common/etc/nginx/include/s3gateway.js ...
Parsing /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/common/etc/nginx/include/utils.js ...
Parsing /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/node_modules/njs-types/index.d.ts ...
Parsing /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/node_modules/njs-types/ngx_core.d.ts ...
ERROR: Unable to parse a tag's type expression for source file /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/node_modules/njs-types/ngx_core.d.ts in line 60 with tag title "type" and text "{V extends number,      ? (key: string, delta: V, init?: number) => number,      : never}": Invalid type expression "V extends number,      ? (key: string, delta: V, init?: number) => number,      : never": Expected "|" but "e" found.
Parsing /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/node_modules/njs-types/ngx_http_js_module.d.ts ...
Parsing /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/node_modules/njs-types/ngx_stream_js_module.d.ts ...
Parsing /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/node_modules/njs-types/njs_core.d.ts ...
ERROR: Unable to parse /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/node_modules/njs-types/njs_core.d.ts: Missing semicolon. (154:22)
Parsing /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/node_modules/njs-types/njs_shell.d.ts ...
Parsing /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/node_modules/njs-types/njs_webapi.d.ts ...
Parsing /Users/ivanitskiy/go/src/github.com/nginxinc/nginx-s3-gateway/node_modules/njs-types/njs_webcrypto.d.ts ...
Generating output files...
Finished running in 1.07 seconds.

Not sure where the issue is, but creating a topic here to track it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant