Skip to content

Instantly share code, notes, and snippets.

@viktor-yakubiv
Created November 12, 2021 08:32
Show Gist options
  • Save viktor-yakubiv/65d0b14d37304b699fd6b6fc5cfcfef7 to your computer and use it in GitHub Desktop.
Save viktor-yakubiv/65d0b14d37304b699fd6b6fc5cfcfef7 to your computer and use it in GitHub Desktop.
Check if you use proper TypeScript rules for ESLint
# Run within this directory:
# https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin/docs/rules
#
# Before running execute `eslint --print-config <src> > eslint.json`
# and copy this file to the directory where this script is ran.
for file in $(ls *.md); do
rule=${file%.md}
# fgrep "\"$rule\"" eslint.json
es_res=$(jq ".rules[\"$rule\"][0]" eslint.json)
ts_res=$(jq ".rules[\"@typescript-eslint/$rule\"][0]" eslint.json)
if [ $es_res != null ] && [ $ts_res == null ]; then
echo "$rule: $es_res"
echo "'@typescript-eslint/$rule': $ts_res"
echo
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment