mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-08-16 19:40:22 +03:00
Compare commits
4 Commits
64a749e69d
...
267d2038ba
Author | SHA1 | Date | |
---|---|---|---|
|
267d2038ba | ||
|
929d8508fd | ||
|
84aae3b64b | ||
|
48e9897960 |
@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.13.1] - 2023-06-17
|
||||
|
||||
Fixed an issue where the module name lookup table would yield an incorrect result. [#159](https://github.com/jfmengels/elm-review/pull/159)
|
||||
|
||||
## [2.13.0] - 2023-04-16
|
||||
|
||||
1) Changed the order in which rules are applied on modules. [#153](https://github.com/jfmengels/elm-review/pull/153)
|
||||
@ -159,6 +165,8 @@ Help would be appreciated to fill the blanks!
|
||||
[`Review.Rule.errorFixFailure`]: https://package.elm-lang.org/packages/jfmengels/elm-review/latest/Review-Rule#errorFixFailure
|
||||
[`Review.Test.ignoredFilesImpactResults`]: https://package.elm-lang.org/packages/jfmengels/elm-review/latest/Review-Rule-Test#ignoredFilesImpactResults
|
||||
|
||||
[Unreleased]: https://github.com/jfmengels/elm-review-unused/compare/v2.13.1...HEAD
|
||||
[2.13.1]: https://github.com/jfmengels/elm-review/releases/tag/2.13.1
|
||||
[2.13.0]: https://github.com/jfmengels/elm-review/releases/tag/2.13.0
|
||||
[2.12.2]: https://github.com/jfmengels/elm-review/releases/tag/2.12.2
|
||||
[2.12.1]: https://github.com/jfmengels/elm-review/releases/tag/2.12.1
|
||||
|
@ -116,7 +116,7 @@ Before you start adding rules or an unfamiliar existing configuration, I suggest
|
||||
## Write your own rule
|
||||
|
||||
You can write your own rule using this package's API and [`elm-syntax`](https://package.elm-lang.org/packages/stil4m/elm-syntax/7.2.1/).
|
||||
Check out the [`Review.Rule`](https://package.elm-lang.org/packages/jfmengels/elm-review/2.13.0/Review-Rule/) documentation for how to get started.
|
||||
Check out the [`Review.Rule`](https://package.elm-lang.org/packages/jfmengels/elm-review/2.13.1/Review-Rule/) documentation for how to get started.
|
||||
|
||||
**NOTE**: If you want to **create a package** containing `elm-review` rules, I highly recommend using the
|
||||
[CLI's](https://github.com/jfmengels/node-elm-review/) `elm-review new-package` subcommand. This will create a new package that will help you use the best practices and give you helpful tools like easy auto-publishing. More information is available in the maintenance file generated along with it.
|
||||
@ -236,7 +236,7 @@ It does provide 2 systems that I think are better alternatives for the health of
|
||||
|
||||
### Configuring exceptions
|
||||
|
||||
You can [configure exceptions](https://package.elm-lang.org/packages/jfmengels/elm-review/2.13.0/Review-Rule/#configuring-exceptions),
|
||||
You can [configure exceptions](https://package.elm-lang.org/packages/jfmengels/elm-review/2.13.1/Review-Rule/#configuring-exceptions),
|
||||
which consists of marking specific directories or files as not relevant to a rule or set of rules, preventing errors to be reported for those.
|
||||
|
||||
It is a good fit if you wish for `elm-review` to not report errors in vendored or generated code,
|
||||
@ -282,7 +282,7 @@ the codebase. You can use this to gain insight into your codebase, or provide in
|
||||
powerful integrations.
|
||||
|
||||
To make use of this feature, run `elm-review --extract --report=json` with a configuration containing a rule that uses
|
||||
[`Rule.withDataExtractor`](https://package.elm-lang.org/packages/jfmengels/elm-review/2.13.0/Review-Rule/#withDataExtractor).
|
||||
[`Rule.withDataExtractor`](https://package.elm-lang.org/packages/jfmengels/elm-review/2.13.1/Review-Rule/#withDataExtractor).
|
||||
|
||||
The result for a rule will be stored under `<json>.extracts.<YourRuleName>`. To access it, you can then pipe the result
|
||||
into either a `Node.js` script, a tool that expects JSON, or [`jq`](https://stedolan.github.io/jq/) as in the example below.
|
||||
|
4
elm.json
4
elm.json
@ -3,7 +3,7 @@
|
||||
"name": "jfmengels/elm-review",
|
||||
"summary": "Analyzes Elm projects, to help find mistakes before your users find them.",
|
||||
"license": "BSD-3-Clause",
|
||||
"version": "2.13.0",
|
||||
"version": "2.13.1",
|
||||
"exposed-modules": [
|
||||
"Review.Rule",
|
||||
"Review.ModuleNameLookupTable",
|
||||
@ -27,4 +27,4 @@
|
||||
"elm/regex": "1.0.0 <= v < 2.0.0",
|
||||
"pzp1997/assoc-list": "1.0.0 <= v < 2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1220,11 +1220,28 @@ expressionEnterVisitor node context =
|
||||
(\declaration scopes ->
|
||||
case Node.value declaration of
|
||||
Expression.LetFunction function ->
|
||||
registerVariable
|
||||
{ variableType = LetVariable
|
||||
, node = (Node.value function.declaration).name
|
||||
}
|
||||
scopes
|
||||
let
|
||||
{ name, expression, arguments } =
|
||||
Node.value function.declaration
|
||||
|
||||
withLetVariable : NonEmpty Scope
|
||||
withLetVariable =
|
||||
registerVariable
|
||||
{ variableType = LetVariable
|
||||
, node = name
|
||||
}
|
||||
scopes
|
||||
in
|
||||
if List.isEmpty arguments then
|
||||
withLetVariable
|
||||
|
||||
else
|
||||
let
|
||||
names : Dict String VariableInfo
|
||||
names =
|
||||
collectNamesFromPattern PatternVariable arguments Dict.empty
|
||||
in
|
||||
NonEmpty.mapHead (\scope -> { scope | cases = ( expression, names ) :: scope.cases }) withLetVariable
|
||||
|
||||
Expression.LetDestructuring _ _ ->
|
||||
scopes
|
||||
|
@ -5514,8 +5514,8 @@ createProjectVisitor schema hidden maybeVisitor possibleInputContexts computeCon
|
||||
computeContentHash project
|
||||
|
||||
cachePredicate : ProjectFileCache projectContext -> Bool
|
||||
cachePredicate elmJson =
|
||||
ProjectFileCache.match contentHash inputContextHash elmJson
|
||||
cachePredicate cacheData =
|
||||
ProjectFileCache.match contentHash inputContextHash cacheData
|
||||
in
|
||||
case reuseProjectRuleCache cachePredicate cacheGetter hidden.cache of
|
||||
Just entry ->
|
||||
|
@ -93,6 +93,10 @@ a = localValue
|
||||
True
|
||||
Just
|
||||
Cmd.none
|
||||
(let foo get = get
|
||||
in
|
||||
get
|
||||
)
|
||||
(+)
|
||||
(117 + 3)
|
||||
(<?>)
|
||||
@ -155,6 +159,8 @@ Http.get -> Http.get
|
||||
<nothing>.True -> Basics.True
|
||||
<nothing>.Just -> Maybe.Just
|
||||
Cmd.none -> Platform.Cmd.none
|
||||
<nothing>.get -> <nothing>.get
|
||||
<nothing>.get -> Http.get
|
||||
<nothing>.+ -> Basics.+
|
||||
<nothing>.+ -> Basics.+
|
||||
<nothing>.<?> -> Url.Parser.<?>
|
||||
@ -689,8 +695,11 @@ collectPatterns lookupFunction context node =
|
||||
Pattern.AsPattern subPattern _ ->
|
||||
collectPatterns lookupFunction context subPattern
|
||||
|
||||
Pattern.VarPattern _ ->
|
||||
[]
|
||||
|
||||
_ ->
|
||||
Debug.todo "Other patterns in case expressions are not handled"
|
||||
Debug.todo ("Other patterns in case expressions are not handled: " ++ Debug.toString node)
|
||||
|
||||
|
||||
getRealName : (ModuleNameLookupTable -> Range -> Maybe ModuleName) -> ModuleContext -> ModuleName -> Range -> String -> String
|
||||
|
Loading…
Reference in New Issue
Block a user