Skip to content

Commit 565c6ed

Browse files
committed
Activate eslint no-non-null-asserted-optional-chain
Turn on the eslint rule no-non-null-asserted-optional-chain
1 parent 9ea77b3 commit 565c6ed

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

eslint.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export default [
2323
"@typescript-eslint/no-explicit-any": "off",
2424
"@typescript-eslint/no-floating-promises": "off",
2525
"@typescript-eslint/no-misused-promises": "off",
26-
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
2726
"@typescript-eslint/no-unsafe-argument": "off",
2827
"@typescript-eslint/no-unsafe-assignment": "off",
2928
"@typescript-eslint/no-unsafe-call": "off",

src/components/shared/Tooltip.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,14 @@ export const Tooltip = (
3939
areaRef.current?.getBoundingClientRect().width,
4040
0,
4141
);
42-
default:
43-
return areaRef.current?.getBoundingClientRect()!;
42+
default: {
43+
const rect = areaRef.current?.getBoundingClientRect();
44+
if (!rect) {
45+
return new DOMRect();
46+
} else {
47+
return rect;
48+
}
49+
}
4450
}
4551
};
4652

0 commit comments

Comments
 (0)