Skip to content

Commit

Permalink
Merge pull request #246 from UTDNebula/prettier-changes
Browse files Browse the repository at this point in the history
Prettier changes & fixes
  • Loading branch information
nl32 authored Oct 3, 2024
2 parents 959f1ff + f555151 commit eae9bf3
Show file tree
Hide file tree
Showing 10 changed files with 400 additions and 291 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/generateCheck.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
if [ $status == 0 ]; then
echo "## Formatting Check passed 🥳" >>$GITHUB_STEP_SUMMARY
echo "All files are formatted correctly" >>$GITHUB_STEP_SUMMARY
exit 0
if [ $status == 'success' ]; then
echo "## Formatting Check passed 🥳" >>$GITHUB_STEP_SUMMARY
echo "All files are formatted correctly" >>$GITHUB_STEP_SUMMARY
exit 0
else
echo "## Formatting Check Failed 😅" >>$GITHUB_STEP_SUMMARY
echo "Please run prettier using \`npx prettier . --write\` in order to format your code" >>$GITHUB_STEP_SUMMARY
echo "### Files with bad formatting:" >>$GITHUB_STEP_SUMMARY
for file in $files; do
echo "- $file" >>$GITHUB_STEP_SUMMARY
echo "::error file=$file::$file not formatted correctly"
done
exit 1
echo "## Formatting Check Failed 😅" >>$GITHUB_STEP_SUMMARY
echo "Please run prettier using \`npx prettier . --write\` in order to format your code" >>$GITHUB_STEP_SUMMARY
echo "### Files with bad formatting:" >>$GITHUB_STEP_SUMMARY
for file in $files; do
echo "- $file" >>$GITHUB_STEP_SUMMARY
echo "::error file=$file::$file not formatted correctly"
done
exit 1
fi
14 changes: 6 additions & 8 deletions .github/workflows/prettierCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ jobs:
node-version: 18
cache: 'npm'
- name: Run npm install
run: |
mv package.json package.json.bak
npm i --no-save prettier prettier-plugin-tailwindcss
mv package.json.bak package.json
run: npm ci
- name: Run prettier
run: |
files=`npx prettier . -l` || st=$? && st=$?
echo status=`echo $st`>>"$GITHUB_ENV"
echo files=`echo $files`>> "$GITHUB_ENV"
id: prettier
continue-on-error: true
run: echo files=`npx prettier . -l` >> "$GITHUB_ENV"
- name: generate errors/summary
run: .github/workflows/generateCheck.sh
env:
status: ${{ steps.prettier.outcome }}
9 changes: 0 additions & 9 deletions .prettierrc.js

This file was deleted.

16 changes: 16 additions & 0 deletions .prettierrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @see https://prettier.io/docs/en/configuration.html
* @type {import("prettier").Config}
*/
const config = {
printWidth: 80,
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
useTabs: false,
bracketSameLine: false,
plugins: ['prettier-plugin-tailwindcss'],
};

export default config;
Loading

0 comments on commit eae9bf3

Please sign in to comment.