Skip to content

Commit e551d4e

Browse files
committed
🚨 Fix non-null-assertion warnings
1 parent bcfff01 commit e551d4e

File tree

6 files changed

+5
-6
lines changed

6 files changed

+5
-6
lines changed

.eslintrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"react/react-in-jsx-scope": "off",
2323
"react/no-unescaped-entities": 0,
2424
"camelcase": "error",
25-
"@typescript-eslint/no-non-null-assertion": "off",
2625
"no-duplicate-imports": "error",
2726
"@typescript-eslint/no-unused-vars": "error",
2827
"react/prop-types": 0,

src/components/commands/Clear.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { termContext } from "../Terminal";
55
const Clear: React.FC = () => {
66
const { arg, clearHistory } = useContext(termContext);
77
useEffect(() => {
8-
if (arg.length < 1) clearHistory!();
8+
if (arg.length < 1) clearHistory?.();
99
}, []);
1010
return arg.length > 0 ? <UsageDiv>Usage: clear</UsageDiv> : <></>;
1111
};

src/components/commands/Help.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const Help: React.FC = () => {
1414
{commands.map(({ cmd, desc, tab }) => (
1515
<CmdList key={cmd}>
1616
<Cmd>{cmd}</Cmd>
17-
{generateTabs(tab!)}
17+
{generateTabs(tab)}
1818
<CmdDesc>- {desc}</CmdDesc>
1919
</CmdList>
2020
))}

src/components/commands/Socials.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const Socials: React.FC = () => {
4040
{socials.map(({ id, title, url, tab }) => (
4141
<CmdList key={title}>
4242
<Cmd>{`${id}. ${title}`}</Cmd>
43-
{generateTabs(tab!)}
43+
{generateTabs(tab)}
4444
<CmdDesc>- {url}</CmdDesc>
4545
</CmdList>
4646
))}

src/components/commands/Themes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const Themes: React.FC = () => {
1919
/* ===== check current command makes redirect ===== */
2020
useEffect(() => {
2121
if (checkThemeRedirect(arg, rerender, currentCommand, myThemes)) {
22-
themeSwitcher!(theme[currentCommand[2]]);
22+
themeSwitcher?.(theme[currentCommand[2]]);
2323
}
2424
}, [arg, rerender, currentCommand]);
2525

src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from "react";
22
import ReactDOM from "react-dom/client";
33
import App from "./App";
44

5-
ReactDOM.createRoot(document.getElementById("root")!).render(
5+
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
66
<React.StrictMode>
77
<App />
88
</React.StrictMode>

0 commit comments

Comments
 (0)