JS Optional chaining operator breaks SAST
Problem
Currently SAST fails due to eslint error
SyntaxError: in/ee/app/assets/javascripts/notes/mixins/diff_line_note_form.js: Unexpected token (66:50)
1712 64 |
1713 65 | // eslint-disable-next-line camelcase
1714 > 66 | const diffFileHeadSha = this.commit && this?.diffFile?.diff_refs?.head_sha;
1715 | ^
1716 67 |
1717 68 | postData.data.note.commit_id = diffFileHeadSha || null;
1718 69 |
1719 2019/12/12 10:07:28 exit status 1
@jboyson
started a discussion about this.
Some possible solutions
Option A) add "parser": "babel-eslint"
to https://gitlab.com/gitlab-org/security-products/analyzers/eslint/blob/master/eslintrc and add babel-config there.
Option B) add some kind of option/envvar to lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
and tell it to use babel-parser
Option C) Revert !21621 (merged)
Edited by Simon Knox