Skip to content

Commit

Permalink
Clean warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic-tingaud-sonarsource authored Dec 22, 2023
1 parent 1012001 commit a1090dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/RulePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,14 @@ function useDescription(metadata: PageMetadata, ruleid: string, language?: strin
`https://github.com/SonarSource/rspec/blob/${metadata.branch}/rules/${ruleid}${language ? '/' + language : ''}`;

function htmlReplacement(domNode: Element) {
if (domNode.name === 'a' && domNode.attribs && domNode.attribs['data-rspec-id']) {
if (domNode.name === 'a' && domNode.attribs?.['data-rspec-id']) {
const props = attributesToProps(domNode.attribs);
return <a href={getRspecPath(domNode.attribs['data-rspec-id'], language)} {...props}>
{domToReact(domNode.children)}
</a>;
}

if (domNode.name === 'code' && domNode.attribs && domNode.attribs['data-lang']) {
if (domNode.name === 'code' && domNode.attribs?.['data-lang']) {
return <Highlight className={domNode.attribs['data-lang']}>
{domToReact(domNode.children)}
</Highlight>;
Expand Down

0 comments on commit a1090dc

Please sign in to comment.