From 51c4aeb5dc46c88db1a989b524cc5da75a4e8c43 Mon Sep 17 00:00:00 2001 From: Pratyush Venkatakrishnan Date: Sat, 30 Nov 2024 14:14:28 -0500 Subject: [PATCH] Set up CI for Prettier and ESLint --- .github/workflows/eslint.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/prettier.yml | 30 ++++++++++++++++++++++++++++++ package.json | 4 +++- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/eslint.yml create mode 100644 .github/workflows/prettier.yml diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml new file mode 100644 index 0000000..a3dcb7e --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,30 @@ +name: ESLint + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - name: Install node dependencies + run: npm install + - name: Run ESLint + run: npm run ci-eslint diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml new file mode 100644 index 0000000..233e991 --- /dev/null +++ b/.github/workflows/prettier.yml @@ -0,0 +1,30 @@ +name: Prettier + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - name: Install node dependencies + run: npm install + - name: Run Prettier + run: npm run ci-prettier diff --git a/package.json b/package.json index 2161421..21b076c 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,9 @@ "start": "react-scripts start", "build": "react-scripts build", "eject": "react-scripts eject", - "format": "prettier --check **/*.{ts,tsx}" + "format": "prettier --write **/*.{ts,tsx}", + "ci-prettier": "prettier --check **/*.{ts,tsx}", + "ci-eslint": "eslint **/*.{ts,tsx}" }, "eslintConfig": { "extends": [