Skip to content

Commit b6e30f8

Browse files
authored
fix: resolve failing useEslintXoStandardRules test by bumping eslint and styleguide versions (#1761 fixes #1756)
2 parents 46ee809 + a72b475 commit b6e30f8

File tree

7 files changed

+21
-18
lines changed

7 files changed

+21
-18
lines changed

CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
1111

1212
## [Unreleased]
1313
### Fixed
14+
* Use latest versions of popular style guides for `eslint` tests to fix failing `useEslintXoStandardRules` test. ([#1761](https://github.com/diffplug/spotless/pull/1761), [#1756](https://github.com/diffplug/spotless/issues/1756))
1415
* Add support for `prettier` version `3.0.0` and newer. ([#1760]https://github.com/diffplug/spotless/pull/1760), [#1751](https://github.com/diffplug/spotless/issues/1751))
1516
* Fix npm install calls when npm cache is not up-to-date. ([#1760]https://github.com/diffplug/spotless/pull/1760), [#1750](https://github.com/diffplug/spotless/issues/1750))
1617
### Changes
18+
* Bump default `eslint` version to latest `8.31.0` -> `8.45.0` ([#1761](https://github.com/diffplug/spotless/pull/1761))
1719
* Bump default `prettier` version to latest (v2) `2.8.1` -> `2.8.8`. ([#1760](https://github.com/diffplug/spotless/pull/1760))
1820

1921
## [2.40.0] - 2023-07-17

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ public class EslintFormatterStep {
4747

4848
public static final String NAME = "eslint-format";
4949

50-
public static final String DEFAULT_ESLINT_VERSION = "^8.31.0";
50+
public static final String DEFAULT_ESLINT_VERSION = "^8.45.0";
5151

5252
public static Map<String, String> defaultDevDependenciesForTypescript() {
5353
return defaultDevDependenciesTypescriptWithEslint(DEFAULT_ESLINT_VERSION);
5454
}
5555

5656
public static Map<String, String> defaultDevDependenciesTypescriptWithEslint(String eslintVersion) {
5757
Map<String, String> dependencies = new LinkedHashMap<>();
58-
dependencies.put("@typescript-eslint/eslint-plugin", "^5.47.0");
59-
dependencies.put("@typescript-eslint/parser", "^5.47.0");
60-
dependencies.put("typescript", "^4.9.4");
58+
dependencies.put("@typescript-eslint/eslint-plugin", "^6.1.0");
59+
dependencies.put("@typescript-eslint/parser", "^6.1.0");
60+
dependencies.put("typescript", "^5.1.6");
6161
dependencies.put("eslint", Objects.requireNonNull(eslintVersion));
6262
return dependencies;
6363
}

plugin-gradle/CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
77
* Add support for `prettier` version `3.0.0` and newer. ([#1760]https://github.com/diffplug/spotless/pull/1760), [#1751](https://github.com/diffplug/spotless/issues/1751))
88
* Fix npm install calls when npm cache is not up-to-date. ([#1760]https://github.com/diffplug/spotless/pull/1760), [#1750](https://github.com/diffplug/spotless/issues/1750))
99
### Changes
10+
* Bump default `eslint` version to latest `8.31.0` -> `8.45.0` ([#1761](https://github.com/diffplug/spotless/pull/1761))
1011
* Bump default `prettier` version to latest (v2) `2.8.1` -> `2.8.8`. ([#1760](https://github.com/diffplug/spotless/pull/1760))
1112

1213
## [6.20.0] - 2023-07-17
@@ -28,6 +29,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
2829
* Bump default `ktlint` version to latest `0.49.1` -> `0.50.0`. ([#1741](https://github.com/diffplug/spotless/issues/1741))
2930
* Dropped support for `ktlint 0.47.x` following our policy of supporting two breaking changes at a time.
3031
* Dropped support for deprecated `useExperimental` parameter in favor of the `ktlint_experimental` property.
32+
3133
## [6.19.0] - 2023-05-24
3234
### Added
3335
* Support Rome as a formatter for JavaScript and TypeScript code. Adds a new `rome` step to `javascript` and `typescript` formatter configurations. ([#1663](https://github.com/diffplug/spotless/pull/1663))

plugin-gradle/src/test/java/com/diffplug/gradle/spotless/TypescriptExtensionTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import java.io.IOException;
1919

20-
import org.junit.jupiter.api.Disabled;
2120
import org.junit.jupiter.api.Test;
2221

2322
import com.diffplug.spotless.npm.EslintFormatterStep;
@@ -170,7 +169,6 @@ void useEslint() throws IOException {
170169
}
171170

172171
@Test
173-
@Disabled("https://github.com/diffplug/spotless/issues/1756")
174172
void useEslintXoStandardRules() throws IOException {
175173
setFile(".eslintrc.js").toResource("npm/eslint/typescript/styleguide/xo/.eslintrc.js");
176174
setFile("tsconfig.json").toResource("npm/eslint/typescript/styleguide/xo/tsconfig.json");

plugin-maven/CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
77
* Add support for `prettier` version `3.0.0` and newer. ([#1760]https://github.com/diffplug/spotless/pull/1760), [#1751](https://github.com/diffplug/spotless/issues/1751))
88
* Fix npm install calls when npm cache is not up-to-date. ([#1760]https://github.com/diffplug/spotless/pull/1760), [#1750](https://github.com/diffplug/spotless/issues/1750))
99
### Changes
10+
* Bump default `eslint` version to latest `8.31.0` -> `8.45.0` ([#1761](https://github.com/diffplug/spotless/pull/1761))
1011
* Bump default `prettier` version to latest (v2) `2.8.1` -> `2.8.8`. ([#1760](https://github.com/diffplug/spotless/pull/1760))
1112

1213
## [2.38.0] - 2023-07-17

plugin-maven/src/test/java/com/diffplug/spotless/maven/typescript/TypescriptFormatStepTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import java.io.IOException;
2121

22-
import org.junit.jupiter.api.Disabled;
2322
import org.junit.jupiter.api.Test;
2423

2524
import com.diffplug.spotless.ProcessRunner;
@@ -211,7 +210,6 @@ void eslintStyleguideStandardWithTypescript() throws Exception {
211210
}
212211

213212
@Test
214-
@Disabled("https://github.com/diffplug/spotless/issues/1756")
215213
void eslintStyleguideXo() throws Exception {
216214
writePomWithTypescriptSteps(
217215
TEST_FILE_PATH,

testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java

+12-10
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ public enum EslintStyleGuide {
2929
@Override
3030
public @Nonnull Map<String, String> devDependencies() {
3131
Map<String, String> dependencies = new LinkedHashMap<>();
32-
dependencies.put("eslint-config-standard-with-typescript", "^24.0.0");
33-
dependencies.put("eslint-plugin-import", "^2.26.0");
34-
dependencies.put("eslint-plugin-n", "^15.6.0");
32+
dependencies.put("@typescript-eslint/eslint-plugin", "^5.62.0");
33+
dependencies.put("@typescript-eslint/parser", "^5.62.0");
34+
dependencies.put("eslint-config-standard-with-typescript", "^36.0.1");
35+
dependencies.put("eslint-plugin-import", "^2.27.5");
36+
dependencies.put("eslint-plugin-n", "^16.0.1");
3537
dependencies.put("eslint-plugin-promise", "^6.1.1");
3638
return dependencies;
3739
}
@@ -41,7 +43,7 @@ public enum EslintStyleGuide {
4143
public @Nonnull Map<String, String> devDependencies() {
4244
Map<String, String> dependencies = new LinkedHashMap<>();
4345
dependencies.put("eslint-config-xo", "^0.43.1");
44-
dependencies.put("eslint-config-xo-typescript", "^0.55.1");
46+
dependencies.put("eslint-config-xo-typescript", "^1.0.0");
4547
return dependencies;
4648
}
4749
},
@@ -50,7 +52,7 @@ public enum EslintStyleGuide {
5052
public @Nonnull Map<String, String> devDependencies() {
5153
Map<String, String> dependencies = new LinkedHashMap<>();
5254
dependencies.put("eslint-config-airbnb-base", "^15.0.0");
53-
dependencies.put("eslint-plugin-import", "^2.26.0");
55+
dependencies.put("eslint-plugin-import", "^2.27.5");
5456
return dependencies;
5557
}
5658
},
@@ -66,9 +68,9 @@ public enum EslintStyleGuide {
6668
@Override
6769
public @Nonnull Map<String, String> devDependencies() {
6870
Map<String, String> dependencies = new LinkedHashMap<>();
69-
dependencies.put("eslint-config-standard", "^17.0.0");
70-
dependencies.put("eslint-plugin-import", "^2.26.0");
71-
dependencies.put("eslint-plugin-n", "^15.6.0");
71+
dependencies.put("eslint-config-standard", "^17.1.0");
72+
dependencies.put("eslint-plugin-import", "^2.27.5");
73+
dependencies.put("eslint-plugin-n", "^16.0.1");
7274
dependencies.put("eslint-plugin-promise", "^6.1.1");
7375
return dependencies;
7476
}
@@ -113,8 +115,8 @@ public String asGradleMapStringMergedWith(Map<String, String> devDependencies) {
113115

114116
public String asMavenXmlStringMergedWith(Map<String, String> devDependencies) {
115117
return mergedWith(devDependencies).entrySet().stream()
116-
.map(entry -> "<" + entry.getKey() + ">" + entry.getValue() + "</" + entry.getKey() + ">")
117-
.collect(Collectors.joining("", "<devDependencies>", "</devDependencies>"));
118+
.map(entry -> String.format("<property><name>%s</name><value>%s</value></property>", entry.getKey(), entry.getValue()))
119+
.collect(Collectors.joining("", "<devDependencyProperties>", "</devDependencyProperties>"));
118120
}
119121

120122
}

0 commit comments

Comments
 (0)