Deprecate Rule.Metadata

This commit is contained in:
Jeroen Engels 2022-04-28 12:13:33 +02:00
parent e1e522eafb
commit 2c0254a469
2 changed files with 20 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -225,6 +225,10 @@ first, as they are in practice a simpler version of project rules.
## Requesting more information ## Requesting more information
@docs ContextCreator, initContextCreator, withModuleName, withModuleNameNode, withIsInSourceDirectories, withFilePath, withModuleNameLookupTable, withModuleKey, withSourceCodeExtractor @docs ContextCreator, initContextCreator, withModuleName, withModuleNameNode, withIsInSourceDirectories, withFilePath, withModuleNameLookupTable, withModuleKey, withSourceCodeExtractor
### Requesting more information (DEPRECATED)
@docs Metadata, withMetadata, moduleNameFromMetadata, moduleNameNodeFromMetadata, isInSourceDirectories @docs Metadata, withMetadata, moduleNameFromMetadata, moduleNameNodeFromMetadata, isInSourceDirectories
@ -5028,18 +5032,11 @@ applyContextCreator data (ContextCreator fn _) from =
{-| Request metadata about the module. {-| Request metadata about the module.
contextCreator : Rule.ContextCreator () Context **DEPRECATED**: Use more practical functions like
contextCreator =
Rule.initContextCreator
(\metadata () ->
{ moduleName = Rule.moduleNameFromMetadata metadata
, moduleNameNode = Rule.moduleNameNodeFromMetadata metadata
, isInSourceDirectories = Rule.isInSourceDirectories metadata
-- ...other fields - [`withModuleName`](#withModuleName)
} - [`withModuleNameNode`](#withModuleNameNode)
) - [`withIsInSourceDirectories`](#withIsInSourceDirectories)
|> Rule.withMetadata
-} -}
withMetadata : ContextCreator Metadata (from -> to) -> ContextCreator from to withMetadata : ContextCreator Metadata (from -> to) -> ContextCreator from to
@ -5281,6 +5278,8 @@ type alias AvailableData =
{-| Metadata for the module being visited. {-| Metadata for the module being visited.
**DEPRECATED**: More practical functions have been made available since the introduction of this type.
Do not store the metadata directly in your context. Prefer storing the individual pieces of information. Do not store the metadata directly in your context. Prefer storing the individual pieces of information.
-} -}
@ -5297,6 +5296,9 @@ createMetadata data =
{-| Get the module name of the current module. {-| Get the module name of the current module.
**DEPRECATED**: Use the more practical [`withModuleName`](#withModuleName) instead.
-} -}
moduleNameFromMetadata : Metadata -> ModuleName moduleNameFromMetadata : Metadata -> ModuleName
moduleNameFromMetadata (Metadata metadata) = moduleNameFromMetadata (Metadata metadata) =
@ -5304,6 +5306,9 @@ moduleNameFromMetadata (Metadata metadata) =
{-| Get the [`Node`](https://package.elm-lang.org/packages/stil4m/elm-syntax/7.2.1/Elm-Syntax-Node#Node) to the module name of the current module. {-| Get the [`Node`](https://package.elm-lang.org/packages/stil4m/elm-syntax/7.2.1/Elm-Syntax-Node#Node) to the module name of the current module.
**DEPRECATED**: Use the more practical [`withModuleNameNode`](#withModuleNameNode) instead.
-} -}
moduleNameNodeFromMetadata : Metadata -> Node ModuleName moduleNameNodeFromMetadata : Metadata -> Node ModuleName
moduleNameNodeFromMetadata (Metadata metadata) = moduleNameNodeFromMetadata (Metadata metadata) =
@ -5312,6 +5317,9 @@ moduleNameNodeFromMetadata (Metadata metadata) =
{-| Learn whether the current module is in the "source-directories" of the project. You can use this information to {-| Learn whether the current module is in the "source-directories" of the project. You can use this information to
know whether the module is part of the tests or of the production code. know whether the module is part of the tests or of the production code.
**DEPRECATED**: Use the more practical [`withIsInSourceDirectories`](#withIsInSourceDirectories) instead.
-} -}
isInSourceDirectories : Metadata -> Bool isInSourceDirectories : Metadata -> Bool
isInSourceDirectories (Metadata metadata) = isInSourceDirectories (Metadata metadata) =