Skip to content

Loosen apiClient ESLint rule on Security#252212

Merged
steliosmavro merged 6 commits intoelastic:mainfrom
steliosmavro:loosen-api-client-eslint-rule-on-security
Feb 11, 2026
Merged

Loosen apiClient ESLint rule on Security#252212
steliosmavro merged 6 commits intoelastic:mainfrom
steliosmavro:loosen-api-client-eslint-rule-on-security

Conversation

@steliosmavro
Copy link
Copy Markdown
Contributor

@steliosmavro steliosmavro commented Feb 8, 2026

Summary

The Security Solution team has test cases that intentionally use esClient directly without apiClient, so enforcing the scout_require_api_client_in_api_test rule on their scout tests produces false positives. Instead of excluding Security Solution from the rule entirely, this PR enhances the rule with a configurable alternativeFixtures schema option so it can accept additional fixtures per directory.

Changes

  • Added alternativeFixtures schema option to scout_require_api_client_in_api_test, allowing directories to configure additional accepted fixtures via .eslintrc.js
  • Generalized functionUsesApiClient to functionUsesFixture, parameterizing the fixture name so the same detection logic works for any fixture
  • Error messages are dynamic and list only the accepted fixtures for the given configuration
  • Added a Security Solution override in .eslintrc.js with alternativeFixtures: ['esClient'] so their tests accept either apiClient or esClient
  • Added unit tests for the new alternativeFixtures option

@steliosmavro steliosmavro self-assigned this Feb 8, 2026
@steliosmavro steliosmavro added the release_note:skip Skip the PR/issue when compiling release notes label Feb 8, 2026
@steliosmavro steliosmavro requested review from a team as code owners February 8, 2026 07:23
@steliosmavro steliosmavro added the backport:all-open Backport to all branches that could still receive a release label Feb 8, 2026
@steliosmavro steliosmavro linked an issue Feb 8, 2026 that may be closed by this pull request
Comment thread .eslintrc.js
Comment on lines +2722 to +2734
{
// Security Solution
files: [
'x-pack/solutions/security/**/plugins/**/test/{scout,scout_*}/**/*.ts',
'x-pack/platform/**/plugins/**/security/**/test/{scout,scout_*}/**/*.ts',
],
rules: {
'@kbn/eslint/scout_require_api_client_in_api_test': [
'error',
{ alternativeFixtures: ['esClient'] },
],
},
},
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I say "Security Solution" but x-pack/platform/**/plugins/**/security/**/test/{scout,scout_*}/**/*.ts is not security solution - it's just a platform plugin, correct?

If yes, do you have any better name suggestions for this section?

cc @dmlemeshko

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's allow it globally, it will be annoying to update .eslintrc.js every time a new team decided to use only esClient for api tests.

As Sophie pointed out, it is totally fine to use apiClient or esClient for API tests when Teams think this what they want to do.

Comment on lines +16 to +17
const ALT_ERROR_MSG =
'One of `apiClient` or `esArchiver` fixtures should be used in `apiTest` to interact with an endpoint and later verify the response.';
Copy link
Copy Markdown
Contributor

@dmlemeshko dmlemeshko Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apiClient or esClient.

esArchiver should be actually disallowed to be used in test block

});

// --- Tests with alternativeFixtures option ---
const altOptions = [{ alternativeFixtures: ['esArchiver'] }];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apiClient has to be set here

Comment on lines +253 to +256
code: dedent`
apiTest('uses esArchiver', async ({ esArchiver }) => {
await esArchiver.load('path/to/archive');
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apiClient

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Feb 10, 2026

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #98 / serverless observability UI - telemetry discover/observabilitySolution/context_awareness/telemetry telemetry context should set EBT context for telemetry events when logs data source profile and reset
  • [job] [logs] FTR Configs #98 / serverless observability UI - telemetry discover/observabilitySolution/context_awareness/telemetry telemetry context should set EBT context for telemetry events when logs data source profile and reset

Metrics [docs]

Unknown metric groups

ESLint disabled in files

id before after diff
entityStore 3 0 -3

Total ESLint disabled count

id before after diff
entityStore 3 0 -3

History

cc @steliosmavro

@steliosmavro steliosmavro merged commit 24d327b into elastic:main Feb 11, 2026
16 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19, 9.2, 9.3

https://github.com/elastic/kibana/actions/runs/21894140720

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
8.19 Backport failed because of merge conflicts
9.2 Backport failed because of merge conflicts
9.3 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.3:
- Update kubernetes templates for elastic-agent (#247970)
- [CI] Move faster beta build to default (#252200)
- [scout] run dashboard test in few workers to speed up CI (#252379)

Manual backport

To create the backport manually run:

node scripts/backport --pr 252212

Questions ?

Please refer to the Backport tool documentation

tylersmalley added a commit to tylersmalley/kibana that referenced this pull request Feb 11, 2026
Fix jest failure on main caused by the now-unnecessary disable comment
after the ESLint rule was loosened in 24d327b (elastic#252212).
tylersmalley added a commit that referenced this pull request Feb 11, 2026
…st (#252650)

Fix jest failure on main caused by the now-unnecessary disable comment
after the ESLint rule was loosened in 24d327b (#252212).
steliosmavro added a commit to steliosmavro/kibana that referenced this pull request Feb 11, 2026
## Summary

The Security Solution team has test cases that intentionally use
`esClient` directly without `apiClient`, so enforcing the
`scout_require_api_client_in_api_test` rule on their scout tests
produces false positives. Instead of excluding Security Solution from
the rule entirely, this PR enhances the rule with a configurable
`alternativeFixtures` schema option so it can accept additional fixtures
per directory.

## Changes

- Added `alternativeFixtures` schema option to
`scout_require_api_client_in_api_test`, allowing directories to
configure additional accepted fixtures via `.eslintrc.js`
- Generalized `functionUsesApiClient` to `functionUsesFixture`,
parameterizing the fixture name so the same detection logic works for
any fixture
- Error messages are dynamic and list only the accepted fixtures for the
given configuration
- Added a Security Solution override in `.eslintrc.js` with
`alternativeFixtures: ['esClient']` so their tests accept either
`apiClient` or `esClient`
- Added unit tests for the new `alternativeFixtures` option

---------

Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
(cherry picked from commit 24d327b)

# Conflicts:
#	x-pack/solutions/security/plugins/entity_store/test/scout/api/tests/dsl_translation.spec.ts
#	x-pack/solutions/security/plugins/entity_store/test/scout/api/tests/esql_translation.spec.ts
#	x-pack/solutions/security/plugins/entity_store/test/scout/api/tests/painless_translation.spec.ts
steliosmavro added a commit to steliosmavro/kibana that referenced this pull request Feb 11, 2026
## Summary

The Security Solution team has test cases that intentionally use
`esClient` directly without `apiClient`, so enforcing the
`scout_require_api_client_in_api_test` rule on their scout tests
produces false positives. Instead of excluding Security Solution from
the rule entirely, this PR enhances the rule with a configurable
`alternativeFixtures` schema option so it can accept additional fixtures
per directory.

## Changes

- Added `alternativeFixtures` schema option to
`scout_require_api_client_in_api_test`, allowing directories to
configure additional accepted fixtures via `.eslintrc.js`
- Generalized `functionUsesApiClient` to `functionUsesFixture`,
parameterizing the fixture name so the same detection logic works for
any fixture
- Error messages are dynamic and list only the accepted fixtures for the
given configuration
- Added a Security Solution override in `.eslintrc.js` with
`alternativeFixtures: ['esClient']` so their tests accept either
`apiClient` or `esClient`
- Added unit tests for the new `alternativeFixtures` option

---------

Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
(cherry picked from commit 24d327b)

# Conflicts:
#	.eslintrc.js
#	x-pack/solutions/security/plugins/entity_store/test/scout/api/tests/dsl_translation.spec.ts
#	x-pack/solutions/security/plugins/entity_store/test/scout/api/tests/esql_translation.spec.ts
#	x-pack/solutions/security/plugins/entity_store/test/scout/api/tests/painless_translation.spec.ts
steliosmavro added a commit to steliosmavro/kibana that referenced this pull request Feb 11, 2026
## Summary

The Security Solution team has test cases that intentionally use
`esClient` directly without `apiClient`, so enforcing the
`scout_require_api_client_in_api_test` rule on their scout tests
produces false positives. Instead of excluding Security Solution from
the rule entirely, this PR enhances the rule with a configurable
`alternativeFixtures` schema option so it can accept additional fixtures
per directory.

## Changes

- Added `alternativeFixtures` schema option to
`scout_require_api_client_in_api_test`, allowing directories to
configure additional accepted fixtures via `.eslintrc.js`
- Generalized `functionUsesApiClient` to `functionUsesFixture`,
parameterizing the fixture name so the same detection logic works for
any fixture
- Error messages are dynamic and list only the accepted fixtures for the
given configuration
- Added a Security Solution override in `.eslintrc.js` with
`alternativeFixtures: ['esClient']` so their tests accept either
`apiClient` or `esClient`
- Added unit tests for the new `alternativeFixtures` option

---------

Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
(cherry picked from commit 24d327b)

# Conflicts:
#	.eslintrc.js
#	x-pack/solutions/security/plugins/entity_store/test/scout/api/tests/dsl_translation.spec.ts
#	x-pack/solutions/security/plugins/entity_store/test/scout/api/tests/esql_translation.spec.ts
#	x-pack/solutions/security/plugins/entity_store/test/scout/api/tests/painless_translation.spec.ts
@steliosmavro
Copy link
Copy Markdown
Contributor Author

💚 All backports created successfully

Status Branch Result
9.3
9.2
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

steliosmavro added a commit that referenced this pull request Feb 11, 2026
# Backport

This will backport the following commits from `main` to `9.3`:
- [Loosen `apiClient` ESLint rule on Security
(#252212)](#252212)

<!--- Backport version: 10.2.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Stelios
Mavro","email":"81311181+steliosmavro@users.noreply.github.com"},"sourceCommit":{"committedDate":"2026-02-11T05:42:20Z","message":"Loosen
`apiClient` ESLint rule on Security (#252212)\n\n## Summary\n\nThe
Security Solution team has test cases that intentionally use\n`esClient`
directly without `apiClient`, so enforcing
the\n`scout_require_api_client_in_api_test` rule on their scout
tests\nproduces false positives. Instead of excluding Security Solution
from\nthe rule entirely, this PR enhances the rule with a
configurable\n`alternativeFixtures` schema option so it can accept
additional fixtures\nper directory.\n\n## Changes\n\n- Added
`alternativeFixtures` schema option
to\n`scout_require_api_client_in_api_test`, allowing directories
to\nconfigure additional accepted fixtures via `.eslintrc.js`\n-
Generalized `functionUsesApiClient` to
`functionUsesFixture`,\nparameterizing the fixture name so the same
detection logic works for\nany fixture\n- Error messages are dynamic and
list only the accepted fixtures for the\ngiven configuration\n- Added a
Security Solution override in `.eslintrc.js` with\n`alternativeFixtures:
['esClient']` so their tests accept either\n`apiClient` or `esClient`\n-
Added unit tests for the new `alternativeFixtures`
option\n\n---------\n\nCo-authored-by: Dzmitry Lemechko
<dzmitry.lemechko@elastic.co>","sha":"24d327be1100929b7c10c39a0a6cb1217355f09a","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v9.4.0"],"title":"Loosen
`apiClient` ESLint rule on
Security","number":252212,"url":"https://github.com/elastic/kibana/pull/252212","mergeCommit":{"message":"Loosen
`apiClient` ESLint rule on Security (#252212)\n\n## Summary\n\nThe
Security Solution team has test cases that intentionally use\n`esClient`
directly without `apiClient`, so enforcing
the\n`scout_require_api_client_in_api_test` rule on their scout
tests\nproduces false positives. Instead of excluding Security Solution
from\nthe rule entirely, this PR enhances the rule with a
configurable\n`alternativeFixtures` schema option so it can accept
additional fixtures\nper directory.\n\n## Changes\n\n- Added
`alternativeFixtures` schema option
to\n`scout_require_api_client_in_api_test`, allowing directories
to\nconfigure additional accepted fixtures via `.eslintrc.js`\n-
Generalized `functionUsesApiClient` to
`functionUsesFixture`,\nparameterizing the fixture name so the same
detection logic works for\nany fixture\n- Error messages are dynamic and
list only the accepted fixtures for the\ngiven configuration\n- Added a
Security Solution override in `.eslintrc.js` with\n`alternativeFixtures:
['esClient']` so their tests accept either\n`apiClient` or `esClient`\n-
Added unit tests for the new `alternativeFixtures`
option\n\n---------\n\nCo-authored-by: Dzmitry Lemechko
<dzmitry.lemechko@elastic.co>","sha":"24d327be1100929b7c10c39a0a6cb1217355f09a"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/252212","number":252212,"mergeCommit":{"message":"Loosen
`apiClient` ESLint rule on Security (#252212)\n\n## Summary\n\nThe
Security Solution team has test cases that intentionally use\n`esClient`
directly without `apiClient`, so enforcing
the\n`scout_require_api_client_in_api_test` rule on their scout
tests\nproduces false positives. Instead of excluding Security Solution
from\nthe rule entirely, this PR enhances the rule with a
configurable\n`alternativeFixtures` schema option so it can accept
additional fixtures\nper directory.\n\n## Changes\n\n- Added
`alternativeFixtures` schema option
to\n`scout_require_api_client_in_api_test`, allowing directories
to\nconfigure additional accepted fixtures via `.eslintrc.js`\n-
Generalized `functionUsesApiClient` to
`functionUsesFixture`,\nparameterizing the fixture name so the same
detection logic works for\nany fixture\n- Error messages are dynamic and
list only the accepted fixtures for the\ngiven configuration\n- Added a
Security Solution override in `.eslintrc.js` with\n`alternativeFixtures:
['esClient']` so their tests accept either\n`apiClient` or `esClient`\n-
Added unit tests for the new `alternativeFixtures`
option\n\n---------\n\nCo-authored-by: Dzmitry Lemechko
<dzmitry.lemechko@elastic.co>","sha":"24d327be1100929b7c10c39a0a6cb1217355f09a"}}]}]
BACKPORT-->
steliosmavro added a commit that referenced this pull request Feb 11, 2026
# Backport

This will backport the following commits from `main` to `9.2`:
- [Loosen `apiClient` ESLint rule on Security
(#252212)](#252212)

<!--- Backport version: 10.2.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Stelios
Mavro","email":"81311181+steliosmavro@users.noreply.github.com"},"sourceCommit":{"committedDate":"2026-02-11T05:42:20Z","message":"Loosen
`apiClient` ESLint rule on Security (#252212)\n\n## Summary\n\nThe
Security Solution team has test cases that intentionally use\n`esClient`
directly without `apiClient`, so enforcing
the\n`scout_require_api_client_in_api_test` rule on their scout
tests\nproduces false positives. Instead of excluding Security Solution
from\nthe rule entirely, this PR enhances the rule with a
configurable\n`alternativeFixtures` schema option so it can accept
additional fixtures\nper directory.\n\n## Changes\n\n- Added
`alternativeFixtures` schema option
to\n`scout_require_api_client_in_api_test`, allowing directories
to\nconfigure additional accepted fixtures via `.eslintrc.js`\n-
Generalized `functionUsesApiClient` to
`functionUsesFixture`,\nparameterizing the fixture name so the same
detection logic works for\nany fixture\n- Error messages are dynamic and
list only the accepted fixtures for the\ngiven configuration\n- Added a
Security Solution override in `.eslintrc.js` with\n`alternativeFixtures:
['esClient']` so their tests accept either\n`apiClient` or `esClient`\n-
Added unit tests for the new `alternativeFixtures`
option\n\n---------\n\nCo-authored-by: Dzmitry Lemechko
<dzmitry.lemechko@elastic.co>","sha":"24d327be1100929b7c10c39a0a6cb1217355f09a","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v9.4.0"],"title":"Loosen
`apiClient` ESLint rule on
Security","number":252212,"url":"https://github.com/elastic/kibana/pull/252212","mergeCommit":{"message":"Loosen
`apiClient` ESLint rule on Security (#252212)\n\n## Summary\n\nThe
Security Solution team has test cases that intentionally use\n`esClient`
directly without `apiClient`, so enforcing
the\n`scout_require_api_client_in_api_test` rule on their scout
tests\nproduces false positives. Instead of excluding Security Solution
from\nthe rule entirely, this PR enhances the rule with a
configurable\n`alternativeFixtures` schema option so it can accept
additional fixtures\nper directory.\n\n## Changes\n\n- Added
`alternativeFixtures` schema option
to\n`scout_require_api_client_in_api_test`, allowing directories
to\nconfigure additional accepted fixtures via `.eslintrc.js`\n-
Generalized `functionUsesApiClient` to
`functionUsesFixture`,\nparameterizing the fixture name so the same
detection logic works for\nany fixture\n- Error messages are dynamic and
list only the accepted fixtures for the\ngiven configuration\n- Added a
Security Solution override in `.eslintrc.js` with\n`alternativeFixtures:
['esClient']` so their tests accept either\n`apiClient` or `esClient`\n-
Added unit tests for the new `alternativeFixtures`
option\n\n---------\n\nCo-authored-by: Dzmitry Lemechko
<dzmitry.lemechko@elastic.co>","sha":"24d327be1100929b7c10c39a0a6cb1217355f09a"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/252212","number":252212,"mergeCommit":{"message":"Loosen
`apiClient` ESLint rule on Security (#252212)\n\n## Summary\n\nThe
Security Solution team has test cases that intentionally use\n`esClient`
directly without `apiClient`, so enforcing
the\n`scout_require_api_client_in_api_test` rule on their scout
tests\nproduces false positives. Instead of excluding Security Solution
from\nthe rule entirely, this PR enhances the rule with a
configurable\n`alternativeFixtures` schema option so it can accept
additional fixtures\nper directory.\n\n## Changes\n\n- Added
`alternativeFixtures` schema option
to\n`scout_require_api_client_in_api_test`, allowing directories
to\nconfigure additional accepted fixtures via `.eslintrc.js`\n-
Generalized `functionUsesApiClient` to
`functionUsesFixture`,\nparameterizing the fixture name so the same
detection logic works for\nany fixture\n- Error messages are dynamic and
list only the accepted fixtures for the\ngiven configuration\n- Added a
Security Solution override in `.eslintrc.js` with\n`alternativeFixtures:
['esClient']` so their tests accept either\n`apiClient` or `esClient`\n-
Added unit tests for the new `alternativeFixtures`
option\n\n---------\n\nCo-authored-by: Dzmitry Lemechko
<dzmitry.lemechko@elastic.co>","sha":"24d327be1100929b7c10c39a0a6cb1217355f09a"}}]}]
BACKPORT-->
steliosmavro added a commit that referenced this pull request Feb 11, 2026
# Backport

This will backport the following commits from `main` to `8.19`:
- [Loosen `apiClient` ESLint rule on Security
(#252212)](#252212)

<!--- Backport version: 10.2.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Stelios
Mavro","email":"81311181+steliosmavro@users.noreply.github.com"},"sourceCommit":{"committedDate":"2026-02-11T05:42:20Z","message":"Loosen
`apiClient` ESLint rule on Security (#252212)\n\n## Summary\n\nThe
Security Solution team has test cases that intentionally use\n`esClient`
directly without `apiClient`, so enforcing
the\n`scout_require_api_client_in_api_test` rule on their scout
tests\nproduces false positives. Instead of excluding Security Solution
from\nthe rule entirely, this PR enhances the rule with a
configurable\n`alternativeFixtures` schema option so it can accept
additional fixtures\nper directory.\n\n## Changes\n\n- Added
`alternativeFixtures` schema option
to\n`scout_require_api_client_in_api_test`, allowing directories
to\nconfigure additional accepted fixtures via `.eslintrc.js`\n-
Generalized `functionUsesApiClient` to
`functionUsesFixture`,\nparameterizing the fixture name so the same
detection logic works for\nany fixture\n- Error messages are dynamic and
list only the accepted fixtures for the\ngiven configuration\n- Added a
Security Solution override in `.eslintrc.js` with\n`alternativeFixtures:
['esClient']` so their tests accept either\n`apiClient` or `esClient`\n-
Added unit tests for the new `alternativeFixtures`
option\n\n---------\n\nCo-authored-by: Dzmitry Lemechko
<dzmitry.lemechko@elastic.co>","sha":"24d327be1100929b7c10c39a0a6cb1217355f09a","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v9.4.0"],"title":"Loosen
`apiClient` ESLint rule on
Security","number":252212,"url":"https://github.com/elastic/kibana/pull/252212","mergeCommit":{"message":"Loosen
`apiClient` ESLint rule on Security (#252212)\n\n## Summary\n\nThe
Security Solution team has test cases that intentionally use\n`esClient`
directly without `apiClient`, so enforcing
the\n`scout_require_api_client_in_api_test` rule on their scout
tests\nproduces false positives. Instead of excluding Security Solution
from\nthe rule entirely, this PR enhances the rule with a
configurable\n`alternativeFixtures` schema option so it can accept
additional fixtures\nper directory.\n\n## Changes\n\n- Added
`alternativeFixtures` schema option
to\n`scout_require_api_client_in_api_test`, allowing directories
to\nconfigure additional accepted fixtures via `.eslintrc.js`\n-
Generalized `functionUsesApiClient` to
`functionUsesFixture`,\nparameterizing the fixture name so the same
detection logic works for\nany fixture\n- Error messages are dynamic and
list only the accepted fixtures for the\ngiven configuration\n- Added a
Security Solution override in `.eslintrc.js` with\n`alternativeFixtures:
['esClient']` so their tests accept either\n`apiClient` or `esClient`\n-
Added unit tests for the new `alternativeFixtures`
option\n\n---------\n\nCo-authored-by: Dzmitry Lemechko
<dzmitry.lemechko@elastic.co>","sha":"24d327be1100929b7c10c39a0a6cb1217355f09a"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/252212","number":252212,"mergeCommit":{"message":"Loosen
`apiClient` ESLint rule on Security (#252212)\n\n## Summary\n\nThe
Security Solution team has test cases that intentionally use\n`esClient`
directly without `apiClient`, so enforcing
the\n`scout_require_api_client_in_api_test` rule on their scout
tests\nproduces false positives. Instead of excluding Security Solution
from\nthe rule entirely, this PR enhances the rule with a
configurable\n`alternativeFixtures` schema option so it can accept
additional fixtures\nper directory.\n\n## Changes\n\n- Added
`alternativeFixtures` schema option
to\n`scout_require_api_client_in_api_test`, allowing directories
to\nconfigure additional accepted fixtures via `.eslintrc.js`\n-
Generalized `functionUsesApiClient` to
`functionUsesFixture`,\nparameterizing the fixture name so the same
detection logic works for\nany fixture\n- Error messages are dynamic and
list only the accepted fixtures for the\ngiven configuration\n- Added a
Security Solution override in `.eslintrc.js` with\n`alternativeFixtures:
['esClient']` so their tests accept either\n`apiClient` or `esClient`\n-
Added unit tests for the new `alternativeFixtures`
option\n\n---------\n\nCo-authored-by: Dzmitry Lemechko
<dzmitry.lemechko@elastic.co>","sha":"24d327be1100929b7c10c39a0a6cb1217355f09a"}}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:all-open Backport to all branches that could still receive a release release_note:skip Skip the PR/issue when compiling release notes v8.19.12 v9.2.6 v9.3.0 v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loosen apiClient ESLint Rule for Security Solution

6 participants