eslint / eslint

Find and fix problems in your JavaScript code.
https://eslint.org
MIT License
24.39k stars 4.4k forks source link

The Eslint command is failing with error "Oops! Something went wrong! :( ESLint: 9.0.0 Error: Could not find config file." This is referring from file https://github.com/eslint/eslint/blob/main/lib/eslint/eslint.js #18350

Closed Sarmistha91 closed 4 weeks ago

Sarmistha91 commented 1 month ago

Environment

Below is the job we are running -

name: Code Analysis on APIGEE JS files id: code_analysis_js

if: steps.code_analysis_proxy.outcome == 'success'

    #continue-on-error: true
    if: always()
    run: |
      folder_path="./apiproxy/resources/jsc"

      if [ -d "$folder_path" ]; then
        npm install
        echo "Running code analysis apigee javascript files ....."
        npx eslint --format html $folder_path  > ${{ github.run_id }}_code_Analysis_output/eslintrc-output.html
      else
          echo "The JS folder does not exist." > ${{ github.run_id }}_code_Analysis_output/eslintrc-output.html
      fi

What parser are you using?

Default (Espree)

What did you do?

We are running code analysis on Apigee JS Files for Proxy APIs using eslint using above command.

This is failing with error - Oops! Something went wrong! :(

ESLint: 9.0.0

Error: Could not find config file.

What did you expect to happen?

Code analysis to complete but it is failing.

What actually happened?

The analysis was working as expected but is failing from 15th April onwards. This is failing with error - Oops! Something went wrong! :(

ESLint: 9.0.0

Error: Could not find config file.

Link to Minimal Reproducible Example

sensitive client code

Participation

Additional comments

No response

mdjermanovic commented 1 month ago

There is not enough info to reproduce this, but since you're now using ESLint: 9.0.0, please note that the new config format is eslint.config.js:

https://eslint.org/docs/latest/use/migrate-to-9.0.0#-new-default-config-format-eslintconfigjs

If you're still using the deprecated .eslintrc config format, you can either:

If you are already using the new eslint.config.js config format, please provide more details and a reproducible example.

Sarmistha91 commented 1 month ago

Thanks @mdjermanovic for the update, yes we are currently using .eslintrc.yml file in our CICD Pipeline. I tried replacing it with a flat file (eslint.config.js), but it is failing with error in flat file for the way we are declaring it, Appreciate if you could help us create one sample flat file based on our .eslintrc.yml file (attached in comment - eslintrc.PNG)

eslintrc

)

nzakas commented 4 weeks ago

Closing, as this is not a bug.

@Sarmistha91 we have a lot of documentation about how to create config files and migrate config files that were already shared previously. Please use that to update your config file.

eslint-github-bot[bot] commented 4 weeks ago

It looks like there wasn't enough information for us to know how to help you, so we're closing the issue.

Thanks for your understanding.