From 8dd9422344656e731ae1895445235e3e35b040ef Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Sat, 12 Oct 2019 18:45:38 +0300 Subject: [PATCH] Fix lint --- .eslintrc.json | 17 +++++++++++--- .../CommitteeContainer/CommitteeContainer.tsx | 2 +- src/components/ContactCard/ContactCard.tsx | 2 +- .../NavbarChildLink/NavbarChildLink.tsx | 2 +- .../NavbarDropdownLink/NavbarDropdownLink.tsx | 4 ++-- src/models/SignupForm.ts | 2 +- src/pages/EventCreatePage/EventCreatePage.tsx | 22 +++++++++---------- src/pages/SignUpPage/SignUpPage.tsx | 8 +++---- 8 files changed, 35 insertions(+), 24 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 18d2876..684920c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,7 +5,9 @@ "node": true }, "extends": [ - "eslint:recommended" + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:react/recommended" ], "globals": { "Atomics": "readonly", @@ -47,7 +49,7 @@ "no-extra-boolean-cast": "warn", "no-param-reassign": "error", "no-shadow": "warn", - "no-unused-vars": "warn", + "no-unused-vars": "off", "no-useless-constructor": "warn", "object-curly-newline": "error", "prefer-destructuring": "warn", @@ -70,6 +72,7 @@ "jsx-a11y/no-static-element-interactions": "off", "jsx-a11y/label-has-associated-control": "off", "jsx-a11y/label-has-for": "off", + "react/display-name": "off", "react/destructuring-assignment": "off", "react/jsx-closing-bracket-location": "off", "react/jsx-closing-tag-location": "off", @@ -82,6 +85,14 @@ "react/no-access-state-in-setstate": "warn", "react/prop-types": "off", "react/prefer-stateless-function": "off", - "react/self-closing-comp": "off" + "react/self-closing-comp": "off", + "@typescript-eslint/camelcase": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-member-accessibility": "off", + "@typescript-eslint/indent": "off", + "@typescript-eslint/interface-name-prefix": "off", + "@typescript-eslint/no-empty-interface": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": "warn" } } \ No newline at end of file diff --git a/src/components/CommitteeContainer/CommitteeContainer.tsx b/src/components/CommitteeContainer/CommitteeContainer.tsx index 6c68189..8337319 100644 --- a/src/components/CommitteeContainer/CommitteeContainer.tsx +++ b/src/components/CommitteeContainer/CommitteeContainer.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import "./CommitteeContainer.scss"; import { Occupation } from "../../models/Contacts"; -import ContactCard from '../ContactCard/ContactCard'; +import ContactCard from "../ContactCard/ContactCard"; export interface CommitteeContainerProps { name_fi: string; diff --git a/src/components/ContactCard/ContactCard.tsx b/src/components/ContactCard/ContactCard.tsx index 89b07f5..10b76e7 100644 --- a/src/components/ContactCard/ContactCard.tsx +++ b/src/components/ContactCard/ContactCard.tsx @@ -6,7 +6,7 @@ import { Role } from "../../models/Contacts"; export interface ContactCardProps { first_name: string; last_name: string; - phone: Number; + phone: number; email: string; image: string; role: Role; diff --git a/src/components/NavbarChildLink/NavbarChildLink.tsx b/src/components/NavbarChildLink/NavbarChildLink.tsx index 96eb546..dfa1120 100644 --- a/src/components/NavbarChildLink/NavbarChildLink.tsx +++ b/src/components/NavbarChildLink/NavbarChildLink.tsx @@ -6,7 +6,7 @@ export interface NavbarChildLinkProps { to: string; } export interface NavbarChildLinkState { - open: Boolean; + open: boolean; } class NavbarChildLink extends React.Component { diff --git a/src/components/NavbarDropdownLink/NavbarDropdownLink.tsx b/src/components/NavbarDropdownLink/NavbarDropdownLink.tsx index f6aebf7..2844e7b 100644 --- a/src/components/NavbarDropdownLink/NavbarDropdownLink.tsx +++ b/src/components/NavbarDropdownLink/NavbarDropdownLink.tsx @@ -9,8 +9,8 @@ export interface NavbarDropdownLinkProps { exploded?: boolean; // if exploded, show items directly underneath without a dropdown menu } export interface NavbarDropdownLinkState { - mouseOverLink: Boolean; - mouseOverBox: Boolean; + mouseOverLink: boolean; + mouseOverBox: boolean; } class NavbarDropdownLink extends React.Component { diff --git a/src/models/SignupForm.ts b/src/models/SignupForm.ts index bbc8fa2..681b7ee 100644 --- a/src/models/SignupForm.ts +++ b/src/models/SignupForm.ts @@ -16,7 +16,7 @@ export interface SignupForm { export async function getForms(): Promise { try { const resp = await axios.get(url); - const results = resp.data["results"]; + const { results } = resp.data; return results; } catch (err) { console.error(err); diff --git a/src/pages/EventCreatePage/EventCreatePage.tsx b/src/pages/EventCreatePage/EventCreatePage.tsx index 96c7cdd..cea705c 100644 --- a/src/pages/EventCreatePage/EventCreatePage.tsx +++ b/src/pages/EventCreatePage/EventCreatePage.tsx @@ -38,7 +38,7 @@ class EventCreatePage extends React.Component

{title}

- { statusMessage &&
{ statusMessage }
} + {statusMessage &&
{statusMessage}
}
- { error &&
{error}
} + uiSchema={uiSchema} + formData={formData} + idPrefix="rjsf" + widgets={widgets} + onChange={this.onChange} + onSubmit={this.onSubmit} + onError={this.onError} + onFocus={this.onFocus} /> + {error &&
{error}
} ); } diff --git a/src/pages/SignUpPage/SignUpPage.tsx b/src/pages/SignUpPage/SignUpPage.tsx index e3c33da..b17f1f7 100644 --- a/src/pages/SignUpPage/SignUpPage.tsx +++ b/src/pages/SignUpPage/SignUpPage.tsx @@ -10,7 +10,7 @@ export interface SignUpPageProps { match: { params: { id: number; - }, + }; }; } @@ -69,9 +69,9 @@ class SignUpPage extends React.Component { return ; } if (question.type === "radiobutton") { - const options = question.options; - return options.map((opt) => ( - + const { options } = question; + return options.map((opt, index) => ( + {opt}