question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not start app using grpc web due to incorrect eslint errors

See original GitHub issue

Desribe the bug

I am creating a react app with grpc-web: https://github.com/grpc/grpc-web

Following the steps described here https://github.com/grpc/grpc-web#how-it-works it generates code for you from the .proto files. If one has a helloworld.proto it would generate a helloworld_pb.js file. The file it generates confuses eslint and throws a bunch of no-undef errors which fails the build. If I manually add /* eslint disable no-undef */ to the generated file the App works as expected with grpc-web

Here is the generated file that is causing issues for me: https://gist.github.com/Globegitter/c53de0ba359cea1b2cc7c7cdfb0ac491

I do not want to add the eslint comment there because the file can be regenerated at any time and it also tells you to not manually edit the file.

Did you try recovering your dependencies?

Yep

Which terms did you search for in User Guide?

lint eslint

Environment

Environment Info:

System: OS: Linux 4.15 elementary OS 5.0 Juno (Ubuntu 18.04) CPU: (8) x64 Intel® Core™ i7-7700HQ CPU @ 2.80GHz Binaries: Node: 10.16.0 - /usr/bin/node Yarn: 1.16.0 - /usr/bin/yarn npm: 6.9.0 - /usr/bin/npm Browsers: Chrome: 75.0.3770.100 Firefox: Not Found npmPackages: react: ^16.8.6 => 16.8.6 react-dom: ^16.8.6 => 16.8.6 react-scripts: 3.0.1 => 3.0.1 npmGlobalPackages: create-react-app: Not Found

Steps to reproduce

  1. Write any react app that imports the file linked in the gist e.g. import {HelloReply, HelloRequest} from './helloworld_pb';
  2. You can make use of this, instantiate the class etc.
  3. See the compilation issue thrown by eslint
  4. Add the eslint disable command and see that all works fine as expected

Note: I am using react with typescript here btw, but don’t think that makes any difference here.

Expected behavior

Give me some way to ignore specific files/directories from being linted, or give me an option turn errors into warnings so I can choose to ignore false positives.

Actual behavior

image

Reproducible demo

https://github.com/Globegitter/react-grpc-web

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
thepontcommented, Dec 8, 2019

Just had this issue was well and opted for changing the scripts in the package.json as such. ( this tells the react script to not ignore your changes to the eslint config. ( perplexing that this isn’t the default )

  "scripts": {
    "start": "EXTEND_ESLINT=true react-scripts start",
    "build": "EXTEND_ESLINT=true react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  }

and then modifying the eslintrc to ignore protobuf files.

  "eslintConfig": {
    "extends": "react-app",
    "overrides" : [
      {
     	  "files": "**/*.js",
          "excludedFiles": "**/*_pb.js"
      }
    ]
  }

This was made possible due to a fix in #6f5221c

0reactions
Globegittercommented, Jul 12, 2019

Yeah, I came up with a similar solution in the end - we are just using a gradle task in combination with https://github.com/google/protobuf-gradle-plugin for it. Would be nice to have something more permanent but at least it is workable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

My create-react-app is failing to compile due to ESLint error
This issue has been fixed in the react-scipts:"4.0.3" but, the eslint errors present in the project are not converted to warnings by default....
Read more >
Using GRPC with TLS, Golang and React (No Envoy)
A tutorial where we learn how to use gRPC with WebClients without a reverse proxy such as Envoy or Traefik.
Read more >
grpc/grpc - Gitter
My question is on how to organize the exception handling on stream cases, especially bi-di... I have the following example that I don't...
Read more >
Changelog | Finsemble
We've upgraded Finsemble's internal representation of apps from the FDC3 1.2 ... This hides harmless but annoying "for build dependencies doesn't lead to ......
Read more >
IntelliJ IDEA 2022.1 EAP (221.5591.9 build) Release Notes
No subsystem Bug IDEA‑292692 No subsystem Feature IDEA‑128817 No subsystem Bug IDEA‑291790 No subsystem Bug IDEA‑288930
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found