Skip to content

Comments

[9.0] [Security Solution][Eslint] fix nested eslint workflow for webstorm (#227301)#227409

Merged
kibanamachine merged 1 commit intoelastic:9.0from
kibanamachine:backport/9.0/pr-227301
Jul 10, 2025
Merged

[9.0] [Security Solution][Eslint] fix nested eslint workflow for webstorm (#227301)#227409
kibanamachine merged 1 commit intoelastic:9.0from
kibanamachine:backport/9.0/pr-227301

Conversation

@kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 9.0:

Questions ?

Please refer to the Backport tool documentation

…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 kibanamachine added the backport This PR is a backport of another PR label Jul 10, 2025
@kibanamachine kibanamachine enabled auto-merge (squash) July 10, 2025 10:37
@kibanamachine kibanamachine merged commit 775706d into elastic:9.0 Jul 10, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants