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

TypeError when using swagger-jsdoc with lint-staged installed #395

Open
aruberutochan opened this issue Apr 13, 2024 · 0 comments
Open

TypeError when using swagger-jsdoc with lint-staged installed #395

aruberutochan opened this issue Apr 13, 2024 · 0 comments

Comments

@aruberutochan
Copy link

Describe the bug
Encountering a TypeError when trying to use the swagger-jsdoc library in a project where lint-staged is also installed. The error occurs during the execution of the project, specifically when building the Swagger specification files. The error does not appear when lint-staged is uninstalled.
This is the error that i see:

/home/aruberuto/projects/comuncity/code/swagger-jsdoc-lint-staged/node_modules/swagger-jsdoc/src/specification.js:187
YAML.defaultOptions.keepCstNodes = true;
^
TypeError: Cannot set properties of undefined (setting 'keepCstNodes')
at build (/home/aruberuto/projects/comuncity/code/swagger-jsdoc-lint-staged/node_modules/swagger-jsdoc/src/specification.js:187:36)
at module.exports (/home/aruberuto/projects/comuncity/code/swagger-jsdoc-lint-staged/node_modules/swagger-jsdoc/src/lib.js:32:10)
at Object.<anonymous> (/home/aruberuto/projects/comuncity/code/swagger-jsdoc-lint-staged/src/index.ts:14:26)

To Reproduce the error with lint-staged

  1. Clone the repository from this link.
  2. Install dependencies using npm install.
  3. Run the project with npm start.
  4. You should see the error in the terminal.

No error after removing lint-staged

  1. Clone the repository from this link.
  2. Install dependencies using npm install.
  3. Remove lint-staged using npm remove lint-staged
  4. Run the project with npm start.
  5. You should see the log in the terminal with the generated documentation in json.

Expected behavior
The project should start without errors when using the lint-staged library, and the Swagger documentation should be built successfully.

Desktop:

  • OS: Pop!_OS 22.04 LTS
  • Node version: v20.9.0
  • npm version: 10.2.24
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