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

Migrating a create-react-app to use Bazel fails due to conflicting eslint configs #3617

Closed
orblix opened this issue Jan 11, 2023 · 2 comments
Labels
bug Can Close? We will close this in 30 days if there is no further activity

Comments

@orblix
Copy link

orblix commented Jan 11, 2023

What happened?

I created a react app using the create-react-app script in a package in my repo.

The package is a sub directory (i.e. there's no WORKSPACE file there).

I'm trying to make it work but I'm getting the following error when running with yarn start:

Failed to compile.

[eslint] Plugin "react" was conflicted between "package.json » eslint-config-react-app » /home/enzer/.cache/bazel/_bazel_enzer/055b3f42459170ac9ed7445962c97212/execroot/__main__/bazel-out/k8-fastbuild/bin/package/start.sh.runfiles/__main__/package/node_modules/eslint-config-react-app/base.js" and "BaseConfig » /home/enzer/.cache/bazel/_bazel_enzer/055b3f42459170ac9ed7445962c97212/execroot/__main__/bazel-out/k8-fastbuild/bin/package/start.sh.runfiles/__main__/node_modules/eslint-config-react-app/base.js".
ERROR in [eslint] Plugin "react" was conflicted between "package.json » eslint-config-react-app » /home/enzer/.cache/bazel/_bazel_enzer/055b3f42459170ac9ed7445962c97212/execroot/__main__/bazel-out/k8-fastbuild/bin/package/start.sh.runfiles/__main__/package/node_modules/eslint-config-react-app/base.js" and "BaseConfig » /home/enzer/.cache/bazel/_bazel_enzer/055b3f42459170ac9ed7445962c97212/execroot/__main__/bazel-out/k8-fastbuild/bin/package/start.sh.runfiles/__main__/node_modules/eslint-config-react-app/base.js".

webpack compiled with 1 error
No issues found.

If I delete the eslintConfig section from my package.json, it seems everything is working properly.

How can I make it work with the eslintConfig?

🔬 Minimal Reproduction

  • Create react app using: npx create-react-app package --template typescript
  • Add the following to the WORKSPACE file:
http_archive(
    name = "build_bazel_rules_nodejs",
    sha256 = "dcc55f810142b6cf46a44d0180a5a7fb923c04a5061e2e8d8eb05ccccc60864b",
    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.0/rules_nodejs-5.8.0.tar.gz"],
)

load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")

build_bazel_rules_nodejs_dependencies()

load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")

yarn_install(
    # Name this npm so that Bazel Label references look like @npm//package
    name = "npm",
    exports_directories_only = True,
    frozen_lockfile = False,
    package_json = "//package:package.json",
    yarn_lock = "//package:yarn.lock",
)
  • Copy BUILD file from example to the package
  • Add web-vitals as a runtime dependency in the BUILD file
  • Add ./ to all targets' args so they are in the form "--node_options=--require=./$(rootpath chdir.js)"
  • Run generated app using yarn start

Version

Development (host) and target OS/architectures:
Linux or-workstation 5.10.0-20-cloud-amd64 #1 SMP Debian 5.10.158-2 (2022-12-13) x86_64 GNU/Linux

Output of bazel --version:
bazel 6.0.0-pre.20221020.1

Version of rules_nodejs, or other relevant rules from your
WORKSPACE or MODULE.bazel file:
5.8.0

Language(s) and/or frameworks involved:
react

How to reproduce

No response

Any other information?

No response

@orblix orblix added the bug label Jan 11, 2023
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had any activity for 6 months. It will be closed if no further activity occurs in 30 days. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

@github-actions github-actions bot added the Can Close? We will close this in 30 days if there is no further activity label Jul 14, 2023
@github-actions
Copy link

This issue was automatically closed because it went 30 days without any activity since it was labeled "Can Close?"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Can Close? We will close this in 30 days if there is no further activity
Projects
None yet
Development

No branches or pull requests

1 participant