You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[License header](#license-header) ([slurp year from git](#retroactively-slurp-years-from-git-history))
@@ -613,7 +614,8 @@ spotless {
613
614
614
615
tsfmt() // has its own section below
615
616
prettier() // has its own section below
616
-
eslint() // has its own section below
617
+
eslint() // has its own section below
618
+
rome() // has its own section below
617
619
618
620
licenseHeader '/* (C) $YEAR */', '(import|const|declare|export|var) ' // or licenseHeaderFile
619
621
// note the '(import|const|...' argument - this is a regex which identifies the top
@@ -705,7 +707,8 @@ spotless {
705
707
target 'src/**/*.js' // you have to set the target manually
706
708
707
709
prettier() // has its own section below
708
-
eslint() // has its own section below
710
+
eslint() // has its own section below
711
+
rome() // has its own section below
709
712
710
713
licenseHeader '/* (C) $YEAR */', 'REGEX_TO_DEFINE_TOP_OF_FILE' // or licenseHeaderFile
711
714
}
@@ -772,6 +775,7 @@ spotless {
772
775
eclipseWtp('json') // see Eclipse web tools platform section
773
776
gson() // has its own section below
774
777
jackson() // has its own section below
778
+
rome() // has its own section below
775
779
}
776
780
}
777
781
```
@@ -1064,6 +1068,171 @@ Unlike Eclipse, Spotless WTP ignores per default external URIs in schema locatio
1064
1068
external entities. To allow the access of external URIs, set the property `resolveExternalURI`
1065
1069
to true.
1066
1070
1071
+
## Rome
1072
+
1073
+
[homepage](https://rome.tools/). [changelog](https://github.com/rome/tools/blob/main/CHANGELOG.md). Rome is a formatter that for the Frontend written in Rust, which has a native binary,
1074
+
does not require Node.js and as such, is pretty fast. It can currently format
1075
+
JavaScript, TypeScript, JSX, and JSON, and may support
Absolute paths are used as-is. Relative paths are resolved against the project's
1170
+
base directory. To use a pre-installed Rome binary on the user's path, specify
1171
+
just a name without any slashes / backslashes:
1172
+
1173
+
```gradle
1174
+
spotless {
1175
+
format 'rome', {
1176
+
target '**/*.js','**/*.ts','**/*.json'
1177
+
// Uses the "rome" command, which must be on the user's path. -->
1178
+
rome('12.0.0').pathToExe('rome')
1179
+
}
1180
+
}
1181
+
```
1182
+
1183
+
### Rome configuration file
1184
+
1185
+
Romeis a biased formatter and linter without many options, but there are a few
1186
+
basic options. Rome uses a file named [rome.json](https://docs.rome.tools/configuration/)
1187
+
for its configuration. When none is specified, the default configuration from
1188
+
Romeis used. To use a custom configuration:
1189
+
1190
+
```gradle
1191
+
spotless {
1192
+
format 'rome', {
1193
+
target '**/*.js','**/*.ts','**/*.json'
1194
+
// Must point to the directory with the "rome.json" config file -->
1195
+
// Relative paths are resolved against the project's base directory -->
1196
+
rome('12.0.0').configPath('./config')
1197
+
}
1198
+
}
1199
+
```
1200
+
1201
+
### Rome input language
1202
+
1203
+
By default, Rome detects the language / syntax of the files to format
1204
+
automatically from the file extension. This may fail if your source code files
1205
+
have unusual extensions for some reason. If you are using the generic format,
1206
+
you can force a certain language like this:
1207
+
1208
+
```xml
1209
+
<configuration>
1210
+
<formats>
1211
+
<format>
1212
+
<includes>
1213
+
<include>src/**/typescript/**/*.mjson</include>
1214
+
</includes>
1215
+
1216
+
<rome>
1217
+
<version>12.0.0</version>
1218
+
<language>json</language>
1219
+
</prettier>
1220
+
</rome>
1221
+
1222
+
</formats>
1223
+
</configuration>
1224
+
```
1225
+
1226
+
The following languages are currently recognized:
1227
+
1228
+
* `js` --JavaScript
1229
+
* `jsx` --JavaScript+JSX (React)
1230
+
* `js?` --JavaScript, with or without JSX, depending on the file extension
1231
+
* `ts` --TypeScript
1232
+
* `tsx` --TypeScript+JSX (React)
1233
+
* `ts?` --TypeScript, with or without JSX, depending on the file extension
1234
+
* `json` --JSON
1235
+
1067
1236
## Generic steps
1068
1237
1069
1238
[Prettier](#prettier), [eclipse wtp](#eclipse-web-tools-platform), and [license header](#license-header) are available in every format, and they each have their own section. As mentioned in the [quickstart](#quickstart), there are a variety of simple generic steps which are also available in every format, here are examples of these:
0 commit comments