Skip to content

Comments

[8.18] [Security Solution][Eslint] fix nested eslint workflow for webstorm (#227301)#227407

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

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

Conversation

@kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.18:

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:36
@elasticmachine
Copy link
Contributor

elasticmachine commented Jul 10, 2025

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
@kbn/cell-actions 3 4 +1
@kbn/ecs-data-quality-dashboard 12 13 +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 590 595 +5
total +12

Total ESLint disabled count

id before after diff
@kbn/cell-actions 3 4 +1
@kbn/ecs-data-quality-dashboard 12 13 +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 673 678 +5
total +12

History

cc @kapral18

@kibanamachine kibanamachine merged commit 2622012 into elastic:8.18 Jul 10, 2025
11 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.

3 participants