mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-08-17 12:00:29 +03:00
Update documentation for comment visitor
Clarify that comments are visited in source order and note that doc comments for functions/types/type aliases are not included.
This commit is contained in:
parent
a9e4af196f
commit
6efdebc1f3
@ -1953,7 +1953,18 @@ withSimpleModuleDefinitionVisitor visitor schema =
|
||||
|
||||
{-| Add a visitor to the [`ModuleRuleSchema`](#ModuleRuleSchema) which will visit the module's comments.
|
||||
|
||||
This visitor will give you access to the list of all comments in the module all at once.
|
||||
This visitor will give you access to the list of comments (in source order) in
|
||||
the module all at once. Note that comments that are parsed as doc comments by
|
||||
[`elm-syntax`](https://package.elm-lang.org/packages/stil4m/elm-syntax/latest/)
|
||||
are not included in this list.
|
||||
|
||||
As such, the following comments are included (✅) / excluded (❌):
|
||||
|
||||
- ✅ Module doc comments (`{-| -}`)
|
||||
- ✅ Port doc comments (`{-| -}`)
|
||||
- ✅ Top-level comments not internal to a function/type/etc.
|
||||
- ✅ Comments internal to a function/type/etc.
|
||||
- ❌ Function/type/type alias doc comments (`{-| -}`)
|
||||
|
||||
The following example forbids words like "TODO" appearing in a comment.
|
||||
|
||||
@ -2312,7 +2323,18 @@ withModuleDefinitionVisitor visitor (ModuleRuleSchema schema) =
|
||||
{-| Add a visitor to the [`ModuleRuleSchema`](#ModuleRuleSchema) which will visit the module's comments, collect data in
|
||||
the `context` and/or report patterns.
|
||||
|
||||
This visitor will give you access to the list of all comments in the module all at once.
|
||||
This visitor will give you access to the list of comments (in source order) in
|
||||
the module all at once. Note that comments that are parsed as doc comments by
|
||||
[`elm-syntax`](https://package.elm-lang.org/packages/stil4m/elm-syntax/latest/)
|
||||
are not included in this list.
|
||||
|
||||
As such, the following comments are included (✅) / excluded (❌):
|
||||
|
||||
- ✅ Module doc comments (`{-| -}`)
|
||||
- ✅ Port doc comments (`{-| -}`)
|
||||
- ✅ Top-level comments not internal to a function/type/etc.
|
||||
- ✅ Comments internal to a function/type/etc.
|
||||
- ❌ Function/type/type alias doc comments (`{-| -}`)
|
||||
|
||||
Tip: If you do not need to collect data in this visitor, you may wish to use the
|
||||
simpler [`withSimpleCommentsVisitor`](#withSimpleCommentsVisitor) function.
|
||||
|
Loading…
Reference in New Issue
Block a user