-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
standardize diagram definitions #4499
Comments
I've more thoughts: Files
Structure
Please let me know if you approve the below and above suggestion so I can the original issue, or you could change it right away. |
And shouldn't better to move types in |
All the suggestions look great to me. |
Great! Could you add labels to the issue? i.e, And do you have something in your mind on behave of separating It's not clean to do the the following: const width = config?.pie?.useWidth; |
Yes, getConfig should not have optionals. But we have to make sure to do it properly (without forced type assertion if possible), so that we get compile time errors if there is no default value for a config. |
One possible approach is using export const DEFAULT_PIE_CONFIG: Required<PieDiagramConfig> = {
useMaxWidth: true,
useWidth: 1200,
textPosition: 0.75,
} as const; By doing this, it well force to set all values of the type, even optional one. Theoretically, it will always shows that it defined. And we could use What do you think? I'll update the top message with suggested stuff in here #4499 (comment) with this if all of them have been approved. |
It would be great if we standardized diagram keywords, because some diagrams just have the actual keyword:
And some have additional word:
I think this addition wouldn't really help; it's just making the keyword longer. |
And maybe add
The number of files related to rendering is kinda large in number and size, specially What do you think? |
Please consider the comments marked with 👍 as me agreeing personally, not as an official approval of any sorts. |
Did we mention integration specs here? |
It might be better to mention in the script that generate new diagram, because I think this is related to definition itself, not all files related to diagram. |
I have noticed that the name of the file contains diagram name as well ( Share your thoughts on (informative, excessive)
versus (less informative, but very string and uniform)
|
IMO, the full form (informative) form is better because we can refer to diagram files directly rather than in the short form, and here are some reasons why: But I agree with moving |
It might be better to add new file called |
Didn't get your idea about defaults folder. There are too many things that can be called "default", so I'll try to sort things through:
|
Just a typo :), my intention was a file. A file within diagram folder. |
Fully agree with that |
I am aligning closer to the naming convention suggested by @nirname. Our editors are smart enough to detect |
Then should we rename files in #4727 for parser package? |
I don't think that's necessary right now. We can discuss and decide later and do a single PR to implement the decision. |
Most of these rules were discussed in this PR #4486, but it became kind of messy with commits and reviews, so we're going to summarize them here (and update them continuously):
*.js
files aren't allowed; use*.ts
instead.try not to use
// @ts-*
comments, but if you have, please add a description showing the problem. i.e.:try not to use default imports/exports, use named one.
use types instead of
any
.General Diagram Definition
contains one variable that exports the following:
The text was updated successfully, but these errors were encountered: