Skip to content

Comments

[Security Solution][Eslint] fix nested eslint workflow for webstorm#227301

Merged
kapral18 merged 1 commit intoelastic:mainfrom
kapral18:fix/eslint/fix-nested-eslint-for-webstorm
Jul 10, 2025
Merged

[Security Solution][Eslint] fix nested eslint workflow for webstorm#227301
kapral18 merged 1 commit intoelastic:mainfrom
kapral18:fix/eslint/fix-nested-eslint-for-webstorm

Conversation

@kapral18
Copy link
Contributor

@kapral18 kapral18 commented Jul 9, 2025

By default automatic eslint configuration in webstorm settings

image

finds closest (to currently open file) eslint config and sets that directory as the current working directory for the entire eslint process

Some existing nested eslint config files do not account for that when searching for project root and assume that process.cwd() in eslint process would always be the kibana root.

That's why they currently break in webstorm with Error: Cannot find module '/.eslintrc'

This PR fixes that regression.

But even after this fix is merged, webstorm users still need to use manual eslint config setting to detect the root of the project for eslint process to circumvent that faulty automatic cwd detection of webstorm and allow eslint cascade to work
to support nested .eslintrc.js in combination with root .eslintrc.js files.

image

Unfortunately this is a known and current webstorm design limitation/bug per https://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0

@kapral18 kapral18 self-assigned this Jul 9, 2025
@kapral18 kapral18 requested review from a team as code owners July 9, 2025 17:39
@kapral18 kapral18 added backport:all-open Backport to all branches that could still receive a release release_note:skip Skip the PR/issue when compiling release notes labels Jul 9, 2025
@kapral18 kapral18 force-pushed the fix/eslint/fix-nested-eslint-for-webstorm branch from 767e749 to 16955cc Compare July 9, 2025 17:42
@kapral18 kapral18 changed the title [Security Solution][Eslint] fix nested eslint for webstorm [Security Solution][Eslint] fix nested eslint workflow for webstorm Jul 9, 2025
By default when using automatic eslint configuration in webstorm
settings it finds closest (to currently open file) eslint config and sets that
directory as the current working directory for the entire eslint process

Some existing nested eslint config files do not account for that and
assume that process.cwd() in eslint process would always be the kibana root. That's why they currently break in webstorm and alike IDEs.

This PR fixes that.

But even after this fix is merged, webstorm users still need to use
manual eslint config setting to detect the root of the project for
eslint process so that eslint cascade works correctly.

This is a known and current webstorm design limitation/bug per https://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0
@kapral18 kapral18 force-pushed the fix/eslint/fix-nested-eslint-for-webstorm branch from 16955cc to 6674352 Compare July 9, 2025 18:21
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
@kbn/cell-actions 3 4 +1
@kbn/ecs-data-quality-dashboard 9 10 +1
@kbn/security-solution-connectors 2 3 +1
@kbn/security-solution-features 2 3 +1
@kbn/security-solution-navigation 9 10 +1
@kbn/security-solution-side-nav 4 5 +1
@kbn/security-solution-upselling 3 4 +1
securitySolution 631 636 +5
total +12

Total ESLint disabled count

id before after diff
@kbn/cell-actions 3 4 +1
@kbn/ecs-data-quality-dashboard 9 10 +1
@kbn/security-solution-connectors 2 3 +1
@kbn/security-solution-features 2 3 +1
@kbn/security-solution-navigation 9 10 +1
@kbn/security-solution-side-nav 4 5 +1
@kbn/security-solution-upselling 3 4 +1
securitySolution 729 734 +5
total +12

cc @kapral18

Copy link
Contributor

@janmonschke janmonschke left a comment

Choose a reason for hiding this comment

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

kibana-cases changes lgtm

Copy link
Contributor

@logeekal logeekal left a comment

Choose a reason for hiding this comment

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

LGTM 🚀 . Thanks for this improvement.

@kapral18 kapral18 merged commit 488434c into elastic:main Jul 10, 2025
12 checks passed
@kapral18 kapral18 deleted the fix/eslint/fix-nested-eslint-for-webstorm branch July 10, 2025 10:29
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.17, 8.18, 8.19, 9.0, 9.1

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

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 10, 2025
…lastic#227301)

By default automatic eslint configuration in webstorm settings

![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)

[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)
closest (to currently open file) eslint config and sets that directory
as the current working directory for the entire eslint process

Some existing nested eslint config files do not account for that when
searching for project root and assume that process.cwd() in eslint
process would always be the kibana root.

That's why they currently break in webstorm with `Error: Cannot find
module '/.eslintrc'`

This PR fixes that regression.

But even after this fix is merged, webstorm users still need to use
manual eslint config setting to detect the root of the project for
eslint process to circumvent that faulty automatic cwd detection of
webstorm and allow eslint cascade to work
to support nested .eslintrc.js in combination with root .eslintrc.js
files.

![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)

Unfortunately this is a known and current webstorm design limitation/bug
per
https://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0

(cherry picked from commit 488434c)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 10, 2025
…lastic#227301)

By default automatic eslint configuration in webstorm settings

![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)

[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)
closest (to currently open file) eslint config and sets that directory
as the current working directory for the entire eslint process

Some existing nested eslint config files do not account for that when
searching for project root and assume that process.cwd() in eslint
process would always be the kibana root.

That's why they currently break in webstorm with `Error: Cannot find
module '/.eslintrc'`

This PR fixes that regression.

But even after this fix is merged, webstorm users still need to use
manual eslint config setting to detect the root of the project for
eslint process to circumvent that faulty automatic cwd detection of
webstorm and allow eslint cascade to work
to support nested .eslintrc.js in combination with root .eslintrc.js
files.

![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)

Unfortunately this is a known and current webstorm design limitation/bug
per
https://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0

(cherry picked from commit 488434c)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 10, 2025
…lastic#227301)

By default automatic eslint configuration in webstorm settings

![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)

[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)
closest (to currently open file) eslint config and sets that directory
as the current working directory for the entire eslint process

Some existing nested eslint config files do not account for that when
searching for project root and assume that process.cwd() in eslint
process would always be the kibana root.

That's why they currently break in webstorm with `Error: Cannot find
module '/.eslintrc'`

This PR fixes that regression.

But even after this fix is merged, webstorm users still need to use
manual eslint config setting to detect the root of the project for
eslint process to circumvent that faulty automatic cwd detection of
webstorm and allow eslint cascade to work
to support nested .eslintrc.js in combination with root .eslintrc.js
files.

![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)

Unfortunately this is a known and current webstorm design limitation/bug
per
https://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0

(cherry picked from commit 488434c)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 10, 2025
…lastic#227301)

By default automatic eslint configuration in webstorm settings

![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)

[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)
closest (to currently open file) eslint config and sets that directory
as the current working directory for the entire eslint process

Some existing nested eslint config files do not account for that when
searching for project root and assume that process.cwd() in eslint
process would always be the kibana root.

That's why they currently break in webstorm with `Error: Cannot find
module '/.eslintrc'`

This PR fixes that regression.

But even after this fix is merged, webstorm users still need to use
manual eslint config setting to detect the root of the project for
eslint process to circumvent that faulty automatic cwd detection of
webstorm and allow eslint cascade to work
to support nested .eslintrc.js in combination with root .eslintrc.js
files.

![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)

Unfortunately this is a known and current webstorm design limitation/bug
per
https://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0

(cherry picked from commit 488434c)
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.17 Backport failed because of merge conflicts

You might need to backport the following PRs to 8.17:
- Fix "How's the navigation working for you?" shown with each session (#227199)
- [APM] Fix span flyout in operation page (#226423)
- [APM] Fix missing sparklines from dependency (#227211)
- [Search sessions] Add singulars/plurals to expiration badges (#227035)
8.18
8.19
9.0
9.1

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

Manual backport

To create the backport manually run:

node scripts/backport --pr 227301

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jul 10, 2025
…torm (#227301) (#227409)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Security Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)](#227301)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2025-07-10T10:29:06Z","message":"[Security
Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)\n\nBy default automatic eslint configuration in webstorm
settings\n\n\n![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)\n\n\n[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)\nclosest
(to currently open file) eslint config and sets that directory\nas the
current working directory for the entire eslint process\n\nSome existing
nested eslint config files do not account for that when\nsearching for
project root and assume that process.cwd() in eslint\nprocess would
always be the kibana root.\n\nThat's why they currently break in
webstorm with `Error: Cannot find\nmodule '/.eslintrc'`\n\nThis PR fixes
that regression.\n\nBut even after this fix is merged, webstorm users
still need to use\nmanual eslint config setting to detect the root of
the project for\neslint process to circumvent that faulty automatic cwd
detection of\nwebstorm and allow eslint cascade to work\nto support
nested .eslintrc.js in combination with root
.eslintrc.js\nfiles.\n\n\n![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)\n\nUnfortunately
this is a known and current webstorm design
limitation/bug\nper\nhttps://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0","sha":"488434c49d976d8902eac848813fc6558e904f82","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v9.2.0"],"title":"[Security
Solution][Eslint] fix nested eslint workflow for
webstorm","number":227301,"url":"https://github.com/elastic/kibana/pull/227301","mergeCommit":{"message":"[Security
Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)\n\nBy default automatic eslint configuration in webstorm
settings\n\n\n![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)\n\n\n[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)\nclosest
(to currently open file) eslint config and sets that directory\nas the
current working directory for the entire eslint process\n\nSome existing
nested eslint config files do not account for that when\nsearching for
project root and assume that process.cwd() in eslint\nprocess would
always be the kibana root.\n\nThat's why they currently break in
webstorm with `Error: Cannot find\nmodule '/.eslintrc'`\n\nThis PR fixes
that regression.\n\nBut even after this fix is merged, webstorm users
still need to use\nmanual eslint config setting to detect the root of
the project for\neslint process to circumvent that faulty automatic cwd
detection of\nwebstorm and allow eslint cascade to work\nto support
nested .eslintrc.js in combination with root
.eslintrc.js\nfiles.\n\n\n![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)\n\nUnfortunately
this is a known and current webstorm design
limitation/bug\nper\nhttps://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0","sha":"488434c49d976d8902eac848813fc6558e904f82"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227301","number":227301,"mergeCommit":{"message":"[Security
Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)\n\nBy default automatic eslint configuration in webstorm
settings\n\n\n![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)\n\n\n[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)\nclosest
(to currently open file) eslint config and sets that directory\nas the
current working directory for the entire eslint process\n\nSome existing
nested eslint config files do not account for that when\nsearching for
project root and assume that process.cwd() in eslint\nprocess would
always be the kibana root.\n\nThat's why they currently break in
webstorm with `Error: Cannot find\nmodule '/.eslintrc'`\n\nThis PR fixes
that regression.\n\nBut even after this fix is merged, webstorm users
still need to use\nmanual eslint config setting to detect the root of
the project for\neslint process to circumvent that faulty automatic cwd
detection of\nwebstorm and allow eslint cascade to work\nto support
nested .eslintrc.js in combination with root
.eslintrc.js\nfiles.\n\n\n![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)\n\nUnfortunately
this is a known and current webstorm design
limitation/bug\nper\nhttps://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0","sha":"488434c49d976d8902eac848813fc6558e904f82"}}]}]
BACKPORT-->

Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
kibanamachine added a commit that referenced this pull request Jul 10, 2025
…storm (#227301) (#227408)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Security Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)](#227301)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2025-07-10T10:29:06Z","message":"[Security
Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)\n\nBy default automatic eslint configuration in webstorm
settings\n\n\n![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)\n\n\n[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)\nclosest
(to currently open file) eslint config and sets that directory\nas the
current working directory for the entire eslint process\n\nSome existing
nested eslint config files do not account for that when\nsearching for
project root and assume that process.cwd() in eslint\nprocess would
always be the kibana root.\n\nThat's why they currently break in
webstorm with `Error: Cannot find\nmodule '/.eslintrc'`\n\nThis PR fixes
that regression.\n\nBut even after this fix is merged, webstorm users
still need to use\nmanual eslint config setting to detect the root of
the project for\neslint process to circumvent that faulty automatic cwd
detection of\nwebstorm and allow eslint cascade to work\nto support
nested .eslintrc.js in combination with root
.eslintrc.js\nfiles.\n\n\n![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)\n\nUnfortunately
this is a known and current webstorm design
limitation/bug\nper\nhttps://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0","sha":"488434c49d976d8902eac848813fc6558e904f82","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v9.2.0"],"title":"[Security
Solution][Eslint] fix nested eslint workflow for
webstorm","number":227301,"url":"https://github.com/elastic/kibana/pull/227301","mergeCommit":{"message":"[Security
Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)\n\nBy default automatic eslint configuration in webstorm
settings\n\n\n![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)\n\n\n[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)\nclosest
(to currently open file) eslint config and sets that directory\nas the
current working directory for the entire eslint process\n\nSome existing
nested eslint config files do not account for that when\nsearching for
project root and assume that process.cwd() in eslint\nprocess would
always be the kibana root.\n\nThat's why they currently break in
webstorm with `Error: Cannot find\nmodule '/.eslintrc'`\n\nThis PR fixes
that regression.\n\nBut even after this fix is merged, webstorm users
still need to use\nmanual eslint config setting to detect the root of
the project for\neslint process to circumvent that faulty automatic cwd
detection of\nwebstorm and allow eslint cascade to work\nto support
nested .eslintrc.js in combination with root
.eslintrc.js\nfiles.\n\n\n![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)\n\nUnfortunately
this is a known and current webstorm design
limitation/bug\nper\nhttps://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0","sha":"488434c49d976d8902eac848813fc6558e904f82"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227301","number":227301,"mergeCommit":{"message":"[Security
Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)\n\nBy default automatic eslint configuration in webstorm
settings\n\n\n![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)\n\n\n[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)\nclosest
(to currently open file) eslint config and sets that directory\nas the
current working directory for the entire eslint process\n\nSome existing
nested eslint config files do not account for that when\nsearching for
project root and assume that process.cwd() in eslint\nprocess would
always be the kibana root.\n\nThat's why they currently break in
webstorm with `Error: Cannot find\nmodule '/.eslintrc'`\n\nThis PR fixes
that regression.\n\nBut even after this fix is merged, webstorm users
still need to use\nmanual eslint config setting to detect the root of
the project for\neslint process to circumvent that faulty automatic cwd
detection of\nwebstorm and allow eslint cascade to work\nto support
nested .eslintrc.js in combination with root
.eslintrc.js\nfiles.\n\n\n![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)\n\nUnfortunately
this is a known and current webstorm design
limitation/bug\nper\nhttps://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0","sha":"488434c49d976d8902eac848813fc6558e904f82"}}]}]
BACKPORT-->

Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
kibanamachine added a commit that referenced this pull request Jul 10, 2025
…torm (#227301) (#227410)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Security Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)](#227301)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2025-07-10T10:29:06Z","message":"[Security
Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)\n\nBy default automatic eslint configuration in webstorm
settings\n\n\n![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)\n\n\n[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)\nclosest
(to currently open file) eslint config and sets that directory\nas the
current working directory for the entire eslint process\n\nSome existing
nested eslint config files do not account for that when\nsearching for
project root and assume that process.cwd() in eslint\nprocess would
always be the kibana root.\n\nThat's why they currently break in
webstorm with `Error: Cannot find\nmodule '/.eslintrc'`\n\nThis PR fixes
that regression.\n\nBut even after this fix is merged, webstorm users
still need to use\nmanual eslint config setting to detect the root of
the project for\neslint process to circumvent that faulty automatic cwd
detection of\nwebstorm and allow eslint cascade to work\nto support
nested .eslintrc.js in combination with root
.eslintrc.js\nfiles.\n\n\n![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)\n\nUnfortunately
this is a known and current webstorm design
limitation/bug\nper\nhttps://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0","sha":"488434c49d976d8902eac848813fc6558e904f82","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v9.2.0"],"title":"[Security
Solution][Eslint] fix nested eslint workflow for
webstorm","number":227301,"url":"https://github.com/elastic/kibana/pull/227301","mergeCommit":{"message":"[Security
Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)\n\nBy default automatic eslint configuration in webstorm
settings\n\n\n![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)\n\n\n[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)\nclosest
(to currently open file) eslint config and sets that directory\nas the
current working directory for the entire eslint process\n\nSome existing
nested eslint config files do not account for that when\nsearching for
project root and assume that process.cwd() in eslint\nprocess would
always be the kibana root.\n\nThat's why they currently break in
webstorm with `Error: Cannot find\nmodule '/.eslintrc'`\n\nThis PR fixes
that regression.\n\nBut even after this fix is merged, webstorm users
still need to use\nmanual eslint config setting to detect the root of
the project for\neslint process to circumvent that faulty automatic cwd
detection of\nwebstorm and allow eslint cascade to work\nto support
nested .eslintrc.js in combination with root
.eslintrc.js\nfiles.\n\n\n![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)\n\nUnfortunately
this is a known and current webstorm design
limitation/bug\nper\nhttps://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0","sha":"488434c49d976d8902eac848813fc6558e904f82"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227301","number":227301,"mergeCommit":{"message":"[Security
Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)\n\nBy default automatic eslint configuration in webstorm
settings\n\n\n![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)\n\n\n[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)\nclosest
(to currently open file) eslint config and sets that directory\nas the
current working directory for the entire eslint process\n\nSome existing
nested eslint config files do not account for that when\nsearching for
project root and assume that process.cwd() in eslint\nprocess would
always be the kibana root.\n\nThat's why they currently break in
webstorm with `Error: Cannot find\nmodule '/.eslintrc'`\n\nThis PR fixes
that regression.\n\nBut even after this fix is merged, webstorm users
still need to use\nmanual eslint config setting to detect the root of
the project for\neslint process to circumvent that faulty automatic cwd
detection of\nwebstorm and allow eslint cascade to work\nto support
nested .eslintrc.js in combination with root
.eslintrc.js\nfiles.\n\n\n![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)\n\nUnfortunately
this is a known and current webstorm design
limitation/bug\nper\nhttps://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0","sha":"488434c49d976d8902eac848813fc6558e904f82"}}]}]
BACKPORT-->

Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
kibanamachine added a commit that referenced this pull request Jul 10, 2025
…storm (#227301) (#227407)

# Backport

This will backport the following commits from `main` to `8.18`:
- [[Security Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)](#227301)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2025-07-10T10:29:06Z","message":"[Security
Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)\n\nBy default automatic eslint configuration in webstorm
settings\n\n\n![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)\n\n\n[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)\nclosest
(to currently open file) eslint config and sets that directory\nas the
current working directory for the entire eslint process\n\nSome existing
nested eslint config files do not account for that when\nsearching for
project root and assume that process.cwd() in eslint\nprocess would
always be the kibana root.\n\nThat's why they currently break in
webstorm with `Error: Cannot find\nmodule '/.eslintrc'`\n\nThis PR fixes
that regression.\n\nBut even after this fix is merged, webstorm users
still need to use\nmanual eslint config setting to detect the root of
the project for\neslint process to circumvent that faulty automatic cwd
detection of\nwebstorm and allow eslint cascade to work\nto support
nested .eslintrc.js in combination with root
.eslintrc.js\nfiles.\n\n\n![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)\n\nUnfortunately
this is a known and current webstorm design
limitation/bug\nper\nhttps://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0","sha":"488434c49d976d8902eac848813fc6558e904f82","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v9.2.0"],"title":"[Security
Solution][Eslint] fix nested eslint workflow for
webstorm","number":227301,"url":"https://github.com/elastic/kibana/pull/227301","mergeCommit":{"message":"[Security
Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)\n\nBy default automatic eslint configuration in webstorm
settings\n\n\n![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)\n\n\n[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)\nclosest
(to currently open file) eslint config and sets that directory\nas the
current working directory for the entire eslint process\n\nSome existing
nested eslint config files do not account for that when\nsearching for
project root and assume that process.cwd() in eslint\nprocess would
always be the kibana root.\n\nThat's why they currently break in
webstorm with `Error: Cannot find\nmodule '/.eslintrc'`\n\nThis PR fixes
that regression.\n\nBut even after this fix is merged, webstorm users
still need to use\nmanual eslint config setting to detect the root of
the project for\neslint process to circumvent that faulty automatic cwd
detection of\nwebstorm and allow eslint cascade to work\nto support
nested .eslintrc.js in combination with root
.eslintrc.js\nfiles.\n\n\n![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)\n\nUnfortunately
this is a known and current webstorm design
limitation/bug\nper\nhttps://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0","sha":"488434c49d976d8902eac848813fc6558e904f82"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/227301","number":227301,"mergeCommit":{"message":"[Security
Solution][Eslint] fix nested eslint workflow for webstorm
(#227301)\n\nBy default automatic eslint configuration in webstorm
settings\n\n\n![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)\n\n\n[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)\nclosest
(to currently open file) eslint config and sets that directory\nas the
current working directory for the entire eslint process\n\nSome existing
nested eslint config files do not account for that when\nsearching for
project root and assume that process.cwd() in eslint\nprocess would
always be the kibana root.\n\nThat's why they currently break in
webstorm with `Error: Cannot find\nmodule '/.eslintrc'`\n\nThis PR fixes
that regression.\n\nBut even after this fix is merged, webstorm users
still need to use\nmanual eslint config setting to detect the root of
the project for\neslint process to circumvent that faulty automatic cwd
detection of\nwebstorm and allow eslint cascade to work\nto support
nested .eslintrc.js in combination with root
.eslintrc.js\nfiles.\n\n\n![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)\n\nUnfortunately
this is a known and current webstorm design
limitation/bug\nper\nhttps://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0","sha":"488434c49d976d8902eac848813fc6558e904f82"}}]}]
BACKPORT-->

Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
kertal pushed a commit to kertal/kibana that referenced this pull request Jul 25, 2025
…lastic#227301)

By default automatic eslint configuration in webstorm settings


![image](https://github.com/user-attachments/assets/29351d6a-a452-4a7c-945d-177670ba9e9c)


[finds](https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_manual_configuration:~:text=detects%20the%20working%20directory%20automatically.%20First%2C%20it%20looks%20for%20a%20directory%20closest%20to%20the%20linted%20file%20which%20contains%20a%20configuration%20file.)
closest (to currently open file) eslint config and sets that directory
as the current working directory for the entire eslint process

Some existing nested eslint config files do not account for that when
searching for project root and assume that process.cwd() in eslint
process would always be the kibana root.

That's why they currently break in webstorm with `Error: Cannot find
module '/.eslintrc'`

This PR fixes that regression.

But even after this fix is merged, webstorm users still need to use
manual eslint config setting to detect the root of the project for
eslint process to circumvent that faulty automatic cwd detection of
webstorm and allow eslint cascade to work
to support nested .eslintrc.js in combination with root .eslintrc.js
files.


![image](https://github.com/user-attachments/assets/48ddbbb9-954e-4e81-9b4d-2a626c9ef12a)

Unfortunately this is a known and current webstorm design limitation/bug
per
https://youtrack.jetbrains.com/issue/WEB-45381#focus=Comments-27-4342029.0-0
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.18.4 v8.19.0 v9.0.4 v9.1.0 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants