Skip to content
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

Add scalafmt #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version = "2.7.5"
align.preset = more
docstrings = JavaDoc
assumeStandardLibraryStripMargin = true
project.git = true
maxColumn = 100
trailingCommas = multiple
13 changes: 7 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
lazy val root = project.in(file("."))
lazy val root = project
.in(file("."))
.aggregate(scalaLibraryNextJVM, scalaLibraryNextJS)
.settings(
publish / skip := true,
// With CrossType.Pure, the root project also picks up the sources in `src`
Compile / unmanagedSourceDirectories := Nil,
Test / unmanagedSourceDirectories := Nil,
Test / unmanagedSourceDirectories := Nil,
)

lazy val scalaLibraryNext = crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.in(file("."))
.jvmSettings(
libraryDependencies += "junit" % "junit" % "4.13.1" % Test,
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test,
libraryDependencies += "junit" % "junit" % "4.13.1" % Test,
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test,
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
)
.jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
Expand All @@ -21,11 +22,11 @@ lazy val scalaLibraryNext = crossProject(JVMPlatform, JSPlatform)
scalaModuleMimaPreviousVersion := None,
scalacOptions ++= Seq("-deprecation", "-feature", "-Werror"),
libraryDependencies ++= Seq(
"org.scalacheck" %%% "scalacheck" % "1.15.0" % Test,
"org.scalacheck" %%% "scalacheck" % "1.15.0" % Test
Copy link
Member

@sjrd sjrd Nov 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is one place where trailing commas are useful and desirable, it is in sbt settings ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I know... this one annoyed me too.

I'm happy to try using always instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and/or bug Olaf to add a new setting that does what we want ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sbt/sbt uses this:

trailingCommas = preserve

),
)
.jsSettings(
Test / fork := false,
Test / fork := false
)

lazy val scalaLibraryNextJVM = scalaLibraryNext.jvm
Expand Down
7 changes: 4 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.3")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.2.3")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")