From f45e47061cda55cb3d3996e01ab7a9c912d2796f Mon Sep 17 00:00:00 2001 From: Rodrigo Aguilera Date: Fri, 5 Jun 2026 12:08:05 +0200 Subject: [PATCH 1/4] Add cache CLI options for eslint --- src/Task/ESLint.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Task/ESLint.php b/src/Task/ESLint.php index 51816c3d2..5caf14978 100644 --- a/src/Task/ESLint.php +++ b/src/Task/ESLint.php @@ -34,6 +34,8 @@ public static function getConfigurableOptions(): ConfigOptionsResolver // ESLint native config options 'config' => null, 'ignore_path' => null, + 'cache' => null, + 'cache_location' => null, 'debug' => false, 'format' => null, 'max_warnings' => null, @@ -49,6 +51,8 @@ public static function getConfigurableOptions(): ConfigOptionsResolver // ESLint native config options $resolver->addAllowedTypes('config', ['null', 'string']); $resolver->addAllowedTypes('ignore_path', ['null', 'string']); + $resolver->addAllowedTypes('cache', ['null', 'bool']); + $resolver->addAllowedTypes('cache_location', ['null', 'string']); $resolver->addAllowedTypes('debug', ['bool']); $resolver->addAllowedTypes('format', ['null', 'string']); $resolver->addAllowedTypes('max_warnings', ['null', 'integer']); @@ -82,6 +86,8 @@ public function run(ContextInterface $context): TaskResultInterface $arguments->addOptionalArgument('--config=%s', $config['config']); $arguments->addOptionalArgument('--ignore-path=%s', $config['ignore_path']); + $arguments->addOptionalArgument('--cache', $config['cache']); + $arguments->addOptionalArgument('--cache-location=%s', $config['cache_location']); $arguments->addOptionalArgument('--debug', $config['debug']); $arguments->addOptionalArgument('--format=%s', $config['format']); $arguments->addOptionalArgument('--no-eslintrc', $config['no_eslintrc']); From c5a134f19e5325ac702ecf85a4c3a9c3f88bd917 Mon Sep 17 00:00:00 2001 From: Rodrigo Aguilera Date: Fri, 5 Jun 2026 12:13:52 +0200 Subject: [PATCH 2/4] Add docs --- doc/tasks/eslint.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/tasks/eslint.md b/doc/tasks/eslint.md index f4ea16721..0ba1e4074 100644 --- a/doc/tasks/eslint.md +++ b/doc/tasks/eslint.md @@ -34,6 +34,8 @@ grumphp: - /^resources\/js\/(.*)/ config: .eslintrc.json ignore_path: .eslintignore + cache: ~ + cache_location: ~ debug: false format: ~ max_warnings: ~ @@ -79,6 +81,18 @@ The path to your eslint's configuration file. Not necessary if using a standard The path to your eslint's ignore file ([eslint.org](https://eslint.org/docs/user-guide/configuring/ignoring-code#using-an-alternate-file)). Not necessary if using standard .eslintignore name. +**cache** + +*Default: null* + +Store the results of processed files so that eslint only operates on the changed ones. By default, the cache is stored in `./.eslintcache ` in `process.cwd()`. ([eslint.org](https://eslint.org/docs/latest/use/command-line-interface#caching)). + +**cache_location** + +*Default: null* + +Path to a file or directory for the cache location. ([eslint.org](https://eslint.org/docs/latest/use/command-line-interface#--cache-location)). + **debug** *Default: false* From a75b3f8fc44ec830a031ae7bfcbed3ab04719494 Mon Sep 17 00:00:00 2001 From: Rodrigo Aguilera Date: Fri, 5 Jun 2026 14:53:42 +0200 Subject: [PATCH 3/4] Add tests for new eslint cache config --- test/Unit/Task/ESLintTest.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/Unit/Task/ESLintTest.php b/test/Unit/Task/ESLintTest.php index e6a298abf..1fe88cfbb 100644 --- a/test/Unit/Task/ESLintTest.php +++ b/test/Unit/Task/ESLintTest.php @@ -34,6 +34,8 @@ public static function provideConfigurableOptions(): iterable // ESLint native config options 'config' => null, 'ignore_path' => null, + 'cache' => null, + 'cache_location' => null, 'debug' => false, 'format' => null, 'max_warnings' => null, @@ -146,6 +148,30 @@ public static function provideExternalTaskRuns(): iterable 'hello2.js', ] ]; + yield 'cache' => [ + [ + 'cache' => true, + ], + self::mockContext(RunContext::class, ['hello.js', 'hello2.js']), + 'stylelint', + [ + '--cache', + 'hello.js', + 'hello2.js', + ] + ]; + yield 'cache_location' => [ + [ + 'cache_location' => 'path/to/cache', + ], + self::mockContext(RunContext::class, ['hello.js', 'hello2.js']), + 'stylelint', + [ + '--cache-location=path/to/cache', + 'hello.js', + 'hello2.js', + ] + ]; yield 'debug' => [ [ 'debug' => true, From ed5cac92d2b92fd6965df7821e5ef51045c102c1 Mon Sep 17 00:00:00 2001 From: Toon Verwerft Date: Wed, 17 Jun 2026 16:06:39 +0200 Subject: [PATCH 4/4] Fix ESLint cache test expected binary name The new cache and cache_location data sets declared 'stylelint' as the expected binary, so the ProcessBuilder double (configured for 'eslint') returned null and the tests errored. --- test/Unit/Task/ESLintTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Unit/Task/ESLintTest.php b/test/Unit/Task/ESLintTest.php index 1fe88cfbb..7ff89ad6f 100644 --- a/test/Unit/Task/ESLintTest.php +++ b/test/Unit/Task/ESLintTest.php @@ -153,7 +153,7 @@ public static function provideExternalTaskRuns(): iterable 'cache' => true, ], self::mockContext(RunContext::class, ['hello.js', 'hello2.js']), - 'stylelint', + 'eslint', [ '--cache', 'hello.js', @@ -165,7 +165,7 @@ public static function provideExternalTaskRuns(): iterable 'cache_location' => 'path/to/cache', ], self::mockContext(RunContext::class, ['hello.js', 'hello2.js']), - 'stylelint', + 'eslint', [ '--cache-location=path/to/cache', 'hello.js',