diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..8126495 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,47 @@ +# .github/workflows/lint-format.yml + +name: Lint and Format + +# Run this workflow on pull requests targeting 'main' or 'dev' branches +on: + pull_request: + branches: + - main + - dev + +jobs: + lint-and-format: + runs-on: ubuntu-latest + + steps: + # Step 1: Check out the code + - name: Checkout code + uses: actions/checkout@v4 + + # Step 2: Set up Node.js (specify the Node version if required) + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' # Adjust the version if necessary + + # Step 3: Install dependencies + - name: Install dependencies + run: npm install + + # Step 4: Run ESLint to check for linting issues + - name: Run ESLint + run: npm run lint -- --fix # Make sure you have a lint script in package.json + + - name: List Changes + run: git status --porcelain + + # Step 6: Check for changes after formatting + - name: Check for formatting changes + run: | + if [[ `git status --porcelain` ]]; then + echo "There are formatting changes." + echo "Please commit the changes locally or configure auto-formatting in Prettier." + exit 1 + else + echo "No formatting changes needed." + fi diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..a261b7c --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "semi": true, + "singleQuote": true, + "printWidth": 80, + "trailingComma": "es5" +} diff --git a/client/src/pages/Login.tsx b/client/src/pages/Login.tsx index efd6e9e..11d52e0 100644 --- a/client/src/pages/Login.tsx +++ b/client/src/pages/Login.tsx @@ -52,45 +52,45 @@ const Login: React.FC = () => { }; return ( -
+

Login

- {error &&
{error}
} -
-
- + {error &&
{error}
} + void handleLogin(event)}> +
+ setUsername(e.target.value)} />
-
- +
+ setEmail(e.target.value)} />
-
- +
+ setPassword(e.target.value)} required />
- -
+

- Don't have an account? Sign up here + Don't have an account? Sign up here

diff --git a/client/src/pages/SignUp.tsx b/client/src/pages/SignUp.tsx index 3047beb..8fa12a7 100644 --- a/client/src/pages/SignUp.tsx +++ b/client/src/pages/SignUp.tsx @@ -1,6 +1,6 @@ +// import { deepStrictEqual } from 'assert'; import React, { useState } from 'react'; import { useNavigate } from 'react-router-dom'; -//import '../index.scss'; //TODO: do we need to import this here and main.tsx const SignUp: React.FC = () => { const [username, setUsername] = useState(''); @@ -62,71 +62,73 @@ const SignUp: React.FC = () => { }; return ( -
+

Sign Up

- {error &&
{error}
} -
-
- + {error &&
{error}
} + void handleSignUp(event)}> +
+ setUsername(e.target.value)} required />
-
- +
+ setDisplayName(e.target.value)} required />
-
- +
+ setWorkEmail(e.target.value)} required />
-
- +
+ setWorkPhone(e.target.value)} required />
-
- +
+ setPassword(e.target.value)} required />
-
- +
+ setConfirmPassword(e.target.value)} required />
- +
);