Adopt ESLint 10 / flat config - #1486
Conversation
Migrate to flat eslint.config.js spreading @elastic/eslint-config-kibana + EUI (preserving require-license-header off). Fix the lint script that used the removed -c/--ignore-path flags. Remove the Prettier 2 pin (inherited from OSD core). Closes opensearch-project#1485 Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
|
Thanks for this @SuZhou-Joe — clean migration overall. One question: with the old lint script using --ignore-path .gitignore, is there an equivalent ignores array needed in the flat config? Or does ../../scripts/eslint (or the shared OSD config) handle ignoring node_modules, build/, etc. automatically? Also, 3 of the 17 checks appear to be failing — are those pre-existing/unrelated? Otherwise LGTM. Config-only change, idiomatic flat config pattern, and the Prettier pin removal makes sense since it's inherited from core. |
The previous lint command used `--ignore-path .gitignore`, which ESLint 10 flat config no longer supports. Use @eslint/compat's includeIgnoreFile() to import the .gitignore patterns as ignores, preserving the prior behavior and keeping the ignore list in sync with .gitignore. Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Thanks for the sharp eyes, I updated the config a little bit to reflect previous ignore behavior. |
It is an existing failure and can be found in other PRs.
Failed due to not pinned to a commit SHA
Failed due to yarn not installed, the error can be found in other PRs. |
1cbf315
into
opensearch-project:main
Description
Migrates the plugin to ESLint 10 flat config. Adds
eslint.config.jsthat spreads@elastic/eslint-config-kibanaplus the EUI config (preservingrequire-license-headeroff), and removes the legacy.eslintrc. Fixes thelintscript inpackage.json, which used the-c/--ignore-pathflags that ESLint 10 removed. Removes the Prettier 2 pin, since Prettier is inherited from OpenSearch Dashboards core.This is a config-only change; no source files were reformatted.
Issues Resolved
Closes #1485
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.