Skip to content

Commit 90a1870

Browse files
committed
Condense the typescript docs for plugin-maven.
1 parent 811c661 commit 90a1870

File tree

1 file changed

+14
-38
lines changed

1 file changed

+14
-38
lines changed

plugin-maven/README.md

+14-38
Original file line numberDiff line numberDiff line change
@@ -197,43 +197,19 @@ Use the Eclipse to define the *Code Style preferences* (see [Eclipse documentati
197197

198198
## Applying to Typescript source
199199

200-
To use tsfmt, you first have to specify the files that you want it to apply to.
201-
Then you specify `tsfmt`, and optionally how you want to apply it.
202-
203-
By default, all typescript source sets will be formatted. To change this,
204-
set the `target` parameter as described in the [Custom rules](#custom) section.
205-
206200
```xml
207201
<configuration>
208202
<typescript>
209203
<tsfmt>
210-
<!-- use (only) one of the following ...File elements to define a config file -->
204+
<!-- optionally define which files will be formatted. -->
205+
<includes>
206+
<include>src/**/*.ts</include> <!-- default value if nothing is specified -->
207+
</includes>
208+
<!-- must specify exactly one of the following "{foo}File" or "config" elements -->
211209
<tslintFile>${basedir}/path/to/repo/tslint.json</tslintFile>
212210
<tsfmtFile>${basedir}/path/to/repo/tsfmt.json</tsfmtFile>
213211
<tsconfigFile>${basedir}/path/to/repo/tsconfig.json</tsconfigFile>
214212
<vscodeFile>${basedir}/path/to/repo/vscode.json</vscodeFile>
215-
<!-- optionally configure following versions to use, shown values are defaults-->
216-
<typescriptFormatterVersion>7.2.2</typescriptFormatterVersion>
217-
<typescriptVersion>3.3.3</typescriptVersion>
218-
<tslintVersion>5.12.1</tslintVersion>
219-
</tsfmt>
220-
</typescript>
221-
</configuration>
222-
```
223-
Supported config file types are `tsconfigFile`, `tslintFile`, `vscodeFile` and `tsfmtFile`. They are corresponding to the respective
224-
[tsfmt-parameters](https://github.com/vvakame/typescript-formatter/blob/7764258ad42ac65071399840d1b8701868510ca7/lib/index.ts#L27L34).
225-
226-
*Please note:*
227-
The auto-discovery of config files (up the file tree) will not work when using tsfmt within spotless,
228-
hence you are required to provide resolvable file paths for config files.
229-
230-
... or alternatively provide the configuration inline ...
231-
232-
```xml
233-
<configuration>
234-
<typescript>
235-
<tsfmt>
236-
<!-- use (only) one of the following ...File elements to define a config file -->
237213
<config>
238214
<indentSize>1</indentSize>
239215
<convertTabsToSpaces>true</convertTabsToSpaces>
@@ -247,22 +223,22 @@ The auto-discovery of config files (up the file tree) will not work when using t
247223
</configuration>
248224
```
249225

250-
See [tsfmt's default config settings](https://github.com/vvakame/typescript-formatter/blob/7764258ad42ac65071399840d1b8701868510ca7/lib/utils.ts#L11L32) for what is available.
226+
Supported config file types are `tsconfigFile`, `tslintFile`, `vscodeFile` and `tsfmtFile`. They are corresponding to the respective
227+
[tsfmt-parameters](https://github.com/vvakame/typescript-formatter/blob/7764258ad42ac65071399840d1b8701868510ca7/lib/index.ts#L27L34). See [tsfmt's default config settings](https://github.com/vvakame/typescript-formatter/blob/7764258ad42ac65071399840d1b8701868510ca7/lib/utils.ts#L11L32) for what is available.
228+
229+
*Please note:*
230+
The auto-discovery of config files (up the file tree) will not work when using tsfmt within spotless,
231+
hence you are required to provide resolvable file paths for config files.
251232

252233
### Prerequisite: tsfmt requires a working NodeJS version
253234

254235
tsfmt is based on NodeJS, so to use it, a working NodeJS installation (especially npm) is required on the host running spotless.
255236
Spotless will try to auto-discover an npm installation. If that is not working for you, it is possible to directly configure the npm binary to use.
256237

257238
```xml
258-
<configuration>
259-
<typescript>
260-
<tsfmt>
261-
<tslintFile>${basedir}/path/to/repo/tslint.json</tslintFile>
262-
<npmExecutable>/usr/bin/npm</npmExecutable>
263-
</tsfmt>
264-
</typescript>
265-
</configuration>
239+
<configuration><typescript><tsfmt>
240+
...
241+
<npmExecutable>/usr/bin/npm</npmExecutable>
266242
```
267243

268244
Spotless uses npm to install necessary packages locally. It runs tsfmt using [J2V8](https://github.com/eclipsesource/J2V8) internally after that.

0 commit comments

Comments
 (0)