-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build: Initial scalafmt config (WIP)
- Loading branch information
Showing
39 changed files
with
409 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,168 @@ | ||
version = "3.8.3" | ||
runner.dialect = "scala213" | ||
|
||
# !!! TODO !!! Update styles in the generator to match scalafmt config | ||
# - Maybe make a separate config for these files, that has two lines before method names, see https://scalameta.org/scalafmt/docs/configuration.html#fileoverride | ||
# - Does this exclusion actually work? IntelliJ seems to ignore it | ||
project.excludePaths = [ | ||
"glob:**/src/main/scala/com/raquo/laminar/defs/**", | ||
"glob:**/project/VersionHelper.scala", | ||
"glob:**/src/test/**", # !!! TODO - sort out binpacking, mostly | ||
] | ||
|
||
maxColumn = 1000 | ||
|
||
indent.main = 2 | ||
indent.callSite = 2 | ||
indent.binPackCallSite = 2 | ||
indent.ctrlSite = 2 | ||
indent.defnSite = 2 | ||
indent.binPackDefnSite = 2 | ||
indent.ctorSite = 2 | ||
indent.matchSite = 2 | ||
indent.caseSite = 2 | ||
indent.extendSite = 2 | ||
indent.withSiteRelativeToExtends = 0 | ||
indent.commaSiteRelativeToExtends = 2 # 0 is not allowed | ||
indent.extraBeforeOpenParenDefnSite = 0 | ||
indent.relativeToLhsLastLine = [match, infix] | ||
indent.fewerBraces = never | ||
indent.afterInfixSite = 2 # not sure what this is https://scalameta.org/scalafmt/docs/configuration.html#indentafterinfixsite | ||
|
||
# Indenting of nested calls: | ||
# !!! #TODO !!!: https://scalameta.org/scalafmt/docs/configuration.html#indent-for-binpackcallsite | ||
# !!! #TODO !!!: https://scalameta.org/scalafmt/docs/configuration.html#indentoperator | ||
|
||
align.preset = none | ||
|
||
# TODO: alignment can be more detailed but requires knowing Scala types | ||
# https://scalameta.org/scalafmt/docs/configuration.html#aligntokens | ||
|
||
align.arrowEnumeratorGenerator = false | ||
align.closeParenSite = false | ||
align.openParenCallSite = false | ||
align.openBracketCallSite = false | ||
align.openParenCtrlSite = false | ||
align.openParenDefnSite = false | ||
align.openBracketDefnSite = false | ||
align.openParenCallSite = false | ||
align.beforeOpenParenCallSite = false # ??? https://scalameta.org/scalafmt/docs/configuration.html#alignbeforeopenparenxxxsite | ||
align.beforeOpenParenDefnSite = false # ??? https://scalameta.org/scalafmt/docs/configuration.html#alignbeforeopenparenxxxsite | ||
align.stripMargin = true | ||
align.multiline = false | ||
align.allowOverflow = true # Not sure, it's unused since alignment is disabled https://scalameta.org/scalafmt/docs/configuration.html#alignallowoverflow | ||
align.inInterpolation = false | ||
align.delayUntilSpace = true | ||
|
||
newlines.source = keep | ||
# TODO: ??? https://scalameta.org/scalafmt/docs/configuration.html#newlinestoplevelstatementblanklines | ||
newlines.topLevelStatementBlankLines = [] | ||
newlines.topLevelBodyIfMinStatements = [] | ||
newlines.beforeTemplateBodyIfBreakInParentCtors = false # TODO not sure https://scalameta.org/scalafmt/docs/configuration.html#newlinesbeforetemplatebodyifbreakinparentctors | ||
newlines.beforeMultiline = keep # !!! TODO not sure, maybe `unfold` https://scalameta.org/scalafmt/docs/configuration.html#newlinesbeforemultiline | ||
newlines.forceBeforeMultilineAssign = never | ||
newlines.forceBeforeAssign = never | ||
newlines.beforeTypeBounds = keep | ||
newlines.alwaysBeforeElseAfterCurlyIf = false | ||
newlines.beforeCurlyLambdaParams = never | ||
newlines.afterCurlyLambdaParams = keep | ||
newlines.implicitParamListModifierPrefer = after # TODO I want this to be before, but scalafmt does not work well with it | ||
# newlines.implicitParamListModifierForce = [after] # !!! TODO not sure | ||
newlines.afterInfix = keep | ||
newlines.afterInfixBreakOnNested = false # ??? https://scalameta.org/scalafmt/docs/configuration.html#newlinesafterinfixbreakonnested | ||
newlines.avoidForSimpleOverflow = [tooLong, punct, slc] | ||
newlines.avoidInResultType = true | ||
newlines.sometimesBeforeColonInMethodReturnType = false | ||
# newlines.beforeOpenParenDefnSite = keep # TODO not sure https://scalameta.org/scalafmt/docs/configuration.html#newlinesbeforeopenparenxxxsite | ||
# newlines.beforeOpenParenCallSite = keep # TODO only supported for Scala 3. Also, not sure... https://scalameta.org/scalafmt/docs/configuration.html#newlinesbeforeopenparenxxxsite | ||
newlines.selectChains = keep | ||
newlines.inInterpolation = avoid # TODO not sure https://scalameta.org/scalafmt/docs/configuration.html#newlinesininterpolation | ||
newlines.ignoreInSyntax = true # TODO very not sure https://scalameta.org/scalafmt/docs/configuration.html#newlinesignoreinsyntax | ||
|
||
optIn.annotationNewlines = true # TODO not sure https://scalameta.org/scalafmt/docs/configuration.html#optinannotationnewlines | ||
|
||
danglingParentheses.defnSite = true | ||
danglingParentheses.callSite = true | ||
danglingParentheses.bracketDefnSite = true | ||
danglingParentheses.bracketCallSite = true | ||
danglingParentheses.ctrlSite = true | ||
danglingParentheses.tupleSite = true | ||
danglingParentheses.exclude = [] # TODO not sure https://scalameta.org/scalafmt/docs/configuration.html#danglingparenthesesexclude | ||
# !!! TODO not sure how !!! newlines.configStyleXxxSite.prefer https://scalameta.org/scalafmt/docs/configuration.html#newlinesconfigstylexxxsiteprefer | ||
|
||
# prefercurlyfors, redundantparens, redundantbraces, sortmodifiers, sortimports, expandimportselectors, imports, avoidinfix, asciisortimports | ||
|
||
rewrite.rules = [SortModifiers, PreferCurlyFors, Imports] | ||
# rewrite.sortModifiers.preset = styleGuide # TODO consider removing (changes position of `final` keyword) https://scalameta.org/scalafmt/docs/configuration.html#sortmodifiers | ||
rewrite.sortModifiers.order = [ # TODO maybe a custom order... | ||
"implicit", "final", "sealed", "abstract", | ||
"override", "private", "protected", "lazy" | ||
] | ||
rewrite.preferCurlyFors.removeTrailingSemicolonsOnly = true # TODO not sure https://scalameta.org/scalafmt/docs/configuration.html#prefercurlyfors | ||
rewrite.imports.expand = false | ||
rewrite.imports.sort = scalastyle # TODO not sure - change this later https://scalameta.org/scalafmt/docs/configuration.html#imports-sort--ascii | ||
rewrite.imports.groups = [ # TODO not sure | ||
[".*"], # Other imports first | ||
["java\\..*", "scala\\..*", "scala.scalajs\\..*"] | ||
] | ||
rewrite.imports.contiguousGroups = only # TODO not sure | ||
rewrite.trailingCommas.style = keep # TODO consider changing to `never` | ||
rewrite.trailingCommas.allowFolding = true # TODO not sure https://scalameta.org/scalafmt/docs/configuration.html#rewritetrailingcommasallowfolding | ||
|
||
# TODO Scala 3 rewrites? https://scalameta.org/scalafmt/docs/configuration.html#scala3-rewrites | ||
|
||
# !!!! TODO not sure about any of this !!! Maybe disable completely? | ||
# https://scalameta.org/scalafmt/docs/configuration.html#vertical-multiline | ||
verticalMultiline.atDefnSite = true | ||
verticalMultiline.arityThreshold = 10 | ||
verticalMultiline.newlineAfterOpenParen = true | ||
|
||
comments.wrap = no | ||
comments.wrapStandaloneSlcAsSlc = true // # TODO not sure because unused | ||
comments.wrapSingleLineMlcAsSlc = false | ||
|
||
docstrings.style = keep # !!! TODO not sure, can also be Space, SpaceAsterisk, or AsteriskSpace https://scalameta.org/scalafmt/docs/configuration.html#docstringsstyle | ||
docstrings.removeEmpty = true | ||
docstrings.oneline = keep # TODO not sure. Note: Ignored if docstrings.style = keep https://scalameta.org/scalafmt/docs/configuration.html#docstringsoneline | ||
docstrings.wrap = keep | ||
docstrings.wrapMaxColumn = 100 # TODO change if want it to be different from maxColumn | ||
docstrings.blankFirstLine = keep # !!! TODO not sure, try `fold` | ||
docstrings.forceBlankLineBefore = false # TODO not sure https://scalameta.org/scalafmt/docs/configuration.html#docstringsforceblanklinebefore | ||
|
||
spaces.beforeContextBoundColon = never # !!! TODO not sure, Always or IfMultipleBounds may be better style https://scalameta.org/scalafmt/docs/configuration.html#spacesbeforecontextboundcolon | ||
spaces.inImportCurlyBraces = false | ||
spaces.inInterpolatedStringCurlyBraces = false | ||
spaces.inParentheses = false | ||
spaces.neverAroundInfixTypes = [] | ||
spaces.aroundSymbolicInfixOperators.include = [".*"] | ||
spaces.aroundSymbolicInfixOperators.exclude = [] | ||
spaces.afterKeywordBeforeParen = true | ||
spaces.inByNameTypes = true | ||
spaces.afterSymbolicDefs = false | ||
spaces.beforeApplyArgInParens = AfterSymbolic # TODO not sure https://scalameta.org/scalafmt/docs/configuration.html#spacesbeforexxxarginparens | ||
spaces.beforeInfixArgInParens = always | ||
spaces.afterColonInMatchPattern = always | ||
|
||
literals.long = Upper | ||
literals.float = Lower | ||
literals.double = Lower | ||
literals.hexPrefix = Lower | ||
literals.hexDigits = Lower # Not sure, unused https://scalameta.org/scalafmt/docs/configuration.html#literalshexdigits | ||
literals.scientific = Lower | ||
|
||
xmlLiterals.assumeFormatted = false | ||
|
||
# !!! TODO Binpacking !!! https://scalameta.org/scalafmt/docs/configuration.html#binpacking | ||
|
||
# !!! TODO Classic select chains !!! https://scalameta.org/scalafmt/docs/configuration.html#classic-select-chains | ||
# - I don't think this applies to us, it's only for when newlines.source = classic, but we have `keep` | ||
|
||
# lineEndings = unix # TODO: Is there a difference between omitting it and setting `unix`? https://scalameta.org/scalafmt/docs/configuration.html#lineendings | ||
|
||
rewriteTokens = { | ||
"⇒": "=>" | ||
"→": "->" | ||
"←": "<-" | ||
} | ||
|
||
importSelectors = binPack # TODO Not sure, is there a `keep` option? https://scalameta.org/scalafmt/docs/configuration.html#importselectors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.