fix few lint warnings

This commit is contained in:
Aarni Halinen
2021-03-28 22:55:51 +03:00
parent e256f93c7d
commit 78a61b934e
9 changed files with 18 additions and 24 deletions
@@ -5,7 +5,7 @@ import { WidgetProps } from "react-jsonschema-form";
import MarkdownStyles from "@views/common/MarkdownStyles";
type MarkdownEditorWidgetProps = Omit<WidgetProps, "options"> & {
options: any;
options: unknown;
};
const Container = styled.div`
@@ -13,7 +13,6 @@ const getIconByLabel = (label: string) => {
if (label === "English") {
return <Icon name={IconType.GBFlag} />;
}
console.error(`No icon found for label: ${label}`);
return null;
};
@@ -46,7 +46,6 @@ class OptionsWidget extends React.Component<OptionsWidgetProps> {
handleRequiredChange = (questions: Question[], index: number): React.ChangeEventHandler<HTMLInputElement> => (event) => {
const { onChange } = this.props;
const val: boolean = event.target.checked;
console.log(val);
// eslint-disable-next-line no-param-reassign
questions[index].required = val;
onChange(questions);
+1 -1
View File
@@ -20,7 +20,7 @@ export interface SignupForm {
title?: string;
type: string;
required: string[];
properties: any;
properties: unknown;
minProperties?: number;
};
}
+2 -2
View File
@@ -6,7 +6,7 @@ import { ServerStyleSheet } from "styled-components";
import Favicons from "@components/Favicons";
import HTMLLogo from "@components/HTMLLogo";
export default class MyDocument extends Document {
export default class MyDocument extends Document<{ styleTags: unknown }> {
static async getInitialProps(ctx: DocumentContext) {
const sheet = new ServerStyleSheet();
const originalRenderPage = ctx.renderPage;
@@ -30,7 +30,7 @@ export default class MyDocument extends Document {
}
render() {
const { styleTags } = this.props as any;
const { styleTags } = this.props;
return (
<Html lang="fi">
<Head>
+5 -10
View File
@@ -5,16 +5,11 @@ const tokenUrl = `${process.env.NEXT_PUBLIC_API_URL}/api-token-auth/`;
const checkUrl = `${process.env.NEXT_PUBLIC_API_URL}/api-token-verify/`;
export async function generateToken(username: string, password: string): Promise<string> {
try {
const resp = await axios.post(tokenUrl, {
username,
password,
});
return resp.data.token;
} catch (err) {
console.error(err);
throw err;
}
const resp = await axios.post(tokenUrl, {
username,
password,
});
return resp.data.token;
}
export function setTokenCookie(token: string) {
+1
View File
@@ -1,3 +1,4 @@
// HTML 5 email regex
// eslint-disable-next-line import/prefer-default-export
export const EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
// export const EMAIL_REGEX = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
+2 -2
View File
@@ -19,8 +19,8 @@ interface SignUpPageViewProps {
signUpForm: SignupForm;
formData: any;
statusMessage: string;
onChange: (e: IChangeEvent<any>, es?: ErrorSchema) => any;
onSubmit: (e: ISubmitEvent<any>) => any;
onChange: (e: IChangeEvent<unknown>, es?: ErrorSchema) => unknown;
onSubmit: (e: ISubmitEvent<unknown>) => unknown;
}
const renderList = (signUpForm: SignupForm) => (
+6 -6
View File
@@ -38,14 +38,14 @@ type AdminCreateCommonProps = {
title: string;
formData?: FormTypes;
schema: {
[name: string]: any;
[name: string]: unknown;
};
UISchema: {
[name: string]: any;
[name: string]: unknown;
};
onChange?: (e: IChangeEvent<FormTypes>, es?: ErrorSchema) => any;
onChange?: (e: IChangeEvent<FormTypes>, es?: ErrorSchema) => unknown;
onFocus: (id: string, value: string | number | boolean) => void;
onSubmit: (e: ISubmitEvent<FormTypes>) => any;
onSubmit: (e: ISubmitEvent<FormTypes>) => unknown;
statusMessage: string;
error: string;
widgets: {
@@ -65,9 +65,9 @@ const AdminCreateCommon: React.FC<AdminCreateCommonProps> = ({
error,
widgets,
}) => {
const onError = (data: any) => {
const onError = (data: unknown) => {
console.error("error, data:");
console.log(data);
console.error(data);
};
return (