diff --git a/.eslintrc.js b/.eslintrc.js index 5336804..b8bad43 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,12 +1,23 @@ module.exports = { - parserOptions: { - project: "./tsconfig.json" - }, extends: [ "plugin:@typescript-eslint/recommended", "airbnb-typescript", "next", - "next/core-web-vitals" + "next/core-web-vitals", + ], + parser: '@typescript-eslint/parser', + parserOptions: { + tsconfigRootDir: __dirname, + project: './tsconfig.json', + }, + plugins: ['@typescript-eslint'], + overrides: [ + { + files: ['*.js'], + rules: { + '@typescript-eslint/no-var-requires': 'off', + }, + }, ], rules: { "max-len": [ @@ -17,13 +28,8 @@ module.exports = { "error", "double" ], - "import/prefer-default-export": "warn", - "react/jsx-props-no-spreading": "off", - "react/prop-types": "off", "react/jsx-one-expression-per-line": "off", - "eslintreact/jsx-one-expression-per-line": "off", // Temp - "import/no-cycle": "warn", "react/no-array-index-key": "warn", "jsx-a11y/label-has-associated-control": "off", "jsx-a11y/click-events-have-key-events": "off", diff --git a/next.config.js b/next.config.js index 9db006e..24890a1 100644 --- a/next.config.js +++ b/next.config.js @@ -10,5 +10,5 @@ module.exports = withBundleAnalyzer({ "static.sahkoinsinoorikilta.fi", "api.dev.sahkoinsinoorikilta.fi", ], - } + }, }); diff --git a/package-lock.json b/package-lock.json index 7e45f35..9e13636 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,6 +42,7 @@ "@types/shortid": "^0.0.29", "@types/styled-components": "^5.1.12", "@typescript-eslint/eslint-plugin": "^4.29.2", + "@typescript-eslint/parser": "^4.29.2", "babel-plugin-styled-components": "^1.13.2", "eslint": "^7.32.0", "eslint-config-airbnb": "^18.2.1", diff --git a/package.json b/package.json index 37c6503..7454ea5 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@types/shortid": "^0.0.29", "@types/styled-components": "^5.1.12", "@typescript-eslint/eslint-plugin": "^4.29.2", + "@typescript-eslint/parser": "^4.29.2", "babel-plugin-styled-components": "^1.13.2", "eslint": "^7.32.0", "eslint-config-airbnb": "^18.2.1", diff --git a/src/components/Navigation.tsx b/src/components/Navigation.tsx index 144a69c..cfb1925 100644 --- a/src/components/Navigation.tsx +++ b/src/components/Navigation.tsx @@ -6,7 +6,7 @@ import Icon, { IconType } from "./Icon"; import NavbarDropdownLink from "./NavbarDropdownLink"; import NavbarChildLink from "./NavbarChildLink"; -export const renderNavigationItems = (mobile = false) => ( +export const renderNavigationItems = (mobile = false): JSX.Element => ( <> Toiminta diff --git a/src/components/Widgets/SignupQuestionsWidget/TypeWidget.tsx b/src/components/Widgets/SignupQuestionsWidget/TypeWidget.tsx index c4d1e53..3541360 100644 --- a/src/components/Widgets/SignupQuestionsWidget/TypeWidget.tsx +++ b/src/components/Widgets/SignupQuestionsWidget/TypeWidget.tsx @@ -7,15 +7,15 @@ interface TypeWidgetProps { } class TypeWidget extends React.Component { - handleTypeChange = (questions: Question[], index: number) => (event) => { + handleTypeChange = (questions: Question[], index: number): React.ChangeEventHandler => (event) => { const { onChange } = this.props; - const val = event.target.value; + const val = event.target.value as Question["type"]; // eslint-disable-next-line no-param-reassign questions[index].type = val; onChange(questions); }; - render() { + render(): JSX.Element { const { inputProps } = this.props; const { type, questions, index } = inputProps; const options = optionTypes.map((t) => ( diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx index 46d1dcc..b45cf1b 100644 --- a/src/pages/_document.tsx +++ b/src/pages/_document.tsx @@ -1,13 +1,13 @@ import React from "react"; import Document, { - Html, Head, Main, NextScript, DocumentContext, + Html, Head, Main, NextScript, DocumentContext, DocumentInitialProps, } from "next/document"; import { ServerStyleSheet } from "styled-components"; import Favicons from "@components/Favicons"; import HTMLLogo from "@components/HTMLLogo"; export default class MyDocument extends Document<{ styleTags: unknown }> { - static async getInitialProps(ctx: DocumentContext) { + static async getInitialProps(ctx: DocumentContext): Promise { const sheet = new ServerStyleSheet(); const originalRenderPage = ctx.renderPage; try { diff --git a/tsconfig.json b/tsconfig.json index 91f6568..50ff755 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -57,7 +57,10 @@ "include": [ "./src/**/*", "./types/**/*", - "./tests/testcafe/**/*" + "./tests/testcafe/**/*", + "next-sitemap.js", + "next.config.js", + ".eslintrc.js" ], "exclude": [ "node_modules"