From 20d738f725cf14765d174830c69b93ff0f5a66c6 Mon Sep 17 00:00:00 2001 From: olav Date: Wed, 25 May 2022 12:36:58 +0200 Subject: [PATCH] refactor: add eslint to merge check (#1022) * refactor: fix eslint issues * refactor: add eslint to merge check --- frontend/.github/workflows/node.js.yml | 6 +----- frontend/package.json | 5 ++++- .../ContextList/AddContextButton/AddContextButton.tsx | 5 ++--- .../EnvironmentActionCell/EnvironmentActionCell.tsx | 1 - .../component/strategies/StrategiesList/StrategiesList.tsx | 1 + frontend/src/component/tags/TagTypeList/TagTypeList.tsx | 2 +- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/frontend/.github/workflows/node.js.yml b/frontend/.github/workflows/node.js.yml index 8c45fa08cc..2c2964a198 100644 --- a/frontend/.github/workflows/node.js.yml +++ b/frontend/.github/workflows/node.js.yml @@ -1,6 +1,3 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - name: Node.js CI on: @@ -15,8 +12,6 @@ jobs: strategy: matrix: node-version: [14.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} @@ -25,4 +20,5 @@ jobs: node-version: ${{ matrix.node-version }} - run: yarn install --frozen-lockfile - run: yarn run test + - run: yarn run lint - run: yarn run fmt:check diff --git a/frontend/package.json b/frontend/package.json index eca25bdca9..aba48b6bc1 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -25,7 +25,7 @@ "license": "Apache-2.0", "scripts": { "build": "tsc && vite build", - "lint": "eslint src", + "lint": "eslint src --max-warnings 0", "start": "vite", "start:heroku": "UNLEASH_API=https://unleash.herokuapp.com yarn run start", "start:enterprise": "UNLEASH_API=https://unleash4.herokuapp.com yarn run start", @@ -125,6 +125,9 @@ "react-app", "react-app/jest" ], + "parserOptions": { + "warnOnUnsupportedTypeScriptVersion": false + }, "rules": { "no-restricted-globals": "off", "no-useless-computed-key": "off", diff --git a/frontend/src/component/context/ContextList/AddContextButton/AddContextButton.tsx b/frontend/src/component/context/ContextList/AddContextButton/AddContextButton.tsx index 2e83fb9852..721c6b8a78 100644 --- a/frontend/src/component/context/ContextList/AddContextButton/AddContextButton.tsx +++ b/frontend/src/component/context/ContextList/AddContextButton/AddContextButton.tsx @@ -1,9 +1,8 @@ -import { useContext, VFC } from 'react'; +import { VFC } from 'react'; import { useNavigate } from 'react-router-dom'; -import { Button, IconButton, Tooltip, useMediaQuery } from '@mui/material'; +import { useMediaQuery } from '@mui/material'; import { Add } from '@mui/icons-material'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; -import AccessContext from 'contexts/AccessContext'; import { CREATE_CONTEXT_FIELD } from 'component/providers/AccessProvider/permissions'; import PermissionButton from 'component/common/PermissionButton/PermissionButton'; import PermissionIconButton from 'component/common/PermissionIconButton/PermissionIconButton'; diff --git a/frontend/src/component/environments/EnvironmentActionCell/EnvironmentActionCell.tsx b/frontend/src/component/environments/EnvironmentActionCell/EnvironmentActionCell.tsx index 088042e7cc..c8464b303f 100644 --- a/frontend/src/component/environments/EnvironmentActionCell/EnvironmentActionCell.tsx +++ b/frontend/src/component/environments/EnvironmentActionCell/EnvironmentActionCell.tsx @@ -6,7 +6,6 @@ import { import { Edit, Delete, - OfflineBolt, DragIndicator, PowerSettingsNew, } from '@mui/icons-material'; diff --git a/frontend/src/component/strategies/StrategiesList/StrategiesList.tsx b/frontend/src/component/strategies/StrategiesList/StrategiesList.tsx index 2455dd34e6..67ccc1351d 100644 --- a/frontend/src/component/strategies/StrategiesList/StrategiesList.tsx +++ b/frontend/src/component/strategies/StrategiesList/StrategiesList.tsx @@ -158,6 +158,7 @@ export const StrategiesList = () => { sortType: 'number', }, ], + // eslint-disable-next-line react-hooks/exhaustive-deps [] ); diff --git a/frontend/src/component/tags/TagTypeList/TagTypeList.tsx b/frontend/src/component/tags/TagTypeList/TagTypeList.tsx index a8590c8148..fa3bd37999 100644 --- a/frontend/src/component/tags/TagTypeList/TagTypeList.tsx +++ b/frontend/src/component/tags/TagTypeList/TagTypeList.tsx @@ -132,7 +132,7 @@ export const TagTypeList = () => { disableSortBy: true, }, ], - [] + [navigate] ); const initialState = useMemo(