mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-09-11 16:16:09 +03:00
Make NoExposingEverything handle module with a dotted name
This commit is contained in:
parent
60b7ee4710
commit
0503e66803
@ -47,24 +47,21 @@ createError name =
|
||||
LintError "NoExposingEverything" ("Do not expose everything from module " ++ name ++ " using (..)")
|
||||
|
||||
|
||||
reportModule : List String -> LintError
|
||||
reportModule name =
|
||||
name
|
||||
|> String.join "."
|
||||
|> createError
|
||||
|
||||
|
||||
statementFn : Context -> Direction Statement -> ( List LintError, Context )
|
||||
statementFn ctx node =
|
||||
case node of
|
||||
Enter (ModuleDeclaration names AllExport) ->
|
||||
case names of
|
||||
[ name ] ->
|
||||
( [ createError name ], ctx )
|
||||
Enter (ModuleDeclaration name AllExport) ->
|
||||
( [ reportModule name ], ctx )
|
||||
|
||||
_ ->
|
||||
( [], ctx )
|
||||
|
||||
Enter (PortModuleDeclaration names AllExport) ->
|
||||
case names of
|
||||
[ name ] ->
|
||||
( [ createError name ], ctx )
|
||||
|
||||
_ ->
|
||||
( [], ctx )
|
||||
Enter (PortModuleDeclaration name AllExport) ->
|
||||
( [ reportModule name ], ctx )
|
||||
|
||||
_ ->
|
||||
( [], ctx )
|
||||
|
@ -52,6 +52,14 @@ tests =
|
||||
\() ->
|
||||
testRule "port module Foo exposing (..)"
|
||||
|> expectErrors [ error "Do not expose everything from module Foo using (..)" ]
|
||||
, test "should report modules with dotted names that expose everything" <|
|
||||
\() ->
|
||||
testRule "module Foo.Bar.Baz exposing (..)"
|
||||
|> expectErrors [ error "Do not expose everything from module Foo.Bar.Baz using (..)" ]
|
||||
, test "should report port modules with dotted names that expose everything" <|
|
||||
\() ->
|
||||
testRule "port module Foo.Bar.Baz exposing (..)"
|
||||
|> expectErrors [ error "Do not expose everything from module Foo.Bar.Baz using (..)" ]
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user