Skip to content

Commit 52c79e7

Browse files
authored
Prettier was assuming files were always 50+ characters long (#699)
2 parents 1e492ab + aa8a17f commit 52c79e7

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ This document is intended for Spotless developers.
1010
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`).
1111

1212
## [Unreleased]
13+
### Fixed
14+
* Don't assume that file content passed into Prettier is at least 50 characters (https://github.com/diffplug/spotless/pull/699).
1315

1416
## [2.6.1] - 2020-09-12
1517
### Fixed

lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public PrettierFilePathPassingFormatterFunc(String prettierConfigOptions, Pretti
113113

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

118118
final String prettierConfigOptionsWithFilepath = assertFilepathInConfigOptions(file);
119119
return restService.format(unix, prettierConfigOptionsWithFilepath);

plugin-gradle/CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`).
44

55
## [Unreleased]
6+
### Fixed
7+
* Don't assume that file content passed into Prettier is at least 50 characters (https://github.com/diffplug/spotless/pull/699).
68

79
## [5.5.1] - 2020-09-12
810
### Fixed

plugin-maven/CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`).
44

55
## [Unreleased]
6+
### Fixed
7+
* Don't assume that file content passed into Prettier is at least 50 characters (https://github.com/diffplug/spotless/pull/699).
68

79
## [2.4.0] - 2020-09-17
810
### Added

0 commit comments

Comments
 (0)