Skip to content

Refactor(createFlash): use non-deprecated function

What does this MR do?

This MR migrates files away from using deprecatedCreateFlash to using createFlash instead using this codemod. Afterwards the files were prettiered.

Note to reviewer: I would encourage you to review this MR each commit on its own. It consists of two commits:

  1. contains only manual changes. Can be reviewed as per usual.
  2. contains only automatic fixes. You can see the codemod in action here: https://astexplorer.net/#/gist/5ec4340ebc1ae1f618df553db3f0720a/bcfb965aaafd223ae47aeef7ce473127335bf378, but you can also run it yourself and inspect the changes.

You can run the codemod yourself. Checkout this repo and run this command, where ROOT_DIR is the location of the gitlab-repo (I used a modification of this to target the files I had changed using git diff HEAD~1 --name-only):

FILE_COUNT=100 ROOT_DIR=~/workspace/gdk/gitlab; (cd $ROOT_DIR; git ls-tree -r HEAD --name-only | grep -E "\.(vue|js)$" --max-count="$FILE_COUNT") | while read line; do echo "$ROOT_DIR/$line"; done | xargs yarn jscodeshift --extensions="vue,js" --ignore-pattern="$ROOT_DIR/app/assets/javascripts/locale/*" --ignore-pattern="$ROOT_DIR/spec/*" --ignore-pattern="$ROOT_DIR/ee/spec/*" -t=./src/migrateCreateFlash.js

What is the difference:

Functionality-wise; nothing! deprecatedCreateFlash calls createFlash under the hood and so it is only really the structure of the arguments that make the difference.

Screenshots (strongly suggested)

No visual changes.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Related to #3895 (closed)

Edited by Michael Lunøe

Merge request reports