You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can not start app using grpc web due to incorrect eslint errors #7295
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
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(R) Core(TM) 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
Write any react app that imports the file linked in the gist e.g. import {HelloReply, HelloRequest} from './helloworld_pb';
You can make use of this, instantiate the class etc.
See the compilation issue thrown by eslint
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.
changed the title [-]Can not start app using grpc web due to eslint[/-][+]Can not start app using grpc web due to incorrect eslint errors[/+]on Jun 28, 2019
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.
The maintainers are averse to adding more configuration to CRA, especially when there are already multiple ways to handle it. I know it sucks, but I think it'd be smart to try and find another way. no-undef is an incredibly common eslint rule; maybe try lobbying at grpc-web for a flag that adds the ignore line for you.
To be honest I am happy with any fix that would be accepted, those are just the things I could think of. But you think there is nothing that could/would be changed here?
@Globegitter I am suffering from the same issue as well. This is entirely on the CRA team and their position to keep the .eslintignore file from being exposed/supported to the developer.
I can't seem to find any other work around other than what was discussed here. Both parties are going to be pretty stubborn about this.
So, adding that line manually can be tedious if you need an automated solution. What I decided to do was immediately transform the files generated by protoc. You can then have a script in your package.json that executes some Bash code to prepend the required line /* eslint-disable */.
#!/usr/bin/env bash# pb_disable_eslint.sh# you can use it like so:# ./pb_disable-eslint.sh ./my/path/to/proto/dirforFin$(ls -A1 $1)doecho"Prepending file: $F"echo'/* eslint-disable */'| cat - $F> temp && mv temp $Fdone
If you are uncomfortable with the Bash file, you can use glob and the native fs module to modify the output directory of protoc.
This all would have been easier if we could just control our own .eslintignore file just like all the other ignore files.
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.
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 )
Activity
[-]Can not start app using grpc web due to eslint[/-][+]Can not start app using grpc web due to incorrect eslint errors[/+]heyimalex commentedon Jun 28, 2019
The maintainers are averse to adding more configuration to CRA, especially when there are already multiple ways to handle it. I know it sucks, but I think it'd be smart to try and find another way.
no-undefis an incredibly common eslint rule; maybe try lobbying at grpc-web for a flag that adds the ignore line for you.Globegitter commentedon Jun 30, 2019
To be honest I am happy with any fix that would be accepted, those are just the things I could think of. But you think there is nothing that could/would be changed here?
karbica commentedon Jul 12, 2019
@Globegitter I am suffering from the same issue as well. This is entirely on the CRA team and their position to keep the
.eslintignorefile from being exposed/supported to the developer.I can't seem to find any other work around other than what was discussed here. Both parties are going to be pretty stubborn about this.
So, adding that line manually can be tedious if you need an automated solution. What I decided to do was immediately transform the files generated by
protoc. You can then have a script in yourpackage.jsonthat executes some Bash code to prepend the required line/* eslint-disable */.If you are uncomfortable with the Bash file, you can use glob and the native
fsmodule to modify the output directory ofprotoc.This all would have been easier if we could just control our own
.eslintignorefile just like all the other ignore files.Globegitter commentedon 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.
thepont commentedon 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 )
and then modifying the eslintrc to ignore protobuf files.
This was made possible due to a fix in
#6f5221c