From 7297dfab3dfa577882ebc603aabbab71d9b1bd27 Mon Sep 17 00:00:00 2001 From: Martin Sosic Date: Mon, 8 Jan 2024 15:54:10 +0100 Subject: [PATCH] Fixed old hlint warnings/suggestions. --- waspc/.hlint.yaml | 1 + waspc/e2e-test/ShellCommands.hs | 1 - waspc/src/Wasp/AI/CodeAgent.hs | 5 ++++- waspc/src/Wasp/Generator/DbGenerator.hs | 2 -- waspc/test/AI/GenerateNewProject/PageComponentFileTest.hs | 2 +- waspc/waspls/src/Wasp/LSP/Diagnostic.hs | 2 +- waspc/waspls/src/Wasp/LSP/ServerMonads.hs | 3 ++- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/waspc/.hlint.yaml b/waspc/.hlint.yaml index 1b2147060..66a623d84 100644 --- a/waspc/.hlint.yaml +++ b/waspc/.hlint.yaml @@ -12,3 +12,4 @@ - ignore: {name: Use $>} # I find it makes code harder to read if enforced. - ignore: {name: Use list comprehension} # We can decide this on our own. - ignore: {name: Use ++} # I sometimes prefer concat over ++ due to the nicer formatting / extensibility. +- ignore: {name: Redundant lambda} # Sometimes it is nicer to create explicit lambda then function. diff --git a/waspc/e2e-test/ShellCommands.hs b/waspc/e2e-test/ShellCommands.hs index 6b529161e..6700e540b 100644 --- a/waspc/e2e-test/ShellCommands.hs +++ b/waspc/e2e-test/ShellCommands.hs @@ -1,5 +1,4 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE InstanceSigs #-} module ShellCommands ( ShellCommand, diff --git a/waspc/src/Wasp/AI/CodeAgent.hs b/waspc/src/Wasp/AI/CodeAgent.hs index d67a50a00..971986565 100644 --- a/waspc/src/Wasp/AI/CodeAgent.hs +++ b/waspc/src/Wasp/AI/CodeAgent.hs @@ -73,7 +73,10 @@ runCodeAgent config codeAgent = _isGpt4Available = Nothing } - shortenWithEllipsisTo maxLen text = if length text <= maxLen then text else (take maxLen text) <> "..." + shortenWithEllipsisTo maxLen text = + if length text <= maxLen + then text + else take maxLen text <> "..." showShortException :: forall e. Exception e => e -> String showShortException = shortenWithEllipsisTo 30 . displayException diff --git a/waspc/src/Wasp/Generator/DbGenerator.hs b/waspc/src/Wasp/Generator/DbGenerator.hs index 660e924a4..a822a8cc4 100644 --- a/waspc/src/Wasp/Generator/DbGenerator.hs +++ b/waspc/src/Wasp/Generator/DbGenerator.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE TypeApplications #-} - module Wasp.Generator.DbGenerator ( genDb, warnIfDbNeedsMigration, diff --git a/waspc/test/AI/GenerateNewProject/PageComponentFileTest.hs b/waspc/test/AI/GenerateNewProject/PageComponentFileTest.hs index 99c7b39c7..000b8e420 100644 --- a/waspc/test/AI/GenerateNewProject/PageComponentFileTest.hs +++ b/waspc/test/AI/GenerateNewProject/PageComponentFileTest.hs @@ -9,7 +9,7 @@ spec_PageComponentFileTest :: Spec spec_PageComponentFileTest = do describe "getPageComponentFileContentWithFixedImports" $ do let mockAllPossibleWaspClientImports = - M.fromList $ + M.fromList [ ("useQuery", "import { useQuery } from '@wasp/queries';"), ("useAction", "import { useAction } from '@wasp/actions';"), ("useAuth", "import useAuth from '@wasp/auth/useAuth';"), diff --git a/waspc/waspls/src/Wasp/LSP/Diagnostic.hs b/waspc/waspls/src/Wasp/LSP/Diagnostic.hs index b5b3de03d..09e853d34 100644 --- a/waspc/waspls/src/Wasp/LSP/Diagnostic.hs +++ b/waspc/waspls/src/Wasp/LSP/Diagnostic.hs @@ -119,5 +119,5 @@ waspErrorRange err = clearMissingExtImportDiagnostics :: [WaspDiagnostic] -> [WaspDiagnostic] clearMissingExtImportDiagnostics = filter (not . isMissingImportDiagnostic) where - isMissingImportDiagnostic (MissingExtImportDiagnostic _ _ _) = True + isMissingImportDiagnostic MissingExtImportDiagnostic {} = True isMissingImportDiagnostic _ = False diff --git a/waspc/waspls/src/Wasp/LSP/ServerMonads.hs b/waspc/waspls/src/Wasp/LSP/ServerMonads.hs index 8e4b93de3..5bfa012fb 100644 --- a/waspc/waspls/src/Wasp/LSP/ServerMonads.hs +++ b/waspc/waspls/src/Wasp/LSP/ServerMonads.hs @@ -1,6 +1,5 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE TypeSynonymInstances #-} module Wasp.LSP.ServerMonads ( -- * LSP Server Monads @@ -106,6 +105,8 @@ sendToReactor act = do rin <- handler $ asks (^. reactorIn) liftIO $ atomically $ writeTChan rin $ ReactorAction $ LSP.runLspT env $ runRLspM stateTVar act +{- HLINT ignore "Redundant <$>" -} + instance HasProjectRootDir HandlerM where -- Returns the folder that contains the active .wasp file, which is assumed -- to be the root of the wasp project.