feat: detect eslint flat and eslintrc configs
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
What does this MR do and why?
Add support for detecting eslint flat configs (v9), such that the default config will not be written when either an eslint flat config or an eslintrc config is present.
Fix bug where if there are multiple eslintrc config files matching the .eslintrc.* pattern bash will error out (https://gitlab.com/gitlab-community/components/code-quality-oss/javascript-codequality/-/jobs/10202728191):
/usr/bin/bash: line 162: [: .eslintrc.js: binary operator expected
Closes #27 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Current state before this change: https://gitlab.com/gitlab-community/components/code-quality-oss/javascript-codequality/-/jobs/10202477001
Example of an eslint flat config being used: https://gitlab.com/gitlab-community/components/code-quality-oss/javascript-codequality/-/jobs/10202601548
Example of an eslintrc config being used: https://gitlab.com/gitlab-community/components/code-quality-oss/javascript-codequality/-/jobs/10202631230
Example of multiple eslintrc config not producing bash errors: https://gitlab.com/gitlab-community/components/code-quality-oss/javascript-codequality/-/jobs/10202731605