-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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 display source file for conflicting fields types? #22016
Comments
Hi @henricazottes ! Thanks for this question. This sounds like a reasonable thing to have. The PR you linked is for Gatsby v1. But I did some digging and looks like we stopped displaying the source after #16091. There is actually this comment: https://github.com/gatsbyjs/gatsby/pull/16091/files#r316047900 which hints that it is probably possible to restore this behavior. @freiksenet Do you remember why it was removed in the first place? Given what I see We'll be happy to accept a PR for this change 💜 Feel free to ping me for any help or advice if you decide to tackle it! |
Interesting! On my part I've found that prepareConfilctExample never returns any parent: return {
type: typeNameMapper(type),
value: reportedValueMapper(type),
} And as the description is found in the parent (see addExample): addExample({
value,
type,
parent
}) {
this.types.set(type, {
value,
description: findNodeDescription(parent)
});
} I guess it explains why it's not displayed. However we do have access to // descriptor
{
"string": {
"total": 1103,
"first": "31b3aa77-7e13-5954-82b7-6661162f20d6",
"example": "sans date",
"empty": 2,
}
} With that and the @vladar if you give me some directions it would be a pleasure to make a PR :) |
If @freiksenet gives a good reason why it was removed it would mean that this behavior cannot be restored easily? |
You're right, I'll wait for his answer before investigating more |
@henricazottes You are right about The implementation of this function still exists here but it is not easily accessible from type conflict reporter anymore. I suspect it was the main reason for the change. So you will probably have to re-implement it using node store directly. I would suggest putting this new implementation in the utils folder for now as a standalone utility function. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Thanks again for being part of the Gatsby community! 💪💜 |
Hi,
When building my site containing a lot of
.md
files full of frontmatter, I get warnings about conflicting field types. This is a valuable information, but it's missing one thing: which files are conflicting.I've seen this conversation here where you can see screenshots with the path to the source file.
But for me
source
is not showing up.Digging a little where the message is actually prompted, I've found that the source line is displayed only if the node has a description:
type-conflict-reporter.js
I've quickly looked around but didn't find what is this description. On the node interface documentation page no sign of it.
I think adding this description is not the way to go, but I'm missing leads.
Any suggestion how to proceed?
The text was updated successfully, but these errors were encountered: