eslint: v9 config not detected, default config written

Summary

For a repository with a eslint flat config file instead of eslintrc config file, the setup step will write the default eslint.config.js file.

Steps to reproduce

  1. Make a project with a eslint.config.mjs file
  2. Add the eslint scanner component
  3. Observe in the eslint job there is the message "No ESLint config found, creating eslint.config.js..." printed

Example Project

I don't have a reproducer here yet, but maybe this can be done on the javascript-codequality test project.

What is the current bug behavior?

When there is a eslint.config.mjs file (current logic seems to be when there is no .eslintrc.* file), a eslint.config.js file is written.

What is the expected correct behavior?

When there is an eslint.config.mjs file (or any of the other allowed filenames for flat config files), then there should not be a config automatically written by the job.

There might be some other concerns for supporting or falling back to eslintrc config for projects still on v8, but I'm not sure if those should be tackled separately.

Relevant logs and/or screenshots

$ if [ "false" != "true" ]; then # collapsed multi-line command
No ESLint config found, creating eslint.config.js...

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

  (For installations with omnibus-gitlab package run and paste the output of: \\\`sudo gitlab-rake gitlab:env:info\\\`)  (For installations from source run and paste the output of: \\\`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production\\\`)   

Results of GitLab application Check

Expand for output related to the GitLab application check

 (For installations with omnibus-gitlab package run and paste the output of: \`sudo gitlab-rake gitlab:check SANITIZE=true\`)  (For installations from source run and paste the output of: \`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true\`)  (we will only investigate if the tests are passing)  

Possible fixes

https://gitlab.com/components/code-quality-oss/codequality-os-scanners-integration/-/blob/1.0.4/templates/eslint.yml?ref_type=tags#L105