From 7f3ebf61696cab994b310b9605a5b143e93db21c Mon Sep 17 00:00:00 2001 From: eggplants Date: Wed, 26 Jan 2022 20:29:21 +0900 Subject: [PATCH 1/6] add: prettier tesk --- package-lock.json | 2 +- package.json | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2804f0d..4cbbd64 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,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 95e0b53..0e4aced 100644 --- a/package.json +++ b/package.json @@ -20,10 +20,12 @@ "web-vitals": "^2.1.3" }, "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": [ @@ -46,7 +48,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" } } From fcf91e826513de313aa6c71bfb36484a15ef2141 Mon Sep 17 00:00:00 2001 From: eggplants Date: Wed, 26 Jan 2022 20:57:29 +0900 Subject: [PATCH 2/6] fix: syntax with `npm run fix` --- src/components/modals/BaseModal.tsx | 4 +--- src/lib/share.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) 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 836c027..ec3777f 100644 --- a/src/lib/share.ts +++ b/src/lib/share.ts @@ -4,7 +4,7 @@ import { solutionIndex } from './words' export const shareStatus = (guesses: string[]) => { navigator.clipboard.writeText( `Not Wordle ${solutionIndex} ${guesses.length}/6\n\n` + - generateEmojiGrid(guesses) + generateEmojiGrid(guesses) ) } From d9c3b85f473c9c1752250ca99ee44a515aaffd75 Mon Sep 17 00:00:00 2001 From: eggplants Date: Wed, 26 Jan 2022 21:14:23 +0900 Subject: [PATCH 3/6] add: test and lint workflows --- .github/workflows/lint.yml | 12 ++++++++++++ .github/workflows/test.yml | 12 ++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..5f71800 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,12 @@ +name: Lint +on: [pull_request, push] + +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..8c29e09 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,12 @@ +name: Test +on: [pull_request, push] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: | + npm install + - run: | + npm run test From e899edf13ffe28482ae1845e0c98b289866de6cd Mon Sep 17 00:00:00 2001 From: eggplants Date: Wed, 26 Jan 2022 21:15:10 +0900 Subject: [PATCH 4/6] fix: test case --- src/App.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.test.tsx b/src/App.test.tsx index 3a7a8cc..5aa0b42 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -4,6 +4,6 @@ import App from './App' test('renders learn react link', () => { render() - const linkElement = screen.getByText(/learn react/i) + const linkElement = screen.getByText(/Not Wordle/) expect(linkElement).toBeInTheDocument() }) From b95e55c60175fa937a5f0732a7f50907084b1c5a Mon Sep 17 00:00:00 2001 From: eggplants Date: Wed, 26 Jan 2022 21:16:02 +0900 Subject: [PATCH 5/6] fix: test name --- src/App.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.test.tsx b/src/App.test.tsx index 5aa0b42..8bc9bb3 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -2,7 +2,7 @@ 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(/Not Wordle/) expect(linkElement).toBeInTheDocument() From 7efc15f04dc2e76cb6fc0c57498856e4c989d6d1 Mon Sep 17 00:00:00 2001 From: eggplants Date: Wed, 26 Jan 2022 21:17:46 +0900 Subject: [PATCH 6/6] fix: trigger branch on push --- .github/workflows/lint.yml | 6 +++++- .github/workflows/test.yml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5f71800..240cd89 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,5 +1,9 @@ name: Lint -on: [pull_request, push] +on: + pull_request: + push: + branches: + - main jobs: lint: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c29e09..f2789e9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,9 @@ name: Test -on: [pull_request, push] +on: + pull_request: + push: + branches: + - main jobs: test: