From f45e47061cda55cb3d3996e01ab7a9c912d2796f Mon Sep 17 00:00:00 2001 From: Rodrigo Aguilera Date: Fri, 5 Jun 2026 12:08:05 +0200 Subject: [PATCH 1/3] 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/3] 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/3] 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,