From 1dd92dae300aa59af0f640467cf6757898df9acf Mon Sep 17 00:00:00 2001 From: Simon Gamma Date: Tue, 18 Jul 2023 14:31:04 +0200 Subject: [PATCH 1/6] chore: bump default eslint version --- .../com/diffplug/spotless/npm/EslintFormatterStep.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/main/java/com/diffplug/spotless/npm/EslintFormatterStep.java b/lib/src/main/java/com/diffplug/spotless/npm/EslintFormatterStep.java index a4480fe7fc..cee51b8518 100644 --- a/lib/src/main/java/com/diffplug/spotless/npm/EslintFormatterStep.java +++ b/lib/src/main/java/com/diffplug/spotless/npm/EslintFormatterStep.java @@ -47,7 +47,7 @@ public class EslintFormatterStep { public static final String NAME = "eslint-format"; - public static final String DEFAULT_ESLINT_VERSION = "^8.31.0"; + public static final String DEFAULT_ESLINT_VERSION = "^8.45.0"; public static Map defaultDevDependenciesForTypescript() { return defaultDevDependenciesTypescriptWithEslint(DEFAULT_ESLINT_VERSION); @@ -55,9 +55,9 @@ public static Map defaultDevDependenciesForTypescript() { public static Map defaultDevDependenciesTypescriptWithEslint(String eslintVersion) { Map dependencies = new LinkedHashMap<>(); - dependencies.put("@typescript-eslint/eslint-plugin", "^5.47.0"); - dependencies.put("@typescript-eslint/parser", "^5.47.0"); - dependencies.put("typescript", "^4.9.4"); + dependencies.put("@typescript-eslint/eslint-plugin", "^6.1.0"); + dependencies.put("@typescript-eslint/parser", "^6.1.0"); + dependencies.put("typescript", "^5.1.6"); dependencies.put("eslint", Objects.requireNonNull(eslintVersion)); return dependencies; } From e4c9bc8ea3bb4741e3e96b0256b2318097853c9e Mon Sep 17 00:00:00 2001 From: Simon Gamma Date: Tue, 18 Jul 2023 14:32:46 +0200 Subject: [PATCH 2/6] chore: bump eslint styleguide versions This fixes #1756 --- .../gradle/spotless/TypescriptExtensionTest.java | 2 -- .../diffplug/spotless/npm/EslintStyleGuide.java | 16 ++++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/TypescriptExtensionTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/TypescriptExtensionTest.java index eaf2729296..9b4ec8372e 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/TypescriptExtensionTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/TypescriptExtensionTest.java @@ -17,7 +17,6 @@ import java.io.IOException; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import com.diffplug.spotless.npm.EslintFormatterStep; @@ -170,7 +169,6 @@ void useEslint() throws IOException { } @Test - @Disabled("https://github.com/diffplug/spotless/issues/1756") void useEslintXoStandardRules() throws IOException { setFile(".eslintrc.js").toResource("npm/eslint/typescript/styleguide/xo/.eslintrc.js"); setFile("tsconfig.json").toResource("npm/eslint/typescript/styleguide/xo/tsconfig.json"); diff --git a/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java b/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java index 62d0b0aa00..ad5cb2ba2e 100644 --- a/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java +++ b/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java @@ -29,9 +29,9 @@ public enum EslintStyleGuide { @Override public @Nonnull Map devDependencies() { Map dependencies = new LinkedHashMap<>(); - dependencies.put("eslint-config-standard-with-typescript", "^24.0.0"); - dependencies.put("eslint-plugin-import", "^2.26.0"); - dependencies.put("eslint-plugin-n", "^15.6.0"); + dependencies.put("eslint-config-standard-with-typescript", "^36.1.0"); + dependencies.put("eslint-plugin-import", "^2.27.5"); + dependencies.put("eslint-plugin-n", "^16.0.1"); dependencies.put("eslint-plugin-promise", "^6.1.1"); return dependencies; } @@ -41,7 +41,7 @@ public enum EslintStyleGuide { public @Nonnull Map devDependencies() { Map dependencies = new LinkedHashMap<>(); dependencies.put("eslint-config-xo", "^0.43.1"); - dependencies.put("eslint-config-xo-typescript", "^0.55.1"); + dependencies.put("eslint-config-xo-typescript", "^1.0.0"); return dependencies; } }, @@ -50,7 +50,7 @@ public enum EslintStyleGuide { public @Nonnull Map devDependencies() { Map dependencies = new LinkedHashMap<>(); dependencies.put("eslint-config-airbnb-base", "^15.0.0"); - dependencies.put("eslint-plugin-import", "^2.26.0"); + dependencies.put("eslint-plugin-import", "^2.27.5"); return dependencies; } }, @@ -66,9 +66,9 @@ public enum EslintStyleGuide { @Override public @Nonnull Map devDependencies() { Map dependencies = new LinkedHashMap<>(); - dependencies.put("eslint-config-standard", "^17.0.0"); - dependencies.put("eslint-plugin-import", "^2.26.0"); - dependencies.put("eslint-plugin-n", "^15.6.0"); + dependencies.put("eslint-config-standard", "^17.1.0"); + dependencies.put("eslint-plugin-import", "^2.27.5"); + dependencies.put("eslint-plugin-n", "^16.0.1"); dependencies.put("eslint-plugin-promise", "^6.1.1"); return dependencies; } From ccbbd4c3224b224cb254e5fa42f490675601b09e Mon Sep 17 00:00:00 2001 From: Simon Gamma Date: Tue, 18 Jul 2023 14:39:05 +0200 Subject: [PATCH 3/6] docs: add changed eslint version info --- CHANGES.md | 4 ++++ plugin-gradle/CHANGES.md | 3 ++- plugin-maven/CHANGES.md | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index cc6dcd7331..7da7e20ef3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,10 @@ This document is intended for Spotless developers. We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`). ## [Unreleased] +### Fixed +* Use latest versions of popular style guides for `eslint` tests to fix failing `useEslintXoStandardRules` test. ([#9999](https://github.com/diffplug/spotless/pull/9999), [#1756](https://github.com/diffplug/spotless/issues/1756)) +### Changes +* Bump default `eslint` version to latest `8.31.0` -> `8.45.0` ([#9999](https://github.com/diffplug/spotless/pull/9999)) ## [2.40.0] - 2023-07-17 ### Added diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index 6d8bee7169..dfaaab678f 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -3,7 +3,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`). ## [Unreleased] - +### Changes +* Bump default `eslint` version to latest `8.31.0` -> `8.45.0` ([#9999](https://github.com/diffplug/spotless/pull/9999)) ## [6.20.0] - 2023-07-17 ### Added * Add target option `targetExcludeIfContentContains` and `targetExcludeIfContentContainsRegex` to exclude files based on their text content. ([#1749](https://github.com/diffplug/spotless/pull/1749)) diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index 72d40dfe10..06f47866e6 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -3,6 +3,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`). ## [Unreleased] +### Changes +* Bump default `eslint` version to latest `8.31.0` -> `8.45.0` ([#9999](https://github.com/diffplug/spotless/pull/9999)) ## [2.38.0] - 2023-07-17 ### Added From 6afb6110257124933e8653e8eb4f32c09e302a01 Mon Sep 17 00:00:00 2001 From: Simon Gamma Date: Tue, 18 Jul 2023 14:40:37 +0200 Subject: [PATCH 4/6] docs: adapt for actual pr number --- CHANGES.md | 4 ++-- plugin-gradle/CHANGES.md | 2 +- plugin-maven/CHANGES.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 7da7e20ef3..4ac5063b70 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,9 +11,9 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] ### Fixed -* Use latest versions of popular style guides for `eslint` tests to fix failing `useEslintXoStandardRules` test. ([#9999](https://github.com/diffplug/spotless/pull/9999), [#1756](https://github.com/diffplug/spotless/issues/1756)) +* 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)) ### Changes -* Bump default `eslint` version to latest `8.31.0` -> `8.45.0` ([#9999](https://github.com/diffplug/spotless/pull/9999)) +* Bump default `eslint` version to latest `8.31.0` -> `8.45.0` ([#1761](https://github.com/diffplug/spotless/pull/1761)) ## [2.40.0] - 2023-07-17 ### Added diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index dfaaab678f..6057fe94ab 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -4,7 +4,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] ### Changes -* Bump default `eslint` version to latest `8.31.0` -> `8.45.0` ([#9999](https://github.com/diffplug/spotless/pull/9999)) +* Bump default `eslint` version to latest `8.31.0` -> `8.45.0` ([#1761](https://github.com/diffplug/spotless/pull/1761)) ## [6.20.0] - 2023-07-17 ### Added * Add target option `targetExcludeIfContentContains` and `targetExcludeIfContentContainsRegex` to exclude files based on their text content. ([#1749](https://github.com/diffplug/spotless/pull/1749)) diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index 06f47866e6..75ee7a5b27 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -4,7 +4,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] ### Changes -* Bump default `eslint` version to latest `8.31.0` -> `8.45.0` ([#9999](https://github.com/diffplug/spotless/pull/9999)) +* Bump default `eslint` version to latest `8.31.0` -> `8.45.0` ([#1761](https://github.com/diffplug/spotless/pull/1761)) ## [2.38.0] - 2023-07-17 ### Added From 3577f4e2d4d42b7bf055067827e36194a984afef Mon Sep 17 00:00:00 2001 From: Simon Gamma Date: Tue, 18 Jul 2023 15:27:13 +0200 Subject: [PATCH 5/6] fix: provide "lower" default versions for ts_standard as the upstream package has incompatible version restrictions otherwise --- .../main/java/com/diffplug/spotless/npm/EslintStyleGuide.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java b/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java index ad5cb2ba2e..cb6f1325df 100644 --- a/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java +++ b/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java @@ -29,7 +29,9 @@ public enum EslintStyleGuide { @Override public @Nonnull Map devDependencies() { Map dependencies = new LinkedHashMap<>(); - dependencies.put("eslint-config-standard-with-typescript", "^36.1.0"); + dependencies.put("@typescript-eslint/eslint-plugin", "^5.62.0"); + dependencies.put("@typescript-eslint/parser", "^5.62.0"); + dependencies.put("eslint-config-standard-with-typescript", "^36.0.1"); dependencies.put("eslint-plugin-import", "^2.27.5"); dependencies.put("eslint-plugin-n", "^16.0.1"); dependencies.put("eslint-plugin-promise", "^6.1.1"); From aa4893b1942778c3d7b69dae89977cb0aba2b13c Mon Sep 17 00:00:00 2001 From: Simon Gamma Date: Tue, 18 Jul 2023 15:55:50 +0200 Subject: [PATCH 6/6] fix: create valid poms when using eslint styleguides (and enable the missed and disabled xo test in maven part) --- .../spotless/maven/typescript/TypescriptFormatStepTest.java | 2 -- .../main/java/com/diffplug/spotless/npm/EslintStyleGuide.java | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/plugin-maven/src/test/java/com/diffplug/spotless/maven/typescript/TypescriptFormatStepTest.java b/plugin-maven/src/test/java/com/diffplug/spotless/maven/typescript/TypescriptFormatStepTest.java index 911cfad201..a09111d30d 100644 --- a/plugin-maven/src/test/java/com/diffplug/spotless/maven/typescript/TypescriptFormatStepTest.java +++ b/plugin-maven/src/test/java/com/diffplug/spotless/maven/typescript/TypescriptFormatStepTest.java @@ -19,7 +19,6 @@ import java.io.IOException; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import com.diffplug.spotless.ProcessRunner; @@ -211,7 +210,6 @@ void eslintStyleguideStandardWithTypescript() throws Exception { } @Test - @Disabled("https://github.com/diffplug/spotless/issues/1756") void eslintStyleguideXo() throws Exception { writePomWithTypescriptSteps( TEST_FILE_PATH, diff --git a/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java b/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java index cb6f1325df..874ae1905d 100644 --- a/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java +++ b/testlib/src/main/java/com/diffplug/spotless/npm/EslintStyleGuide.java @@ -115,8 +115,8 @@ public String asGradleMapStringMergedWith(Map devDependencies) { public String asMavenXmlStringMergedWith(Map devDependencies) { return mergedWith(devDependencies).entrySet().stream() - .map(entry -> "<" + entry.getKey() + ">" + entry.getValue() + "") - .collect(Collectors.joining("", "", "")); + .map(entry -> String.format("%s%s", entry.getKey(), entry.getValue())) + .collect(Collectors.joining("", "", "")); } }