fix eslint on js files

This commit is contained in:
Aarni Halinen
2021-08-22 19:17:26 +03:00
parent b4a3cd8f44
commit 897faf8f47
8 changed files with 28 additions and 17 deletions
+15 -9
View File
@@ -1,12 +1,23 @@
module.exports = { module.exports = {
parserOptions: {
project: "./tsconfig.json"
},
extends: [ extends: [
"plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended",
"airbnb-typescript", "airbnb-typescript",
"next", "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: { rules: {
"max-len": [ "max-len": [
@@ -17,13 +28,8 @@ module.exports = {
"error", "error",
"double" "double"
], ],
"import/prefer-default-export": "warn",
"react/jsx-props-no-spreading": "off",
"react/prop-types": "off",
"react/jsx-one-expression-per-line": "off", "react/jsx-one-expression-per-line": "off",
"eslintreact/jsx-one-expression-per-line": "off",
// Temp // Temp
"import/no-cycle": "warn",
"react/no-array-index-key": "warn", "react/no-array-index-key": "warn",
"jsx-a11y/label-has-associated-control": "off", "jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/click-events-have-key-events": "off", "jsx-a11y/click-events-have-key-events": "off",
+1 -1
View File
@@ -10,5 +10,5 @@ module.exports = withBundleAnalyzer({
"static.sahkoinsinoorikilta.fi", "static.sahkoinsinoorikilta.fi",
"api.dev.sahkoinsinoorikilta.fi", "api.dev.sahkoinsinoorikilta.fi",
], ],
} },
}); });
+1
View File
@@ -42,6 +42,7 @@
"@types/shortid": "^0.0.29", "@types/shortid": "^0.0.29",
"@types/styled-components": "^5.1.12", "@types/styled-components": "^5.1.12",
"@typescript-eslint/eslint-plugin": "^4.29.2", "@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"babel-plugin-styled-components": "^1.13.2", "babel-plugin-styled-components": "^1.13.2",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-airbnb": "^18.2.1", "eslint-config-airbnb": "^18.2.1",
+1
View File
@@ -42,6 +42,7 @@
"@types/shortid": "^0.0.29", "@types/shortid": "^0.0.29",
"@types/styled-components": "^5.1.12", "@types/styled-components": "^5.1.12",
"@typescript-eslint/eslint-plugin": "^4.29.2", "@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"babel-plugin-styled-components": "^1.13.2", "babel-plugin-styled-components": "^1.13.2",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-airbnb": "^18.2.1", "eslint-config-airbnb": "^18.2.1",
+1 -1
View File
@@ -6,7 +6,7 @@ import Icon, { IconType } from "./Icon";
import NavbarDropdownLink from "./NavbarDropdownLink"; import NavbarDropdownLink from "./NavbarDropdownLink";
import NavbarChildLink from "./NavbarChildLink"; import NavbarChildLink from "./NavbarChildLink";
export const renderNavigationItems = (mobile = false) => ( export const renderNavigationItems = (mobile = false): JSX.Element => (
<> <>
<NavbarDropdownLink to="/kilta" text="Kilta " exploded={mobile}> <NavbarDropdownLink to="/kilta" text="Kilta " exploded={mobile}>
<NavbarChildLink to="/kilta/toiminta">Toiminta</NavbarChildLink> <NavbarChildLink to="/kilta/toiminta">Toiminta</NavbarChildLink>
@@ -7,15 +7,15 @@ interface TypeWidgetProps {
} }
class TypeWidget extends React.Component<TypeWidgetProps> { class TypeWidget extends React.Component<TypeWidgetProps> {
handleTypeChange = (questions: Question[], index: number) => (event) => { handleTypeChange = (questions: Question[], index: number): React.ChangeEventHandler<HTMLSelectElement> => (event) => {
const { onChange } = this.props; const { onChange } = this.props;
const val = event.target.value; const val = event.target.value as Question["type"];
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
questions[index].type = val; questions[index].type = val;
onChange(questions); onChange(questions);
}; };
render() { render(): JSX.Element {
const { inputProps } = this.props; const { inputProps } = this.props;
const { type, questions, index } = inputProps; const { type, questions, index } = inputProps;
const options = optionTypes.map((t) => ( const options = optionTypes.map((t) => (
+2 -2
View File
@@ -1,13 +1,13 @@
import React from "react"; import React from "react";
import Document, { import Document, {
Html, Head, Main, NextScript, DocumentContext, Html, Head, Main, NextScript, DocumentContext, DocumentInitialProps,
} from "next/document"; } from "next/document";
import { ServerStyleSheet } from "styled-components"; import { ServerStyleSheet } from "styled-components";
import Favicons from "@components/Favicons"; import Favicons from "@components/Favicons";
import HTMLLogo from "@components/HTMLLogo"; import HTMLLogo from "@components/HTMLLogo";
export default class MyDocument extends Document<{ styleTags: unknown }> { export default class MyDocument extends Document<{ styleTags: unknown }> {
static async getInitialProps(ctx: DocumentContext) { static async getInitialProps(ctx: DocumentContext): Promise<DocumentInitialProps> {
const sheet = new ServerStyleSheet(); const sheet = new ServerStyleSheet();
const originalRenderPage = ctx.renderPage; const originalRenderPage = ctx.renderPage;
try { try {
+4 -1
View File
@@ -57,7 +57,10 @@
"include": [ "include": [
"./src/**/*", "./src/**/*",
"./types/**/*", "./types/**/*",
"./tests/testcafe/**/*" "./tests/testcafe/**/*",
"next-sitemap.js",
"next.config.js",
".eslintrc.js"
], ],
"exclude": [ "exclude": [
"node_modules" "node_modules"