Skip to content

Commit

Permalink
Fix prettier bug StringIndexOutOfBoundsException on empty files (note…
Browse files Browse the repository at this point in the history
…d in #751).
  • Loading branch information
nedtwigg committed Jan 3, 2021
1 parent 49af781 commit be2150c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
* fix typo in javadoc comment for SQL\_FORMATTER\_INDENT\_TYPE ([#753](https://github.com/diffplug/spotless/pull/753))
### Fixed
* ktfmt v0.19+ with dropbox-style works again ([#765](https://github.com/diffplug/spotless/pull/765)).
* prettier no longer throws errors on empty files ([#751](https://github.com/diffplug/spotless/pull/751)).

## [2.10.2] - 2020-11-16
### Fixed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 DiffPlug
* Copyright 2016-2021 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -113,7 +113,7 @@ public PrettierFilePathPassingFormatterFunc(String prettierConfigOptions, Pretti

@Override
public String applyWithFile(String unix, File file) throws Exception {
FormattedPrinter.SYSOUT.print("formatting String '" + unix.substring(0, Math.min(50, unix.length() - 1)) + "[...]' in file '" + file + "'");
FormattedPrinter.SYSOUT.print("formatting String '" + unix.substring(0, Math.min(50, unix.length())) + "[...]' in file '" + file + "'");

final String prettierConfigOptionsWithFilepath = assertFilepathInConfigOptions(file);
return restService.format(unix, prettierConfigOptionsWithFilepath);
Expand Down
1 change: 1 addition & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
### Fixed
* `ratchetFrom` now works with git-submodule ([#746](https://github.com/diffplug/spotless/issues/746))
* ktfmt v0.19+ with dropbox-style works again ([#765](https://github.com/diffplug/spotless/pull/765)).
* prettier no longer throws errors on empty files ([#751](https://github.com/diffplug/spotless/pull/751)).

## [5.8.2] - 2020-11-16
### Fixed
Expand Down
1 change: 1 addition & 0 deletions plugin-maven/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
* `ratchetFrom` now works with git-submodule ([#746](https://github.com/diffplug/spotless/issues/746))
* Fix broken test for spotlessFiles parameter on windows ([#737](https://github.com/diffplug/spotless/pull/737))
* ktfmt v0.19+ with dropbox-style works again ([#765](https://github.com/diffplug/spotless/pull/765)).
* prettier no longer throws errors on empty files ([#751](https://github.com/diffplug/spotless/pull/751)).

## [2.6.1] - 2020-11-16
### Fixed
Expand Down

0 comments on commit be2150c

Please sign in to comment.