SAST ESLint analyzer fails on test projects.

Summary

When running the ESLint SAST analyzer on a test project, it complains about a missing .eslintrc file and fails.

Steps to reproduce

Run pipeline on https://gitlab.com/gitlab-org/security-products/tests/sast https://gitlab.com/gitlab-org/security-products/tests/sast/-/jobs/157796636

Example Project

https://gitlab.com/gitlab-org/security-products/tests/sast

What is the current bug behavior?

ESLint fails when it can't access /.eslintrc

What is the expected correct behavior?

ESLint finds /.eslintrc or .eslintrc in another directory and runs.

Relevant logs and/or screenshots

Found project in /tmp/app/express
Error: Cannot read config file: /.eslintrc
Error: ENOENT: no such file or directory, open '/.eslintrc'
    at Object.openSync (fs.js:449:3)
    at Object.readFileSync (fs.js:349:35)
    at readFile (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:64:15)
    at loadLegacyConfigFile (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:141:44)
    at loadConfigFile (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:240:22)
    at loadFromDisk (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:500:18)
    at Object.load (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:564:20)
    at Config.loadSpecificConfig (/usr/local/lib/node_modules/eslint/lib/config.js:148:46)
    at new Config (/usr/local/lib/node_modules/eslint/lib/config.js:114:14)
    at new CLIEngine (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:462:23)
An error occured while running eslint.
2019/02/07 11:38:09 exit status 2
2019/02/07 11:38:10 Container exited with non zero status code

Output of checks

N/A

Results of GitLab environment info

N/A

Results of GitLab application Check

N/A

Possible fixes

  • Hardcode the position of .eslintrc in the source code, instead of using the HOME environment variable.
  • Or set the HOME environment variable explicitely in the Dockerfile
Assignee Loading
Time tracking Loading