Last active
December 23, 2022 01:20
-
-
Save TyIsI/f9d772dc71409435d73db380a567a89e to your computer and use it in GitHub Desktop.
Open all the broken files!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TMPFILE=$(mktemp) | |
TMPFORMATTER=$(mktemp) | |
{ | |
echo 'module.exports = (results) => {' | |
echo ' return results' | |
echo ' .filter(result => result.messages.length > 0)' | |
echo " .map(result => \`\${result.messages.length}\\t\${result.filePath.replace(/.*(src\/.*)/, '\$1')}\`).join('\\n')" | |
echo '}' | |
} > ${TMPFORMATTER} | |
yarn eslint -f ${TMPFORMATTER} -o ${TMPFILE} src > /dev/null 2>&1 | |
cat ${TMPFILE} | egrep -v 'Attic|\.types\.ts' | sort -nr | awk '{ print $2 }' | while read SRCFILE; do | |
echo "Opening ${SRCFILE}" | |
code --wait ${SRCFILE} | |
done | |
rm ${TMPFILE} ${TMPFORMATTER} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When you really don't know where to start with fixing all your broken files after an update.
Based on
eslint
, this script makes a list of files and error counts and one-by-one opens the most broken files first.Assumes that everything is in the
src
directory.