Skip to content

Commit

Permalink
update eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
pokornyd committed Aug 19, 2024
1 parent d8d9674 commit ba0cb1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@
],
"parserOptions": {
"project": ["tsconfig.json", "tsconfig.test.json"]
},
"rules": {
// I prefer union types of literals with string for brevity
"@typescript-eslint/no-redundant-type-constituents": "warn"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ export const transformToPortableText = (parsedTree: ParseResult): PortableTextOb
const handleLinks = (mergedItems: PortableTextItem[], linkItem: PortableTextLink) => {
const lastBlock = mergedItems.findLast((item): item is PortableTextStrictBlock => item._type === "block");

lastBlock
? (lastBlock.markDefs ||= []).push(linkItem)
: mergedItems.push(createBlock(randomUUID(), [linkItem]));
if (lastBlock) {
(lastBlock.markDefs ||= []).push(linkItem);
} else {
mergedItems.push(createBlock(randomUUID(), [linkItem]));
}
};

/**
Expand Down

0 comments on commit ba0cb1e

Please sign in to comment.