diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..240cd89 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,16 @@ +name: Lint +on: + pull_request: + push: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Prettify code + uses: creyD/prettier_action@v4.2 + with: + prettier_options: --check src diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f2789e9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,16 @@ +name: Test +on: + pull_request: + push: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: | + npm install + - run: | + npm run test diff --git a/package-lock.json b/package-lock.json index 6642a0f..139b19c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,7 @@ "devDependencies": { "autoprefixer": "^10.4.2", "postcss": "^8.4.5", - "prettier": "^2.5.1", + "prettier": "2.5.1", "tailwindcss": "^3.0.12" } }, diff --git a/package.json b/package.json index ca3548f..08483b5 100644 --- a/package.json +++ b/package.json @@ -21,10 +21,12 @@ "react-countdown": "^2.3.2" }, "scripts": { - "start": "react-scripts start", "build": "react-scripts build", - "test": "react-scripts test", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "fix": "prettier --write src", + "lint": "prettier --check src", + "start": "react-scripts start", + "test": "react-scripts test" }, "eslintConfig": { "extends": [ @@ -47,7 +49,7 @@ "devDependencies": { "autoprefixer": "^10.4.2", "postcss": "^8.4.5", - "tailwindcss": "^3.0.12", - "prettier": "^2.5.1" + "prettier": "2.5.1", + "tailwindcss": "^3.0.12" } } diff --git a/src/App.test.tsx b/src/App.test.tsx index 3a7a8cc..8bc9bb3 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -2,8 +2,8 @@ import React from 'react' import { render, screen } from '@testing-library/react' import App from './App' -test('renders learn react link', () => { +test('renders App component', () => { render() - const linkElement = screen.getByText(/learn react/i) + const linkElement = screen.getByText(/Not Wordle/) expect(linkElement).toBeInTheDocument() }) diff --git a/src/components/modals/BaseModal.tsx b/src/components/modals/BaseModal.tsx index 8b976ae..bf2844c 100644 --- a/src/components/modals/BaseModal.tsx +++ b/src/components/modals/BaseModal.tsx @@ -61,9 +61,7 @@ export const BaseModal = ({ title, children, isOpen, handleClose }: Props) => { > {title} -
- {children} -
+
{children}
diff --git a/src/lib/share.ts b/src/lib/share.ts index a5e1e62..9d55706 100644 --- a/src/lib/share.ts +++ b/src/lib/share.ts @@ -4,7 +4,7 @@ import { solutionIndex } from './words' export const shareStatus = (guesses: string[], lost: boolean) => { navigator.clipboard.writeText( `Not Wordle ${solutionIndex} ${lost?"X":guesses.length}/6\n\n` + - generateEmojiGrid(guesses) + generateEmojiGrid(guesses) ) }