-
Notifications
You must be signed in to change notification settings - Fork 135
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
How to show errors in vscode or other editor when macro is throwing MacroError or buildCodeFrameError? #169
Comments
Well the only way for the IDE to report an error would be for the IDE to know enough to try running the macro, which really would mean looking up the babel config and attempting to transpile the file with babel. I don't see that vscode has any plugins that do this, and so I assume other editors don't have such a thing either. But! As it so happens, I've been working on something that could fulfill your use case: the macrome build system. It's not done yet, but an initial version will be ready soon. The idea is that it watches the files in your repo and then does certain actions based on rules. E.g. you could set it up so that |
In case @kentcdodds is reading, this is why I'm putting in the effort to help support macros. I hope the build system will help them be useful for more things. It was also born of my belief that transpiled code is your product: it should be checked into source control, it should be available for static analysis, and it should be possible to understand it (even if it's a bit verbose). I think this will gain a lot more traction as we start using es6 as a transpilation target instead of es5. |
Sounds interesting! Thank you for your support and work! |
babel-plugin-macros
version: ^3.0.1node
version: v12.16.3npm
version: 6.14.4Relevant code or config
What you did:
I tried this macro on another create-react-app.
What happened:
This macro error was only available when app was started or build.
Problem description:
Error was not shown on vscode. The macro I am building is a little bit complex so I am asserting errors at the early stages.
MacroError
? Can this be used in to do that?buildCodeFrameError
which gave some context where error is happening. Not in the IDE, but at time of compilation. So which one should be used?Suggested solution:
None
The text was updated successfully, but these errors were encountered: