From 4b13c0a9cec6dd332db2dab272361d0161063708 Mon Sep 17 00:00:00 2001 From: brunoravera <bruno@process.st> Date: Sat, 9 Mar 2024 16:16:01 -0300 Subject: [PATCH] improve linter --- package.json | 23 +++++++++++-------- web/src/App.tsx | 4 ++-- web/src/Routes.tsx | 2 +- web/src/design/theme.ts | 1 + web/src/features/topbar/topbar.tsx | 14 ++++------- .../Patterns/details/pattern-details.tsx | 12 ++++++---- web/src/pages/Patterns/patterns.tsx | 5 +++- web/src/pages/animations/animations.tsx | 7 ++++-- web/src/pages/home/home.tsx | 3 ++- .../pages/implementations/implementations.tsx | 4 +++- yarn.lock | 10 -------- 11 files changed, 43 insertions(+), 42 deletions(-) diff --git a/package.json b/package.json index f68b1fe..e08e218 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,19 @@ }, "eslintConfig": { "extends": "@redwoodjs/eslint-config", - "root": true + "root": true, + "rules": { + "@typescript-eslint/no-namespace": "off", + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true, + "types": { + "{}": false + } + } + ] + } }, "engines": { "node": "=18.x", @@ -20,15 +32,6 @@ }, "packageManager": "yarn@3.7.0", "dependencies": { - "husky": "^9.0.11", "react-icons": "^5.0.1" - }, - "scripts": { - "prepare": "husky" - }, - "husky": { - "hooks": { - "pre-push": "yarn rw lint --fix" - } } } diff --git a/web/src/App.tsx b/web/src/App.tsx index 9f9da22..2dbde52 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -1,11 +1,11 @@ import { ChakraProvider, ColorModeScript, extendTheme } from '@chakra-ui/react' +import { QueryClient, QueryClientProvider } from 'react-query' import { FatalErrorBoundary, RedwoodProvider } from '@redwoodjs/web' +import { theme } from './design/theme' import { DevFatalError } from './pages/fatal-error' import Routes from './Routes' -import { QueryClient, QueryClientProvider } from 'react-query' -import { theme } from './design/theme' const extendedTheme = extendTheme(theme) diff --git a/web/src/Routes.tsx b/web/src/Routes.tsx index f278105..6bd3383 100644 --- a/web/src/Routes.tsx +++ b/web/src/Routes.tsx @@ -1,10 +1,10 @@ import { Router, Route, Set } from '@redwoodjs/router' +import { MainLayout } from './layouts' import { Home } from './pages/home' import { NotFound } from './pages/not-found' import { Patterns } from './pages/patterns' import { PatternDetails } from './pages/patterns/details' -import { MainLayout } from './layouts' const Routes = () => { return ( diff --git a/web/src/design/theme.ts b/web/src/design/theme.ts index eb4a98d..cd118ad 100644 --- a/web/src/design/theme.ts +++ b/web/src/design/theme.ts @@ -1,4 +1,5 @@ import { ThemeConfig, extendTheme } from '@chakra-ui/react' + import { tableTheme } from './table-theme' const config: ThemeConfig = { diff --git a/web/src/features/topbar/topbar.tsx b/web/src/features/topbar/topbar.tsx index 45f98eb..2bdd37f 100644 --- a/web/src/features/topbar/topbar.tsx +++ b/web/src/features/topbar/topbar.tsx @@ -1,16 +1,10 @@ -import { - Badge, - Box, - Divider, - HStack, - Icon, - IconButton, - Text, -} from '@chakra-ui/react' -import { Link, back, navigate, routes, useLocation } from '@redwoodjs/router' import React from 'react' + +import { Badge, Box, Divider, HStack, Icon, IconButton } from '@chakra-ui/react' import { FaArrowLeft } from 'react-icons/fa' +import { Link, back, navigate, routes, useLocation } from '@redwoodjs/router' + export const TOPBAR_HEIGHT_PX = '40px' export const Topbar: React.FC = () => { const { pathname } = useLocation() diff --git a/web/src/pages/Patterns/details/pattern-details.tsx b/web/src/pages/Patterns/details/pattern-details.tsx index 2d94b65..af2aa59 100644 --- a/web/src/pages/Patterns/details/pattern-details.tsx +++ b/web/src/pages/Patterns/details/pattern-details.tsx @@ -1,9 +1,13 @@ -import { Heading, Text, VStack } from '@chakra-ui/react' -import { useParams } from '@redwoodjs/router' import React from 'react' -import { patterns } from '../data' -import { Implementations } from 'src/pages/implementations' + +import { Text, VStack } from '@chakra-ui/react' + +import { useParams } from '@redwoodjs/router' + import { Animations } from 'src/pages/animations' +import { Implementations } from 'src/pages/implementations' + +import { patterns } from '../data' export const PatternDetails: React.FC = () => { const { id } = useParams() diff --git a/web/src/pages/Patterns/patterns.tsx b/web/src/pages/Patterns/patterns.tsx index 242963b..9897932 100644 --- a/web/src/pages/Patterns/patterns.tsx +++ b/web/src/pages/Patterns/patterns.tsx @@ -18,10 +18,13 @@ import { Spinner, } from '@chakra-ui/react' import { FaEdit, FaEye, FaPlus, FaTrash } from 'react-icons/fa' +import { match } from 'ts-pattern' + import { Link, routes } from '@redwoodjs/router' + import { Pattern } from 'src/models' + import { GetPatternsQuery } from './query-builder' -import { match } from 'ts-pattern' const tableHeaders = ['Titulo', 'Descripcion', '#Implementaciones', ''] diff --git a/web/src/pages/animations/animations.tsx b/web/src/pages/animations/animations.tsx index a93c0a9..6848f83 100644 --- a/web/src/pages/animations/animations.tsx +++ b/web/src/pages/animations/animations.tsx @@ -1,6 +1,5 @@ import React from 'react' -import { Animation, Pattern } from 'src/models' -import { animations, patterns } from '../patterns' + import { Table, TableCaption, @@ -18,6 +17,10 @@ import { } from '@chakra-ui/react' import { FaPlay, FaTrash } from 'react-icons/fa' +import { Animation, Pattern } from 'src/models' + +import { animations, patterns } from '../patterns' + const tableHeaders = ['Titulo', 'Descripcion', 'Fecha de creacion', ''] export type AnimationsProps = { diff --git a/web/src/pages/home/home.tsx b/web/src/pages/home/home.tsx index a1dc3a5..a6f4c98 100644 --- a/web/src/pages/home/home.tsx +++ b/web/src/pages/home/home.tsx @@ -1,8 +1,9 @@ import * as React from 'react' -import image from './home-background.webp' import { Image, Text, VStack } from '@chakra-ui/react' +import image from './home-background.webp' + export const Home: React.FC = () => { return ( <VStack alignItems="flex-start" maxW="720px"> diff --git a/web/src/pages/implementations/implementations.tsx b/web/src/pages/implementations/implementations.tsx index fcacba9..d182ca5 100644 --- a/web/src/pages/implementations/implementations.tsx +++ b/web/src/pages/implementations/implementations.tsx @@ -15,10 +15,12 @@ import { IconButton, Icon, } from '@chakra-ui/react' -import { implementations, patterns } from '../patterns' import { FaEye, FaPlay, FaTrash } from 'react-icons/fa' + import { Implementation, Pattern } from 'src/models' +import { implementations, patterns } from '../patterns' + const tableHeaders = ['Titulo', 'Descripcion', 'Fecha de creacion', ''] export type ImplementationsProps = { diff --git a/yarn.lock b/yarn.lock index f4a8d2b..6998661 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15913,15 +15913,6 @@ __metadata: languageName: node linkType: hard -"husky@npm:^9.0.11": - version: 9.0.11 - resolution: "husky@npm:9.0.11" - bin: - husky: bin.mjs - checksum: 2c787dcf74a837fc9a4fea7da907509d4bd9a289f4ea10ecc9d86279e4d4542b0f5f6443a619bccae19e265f2677172cc2b86aae5c932a35a330cc227d914605 - languageName: node - linkType: hard - "iconv-lite@npm:0.4.24, iconv-lite@npm:^0.4.24": version: 0.4.24 resolution: "iconv-lite@npm:0.4.24" @@ -21864,7 +21855,6 @@ __metadata: dependencies: "@redwoodjs/cli-storybook": 6.5.1 "@redwoodjs/core": 6.5.1 - husky: ^9.0.11 react-icons: ^5.0.1 languageName: unknown linkType: soft -- GitLab