Skip to content
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

feat(playground): document tree rendering #52

Merged
merged 10 commits into from
Nov 16, 2023
Merged

Conversation

neSpecc
Copy link
Contributor

@neSpecc neSpecc commented Nov 15, 2023

Now we have a base Editor Document tree rendering

image

Copy link

github-actions bot commented Nov 15, 2023

Coverage report for ./packages/model

St.
Category Percentage Covered / Total
🟢 Statements 100% 579/579
🟢 Branches 99.26% 135/136
🟢 Functions
99.32% (+0.01% 🔼)
145/146
🟢 Lines 100% 555/555

Test suite run success

338 tests passing in 18 suites.

Report generated by 🧪jest coverage report action from 8ad3a1f

Copy link

github-actions bot commented Nov 15, 2023

✅ Mutation testing passed

Report: https://dashboard.stryker-mutator.io/reports/github.com/editor-js/document-model/PR-52

Mutated files
src/utils/DeepReadonly.ts
src/entities/BlockNode/index.ts
src/entities/EditorDocument/index.ts
src/entities/ValueNode/index.ts

/**
* Allows accessing Block data
*/
public get data(): BlockNodeData {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make the return type readonly (would be nice to check if it works for nested structures as well)

/**
* Returns the data associated with this value node.
*/
public get value(): ValueType {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also should be readonly as it could be array/object

*
* @param value - The value to check
*/
function isObject(value: unknown): value is object {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be extracted to a separate function

*/
export type DeepReadonly<T> =
T extends (infer R)[] ? DeepReadonlyArray<R> :
// eslint-disable-next-line @typescript-eslint/ban-types
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this if you use (...args: unknown[]) => unknown instead of Function

Comment on lines 33 to 38
return Object.entries(descriptors).filter(([name, descriptor]) => {
return descriptor.get !== undefined;
})
.map(([ name ]) => {
return name as keyof typeof props.node;
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some formatting could be applied here

@neSpecc neSpecc added this pull request to the merge queue Nov 15, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Nov 15, 2023
@neSpecc neSpecc added this pull request to the merge queue Nov 16, 2023
Merged via the queue into main with commit 241e5f4 Nov 16, 2023
5 checks passed
@neSpecc neSpecc deleted the feat/playground-tree branch November 16, 2023 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants