Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ Spotless CLI supports the following formatter steps in alphabetical order:
- [license-header](#license-header)
- [palantir-java-format](#palantir-java-format)
- [prettier](#prettier)
- [remove-unused-imports](#remove-unused-imports)

### clang-format

Expand Down Expand Up @@ -635,6 +636,46 @@ spotless --target='src/**/*.java' prettier \
--dev-dependency='prettier-plugin-java=2.3.0'
```

### remove-unused-imports

This removes unused imports from Java files.

To see usage instructions for the format-annotations formatter, run: `spotless remove-unused-imports --help`

<!---freshmark usage_remove_unused_imports
output =
'```\n' +
{{usage.remove-unused-imports.array}}.join('\n') +
'\n```';
-->

```
Usage: spotless remove-unused-imports [-hV] [-e=<engine>]
Removes unused imports from Java files.
-e, --engine=<engine> The backing engine to use for detecting and removing
unused imports.
One of: GOOGLE_JAVA_FORMAT, CLEAN_THAT
(default: GOOGLE_JAVA_FORMAT)
-h, --help Show this help message and exit.
-V, --version Print version information and exit.

✅ This step supports the following file type: Java

🌎 Additional info:
https://github.com/diffplug/spotless/tree/main/plugin-gradle#removeunusedimports
```

<!---freshmark /usage_remove_unused_imports -->

Example usage:

```shell
spotless --target '**/src/**/*.java' remove-unused-imports

# or use non-default engine
spotless --target '**/src/**/*.java' remove-unused-imports --engine=CLEAN_THAT
```

## Tipps & Tricks

### Using a configuration file
Expand Down
Loading