-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import cleanup #16368
Import cleanup #16368
Conversation
PR build results: screenshots exceptions (0) webpagetest (2) -automated message |
@@ -88,17 +87,10 @@ object Frontend extends Build with Prototypes { | |||
libraryDependencies ++= Seq( | |||
paClient, | |||
akkaContrib | |||
), | |||
TwirlKeys.templateImports ++= Seq( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😰
@@ -3,8 +3,7 @@ | |||
@import implicits.Football._ | |||
@import views.FootballHelpers._ | |||
|
|||
|
|||
@(page: MatchPage, competition: Option[model.Competition])(implicit request: RequestHeader, context: model.ApplicationContext) | |||
@(page: _root_.football.controllers.MatchPage, competition: Option[model.Competition])(implicit request: RequestHeader, context: model.ApplicationContext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand why these have to be _root_
, is there another MatchPage
it might pick up otherwise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. It is not necessary.
However IntelliJ is confused and pick up the football
package from another app (admin). That's why I originally added _root_
.
I removed it and will try to fix IntelliJ instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will try to fix IntelliJ instead
Good luck, you may need it! 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, just had one question
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay to being more explicit 🎉 !
It makes templates dependencies hard to follow. Instead importing the necessary dependencies in each templates
6c91e24
to
3a3a4fb
Compare
What does this change?
This patch:
TwirlKeys.templateImports
setting: It makes templates dependencies hard to follow. Instead importing the necessary dependencies in each templates.Example:
football
templates were automatically importingpa._
which provides an implicitStringToOption
function. It was not clear to me why passing aString
to a fragment that was expecting anOption[String]
argument was compiling successfullyI wanted to enable the
-Ywarn-unused-import
compiler option but it doesn't play well with Twirl templates: playframework/twirl#105What is the value of this and can you measure success?
More explicit dependencies, less hidden magic
Tested in CODE?
yes