From 9797007d3b293518ad66889f29ce320df7797334 Mon Sep 17 00:00:00 2001 From: Puyodead1 Date: Sun, 30 Apr 2023 16:56:03 -0400 Subject: [PATCH] lint --- .eslintrc | 5 +++-- src/components/DOBInput.tsx | 2 +- src/components/HCaptcha.tsx | 2 +- src/components/Icon.tsx | 1 - src/pages/RegistrationPage.tsx | 12 ++++++------ src/stores/AccountStore.ts | 8 ++++---- src/stores/GatewayConnectionStore.ts | 5 +++-- src/stores/objects/User.ts | 8 ++++---- src/utils/interfaces/common.ts | 1 + src/utils/messageFromFieldError.ts | 1 + 10 files changed, 24 insertions(+), 21 deletions(-) diff --git a/.eslintrc b/.eslintrc index 40eac13..faebf5a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -5,8 +5,9 @@ "root": true, "rules": { "no-mixed-spaces-and-tabs": "off", - "@typescript-eslint/no-inferrable-types": "off", // Required by typeorm - "@typescript-eslint/no-var-requires": "off" // Sometimes requred by typeorm to resolve circular deps + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-unused-vars": "off" }, "env": { "node": true diff --git a/src/components/DOBInput.tsx b/src/components/DOBInput.tsx index 282fc57..c30b198 100644 --- a/src/components/DOBInput.tsx +++ b/src/components/DOBInput.tsx @@ -107,7 +107,7 @@ export class DOBInput extends Component { }, }; - componentDidUpdate(prevProps: any, prevState: any) { + componentDidUpdate(prevProps: Props, prevState: State) { if (prevState !== this.state) { this.props.onErrorChange(this.state.errors); diff --git a/src/components/HCaptcha.tsx b/src/components/HCaptcha.tsx index 4857255..37fdcef 100644 --- a/src/components/HCaptcha.tsx +++ b/src/components/HCaptcha.tsx @@ -55,7 +55,7 @@ interface Props { captchaRef: React.RefObject; onLoad?: () => void; onChalExpired?: () => void; - onError?: (e: any) => void; + onError?: (e: unknown) => void; onExpire?: () => void; onVerify?: (token: string) => void; } diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx index 1bdc4cd..183bc1b 100644 --- a/src/components/Icon.tsx +++ b/src/components/Icon.tsx @@ -21,7 +21,6 @@ function Icon(props: IconProps) { }, }); - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { iconName, ...propSpread } = props; return ; } diff --git a/src/pages/RegistrationPage.tsx b/src/pages/RegistrationPage.tsx index 53d0cfc..66dc138 100644 --- a/src/pages/RegistrationPage.tsx +++ b/src/pages/RegistrationPage.tsx @@ -56,11 +56,11 @@ const Header = styled.h1` color: var(--text); `; -const SubHeader = styled.h2` - color: var(--text-muted); - font-weight: 400; - font-size: 16px; -`; +// const SubHeader = styled.h2` +// color: var(--text-muted); +// font-weight: 400; +// font-size: 16px; +// `; const FormContainer = styled.form` width: 100%; @@ -164,7 +164,7 @@ function RegistrationPage() { clearErrors, } = useForm(); - const dobRegister = register("date_of_birth", { + const _ = register("date_of_birth", { required: true, pattern: /^\d{4}-\d{2}-\d{2}$/, }); diff --git a/src/stores/AccountStore.ts b/src/stores/AccountStore.ts index e52f577..758ba87 100644 --- a/src/stores/AccountStore.ts +++ b/src/stores/AccountStore.ts @@ -12,10 +12,10 @@ export default class AccountStore { @observable avatar: string | null; @observable avatarDecoration?: unknown; @observable email: string | null = null; - @observable verified: boolean = false; - @observable bot: boolean = false; - @observable system: boolean = false; - @observable mfaEnabled: boolean = false; + @observable verified = false; + @observable bot = false; + @observable system = false; + @observable mfaEnabled = false; @observable premiumType?: | UserPremiumType.NitroClassic | UserPremiumType.Nitro diff --git a/src/stores/GatewayConnectionStore.ts b/src/stores/GatewayConnectionStore.ts index 8307aef..4000cf0 100644 --- a/src/stores/GatewayConnectionStore.ts +++ b/src/stores/GatewayConnectionStore.ts @@ -47,8 +47,8 @@ export default class GatewayConnectionStore { private dispatchHandlers: Map = new Map(); private connectionStartTime?: number; private identifyStartTime?: number; - private sequence: number = 0; - private heartbeatAck: boolean = true; + private sequence = 0; + private heartbeatAck = true; private lazyRequestChannels = new Map(); // guild, channels constructor(app: AppStore) { @@ -154,6 +154,7 @@ export default class GatewayConnectionStore { this.handleIdentify(); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any private onmessage = (e: MessageEvent) => { const payload: GatewayReceivePayload = JSON.parse(e.data); if (payload.op !== GatewayOpcodes.Dispatch) { diff --git a/src/stores/objects/User.ts b/src/stores/objects/User.ts index 8b59795..b025479 100644 --- a/src/stores/objects/User.ts +++ b/src/stores/objects/User.ts @@ -13,11 +13,11 @@ export default class User { @observable username: string; @observable discriminator: string; @observable avatar: string | null; - @observable bot: boolean = false; - @observable public_flags: number = 0; - @observable bio: string = ""; + @observable bot = false; + @observable public_flags = 0; + @observable bio = ""; @observable premium_since: string | null = null; - @observable premium_type: number = 0; + @observable premium_type = 0; @observable accent_color: unknown | null; @observable pronouns?: string; @observable theme_colors?: unknown; diff --git a/src/utils/interfaces/common.ts b/src/utils/interfaces/common.ts index 749996f..99c246b 100644 --- a/src/utils/interfaces/common.ts +++ b/src/utils/interfaces/common.ts @@ -2,6 +2,7 @@ export type OneKeyFrom< T, M = object, K extends keyof T = keyof T, + // eslint-disable-next-line @typescript-eslint/no-explicit-any > = K extends any ? M & Pick, K> & diff --git a/src/utils/messageFromFieldError.ts b/src/utils/messageFromFieldError.ts index b937fd0..4a5deb1 100644 --- a/src/utils/messageFromFieldError.ts +++ b/src/utils/messageFromFieldError.ts @@ -24,6 +24,7 @@ export function messageFromFieldError( return r ? { field: prevKey, error: r.message } : null; } if (typeof obj === "object") { + // eslint-disable-next-line @typescript-eslint/no-explicit-any return messageFromFieldError(obj as any, key); } }