Expose some internal modules that are needed in generated code, ignore some review rules with incorrect results.

This commit is contained in:
Dillon Kearns 2021-07-29 12:55:26 -07:00
parent 74bad44b7b
commit 602c74d57b
5 changed files with 36 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,9 @@
"Pages.Secrets",
"Pages.Manifest",
"Pages.Manifest.Category",
"Pages.Flags"
"Pages.Flags",
"Pages.Internal.Platform",
"Pages.Internal.Platform.Cli"
],
"elm-version": "0.19.0 <= v < 0.20.0",
"dependencies": {

View File

@ -62,6 +62,9 @@ config =
|> Rule.ignoreErrorsForFiles
[ "src/Head/Seo.elm"
, "src/DataSource/Glob.elm" -- incorrect result,
, "src/Pages/Internal/Platform/Effect.elm"
, "src/Pages/Internal/Platform/Cli.elm"
, "src/Pages/Internal/Platform.elm"
-- alias is exposed - see https://github.com/jfmengels/elm-review-common/issues/1
, "src/ApiRoute.elm" -- incorrect result
@ -79,6 +82,7 @@ config =
, "src/StructuredData.elm"
, "src/Router.elm" -- used in generated code
, "src/RoutePattern.elm" -- used in generated code
, "src/Pages/Http.elm" -- reports incorrect unused custom type constructor
]
|> Rule.ignoreErrorsForDirectories
[ "src/ElmHtml"

View File

@ -1,5 +1,11 @@
module Pages.Internal.Platform exposing (Flags, Model, Msg, Program, application)
{-| Exposed for internal use only (used in generated code).
@docs Flags, Model, Msg, Program, application
-}
import AriaLiveAnnouncer
import Browser
import Browser.Dom as Dom
@ -23,6 +29,7 @@ import Task
import Url exposing (Url)
{-| -}
type alias Program userModel userMsg pageData sharedData =
Platform.Program Flags (Model userModel pageData sharedData) (Msg userMsg)
@ -107,10 +114,12 @@ onViewChangeElement currentUrl =
[]
{-| -}
type alias Flags =
Decode.Value
{-| -}
init :
ProgramConfig userMsg userModel route staticData pageData sharedData
-> Flags
@ -266,6 +275,7 @@ init config flags url key =
)
{-| -}
type Msg userMsg
= LinkClicked Browser.UrlRequest
| UrlChanged Url
@ -277,6 +287,7 @@ type Msg userMsg
| NoOp
{-| -}
type alias Model userModel pageData sharedData =
{ key : Browser.Navigation.Key
, url : Url
@ -293,6 +304,7 @@ type alias Model userModel pageData sharedData =
}
{-| -}
update :
ProgramConfig userMsg userModel route siteData pageData sharedData
-> Msg userMsg
@ -673,6 +685,7 @@ update config appMsg model =
( model, Cmd.none )
{-| -}
application :
ProgramConfig userMsg userModel route staticData pageData sharedData
-> Platform.Program Flags (Model userModel pageData sharedData) (Msg userMsg)

View File

@ -1,13 +1,10 @@
module Pages.Internal.Platform.Cli exposing
( Flags
, Model
, Msg(..)
, Program
, cliApplication
, init
, requestDecoder
, update
)
module Pages.Internal.Platform.Cli exposing (Flags, Model, Msg(..), Program, cliApplication, init, requestDecoder, update)
{-| Exposed for internal use only (used in generated code).
@docs Flags, Model, Msg, Program, cliApplication, init, requestDecoder, update
-}
import ApiRoute
import BuildError exposing (BuildError)
@ -43,10 +40,12 @@ import TerminalText as Terminal
import Url
{-| -}
type alias Flags =
Decode.Value
{-| -}
type alias Model route =
{ staticResponses : StaticResponses
, secrets : SecretsDict
@ -59,6 +58,7 @@ type alias Model route =
}
{-| -}
type Msg
= GotDataBatch
(List
@ -70,10 +70,12 @@ type Msg
| Continue
{-| -}
type alias Program route =
Platform.Program Flags (Model route) Msg
{-| -}
cliApplication :
ProgramConfig userMsg userModel (Maybe route) siteData pageData sharedData
-> Program (Maybe route)
@ -156,6 +158,7 @@ cliApplication config =
}
{-| -}
requestDecoder : Decode.Decoder { masked : Pages.StaticHttp.Request.Request, unmasked : Pages.StaticHttp.Request.Request }
requestDecoder =
(Codec.object (\masked unmasked -> { masked = masked, unmasked = unmasked })
@ -346,6 +349,7 @@ flagsDecoder =
)
{-| -}
init :
RenderRequest route
-> ContentCache
@ -468,6 +472,7 @@ updateAndSendPortIfDone contentCache config model =
|> nextStepToEffect contentCache config model
{-| -}
update :
ContentCache
-> ProgramConfig userMsg userModel route siteData pageData sharedData