Skip to content

Remove orphaned .js files

Eric Eastwood requested to merge feature/1884-remove-orphaned-files into develop

Remove orphaned .js files

Found with this small bash utility script, https://justin.abrah.ms/js/finding_unused_requirejs_imports.html. There will be some false-positives (tests, utility scripts, dynamic imports)

~/Downloads/finding_unused_requirejs_imports.sh . > ~/Downloads/finding_unused_requirejs_imports1.txt

#/bin/bash
echo "$@"
JS_FILES=$(find "$@" -name "*.js" -not -path "./node_modules/*")

for FILE in $JS_FILES; do
  short_name=`basename $FILE`
  filename="${short_name%.*}"
  git grep --quiet $filename 1>/dev/null
  if [ "$?" == "1" ]; then
    echo "Should delete: $FILE"
  fi
done;

Fix https://gitlab.com/gitlab-org/gitter/webapp/issues/1884

Edited by Eric Eastwood

Merge request reports