-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy path.scalafmt.conf
More file actions
45 lines (35 loc) · 1.54 KB
/
.scalafmt.conf
File metadata and controls
45 lines (35 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
version = "3.9.7"
runner.dialect = scala213 // Or scala3, scala212, etc., matching your project
docstrings.style = Asterisk // JavaDoc style.
docstrings.wrap = keep // Preserve existing line breaks within the docstring content as much as possible.
docstrings.forceBlankLineBefore = true
// Core layout
maxColumn = 120 // Docstring lines will still wrap if they exceed maxColumn.
indent.main = 2
indent.significant = 2 // It's suggested to change this to 4 when using Scala 3.
// Alignment
align.preset = more
align.multiline = false
// Allows single-line lambda expressions with curly braces if they fit.
newlines.afterCurlyLambdaParams = squash
newlines.beforeCurlyLambdaParams = never
// Allow line-overflow for comments and lines that would overflow even with a newline.
newlines.avoidForSimpleOverflow = [slc, tooLong]
// Prevents creating newlines too aggressively for simple expressions.
binPack.literalsIncludeSimpleExpr = true
// Ensure lines starting with the margin character `|` are indented differently.
assumeStandardLibraryStripMargin = true
// Avoid ASCII tokens.
rewriteTokens = {
"⇒": "=>"
"→": "->"
"←": "<-"
}
// Import and code organization
rewrite.rules = [
SortImports, // Alphabetize imports
SortModifiers, // Ensure modifiers like `implicit` or `final` are sorted the same
RedundantParens, // Remove unnecessary parentheses
PreferCurlyFors // Use curly braces in for-comprehensions
]
rewrite.redundantBraces.stringInterpolation = true // Remove braces in string interpolation.