Skip to content

chore(ci/pr-checks): add lint checks #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,22 @@ runs:
steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 'lts/iron'
with: { node-version-file: .nvmrc }

- name: Install PNPM
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Get PNPM store path
id: pnpm-cache
- name: Get pnpm store directory
shell: bash
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
echo "PNPM_STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV

- name: Setup PNPM cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
path: ${{ env.PNPM_STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# TODO(@raducristianpopa): add lint/format checks and tests

jobs:
build:
name: Build
Expand All @@ -39,6 +37,26 @@ jobs:
path: dist/${{ matrix.browser }}.zip
if-no-files-found: error

lint:
name: Lint
runs-on: ubuntu-22.04
continue-on-error: true
env:
FORCE_COLOR: true
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Environment setup
uses: ./.github/actions/setup

- run: pnpm format
if: always()
- run: pnpm lint
if: always()
- run: pnpm typecheck
if: always()

test:
name: Test
runs-on: ubuntu-22.04
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"scripts": {
"build": "tsx ./scripts/build.ts",
"dev": "tsx ./scripts/dev.ts",
"lint": "concurrently \"pnpm:lint:*\"",
"lint:fix": "eslint --ext js,jsx,ts,tsx, src --fix",
"lint:eslint": "eslint . --ext .js,.ts,.tsx --max-warnings 0 --ignore-path .gitignore",
"lint:prettier": "prettier \"**/*.(md|json|yml)\" --ignore-path .gitignore --check",
"lint:type": "tsc --noEmit",
"lint": "eslint . --cache --cache-location 'node_modules/.cache/eslintcache' --max-warnings 0",
"lint:fix": "eslint . --fix --cache --cache-location 'node_modules/.cache/eslintcache' --max-warnings 0",
"format": "prettier . --check --cache --cache-location='node_modules/.cache/prettiercache'",
"format:fix": "prettier . --write --cache --cache-location='node_modules/.cache/prettiercache' --log-level=warn",
"typecheck": "tsc --noEmit",
"profiler": "tsx ./scripts/profiler.ts",
"test": "jest --maxWorkers=2 --passWithNoTests",
"test:ci": "pnpm test -- --reporters=default --reporters=github-actions"
Expand Down
1 change: 0 additions & 1 deletion src/background/services/storage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Logger } from '@/shared/logger'
import type { PopupStore, Storage, StorageKey } from '@/shared/types'
import { type Browser } from 'webextension-polyfill'
import { getCurrentActiveTab } from '../utils'
Expand Down
1 change: 1 addition & 0 deletions src/content/debug.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
const listenForLinkChange = (mutationsList: MutationRecord[]) => {
if (
mutationsList[0].addedNodes.length &&
Expand Down
1 change: 0 additions & 1 deletion src/popup/components/ConnectWalletForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
getCurrencySymbol
} from '@/popup/lib/utils'
import { useForm } from 'react-hook-form'
import { numericFormatter } from 'react-number-format'

interface ConnectWalletFormInputs {
walletAddressUrl: string
Expand Down
1 change: 0 additions & 1 deletion src/popup/components/PayWebsiteForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from '@/popup/lib/utils'
import React, { useMemo } from 'react'
import { useForm } from 'react-hook-form'
import { numericFormatter } from 'react-number-format'
import { AnimatePresence, m } from 'framer-motion'
import { Spinner } from './Icons'
import { cn } from '@/shared/helpers'
Expand Down
7 changes: 1 addition & 6 deletions src/popup/components/ui/RadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,7 @@ export const Radio = ({

<label htmlFor={inputId} className="group flex items-center">
<span
className={`inline-block h-6 w-6 rounded-full border-2 border-base
peer-checked:group-[]:border-blue-500
peer-checked:group-[]:bg-primary
peer-checked:group-[]:ring-4
peer-checked:group-[]:ring-inset
peer-checked:group-[]:ring-white`}
className={`inline-block h-6 w-6 rounded-full border-2 border-base peer-checked:group-[]:border-blue-500 peer-checked:group-[]:bg-primary peer-checked:group-[]:ring-4 peer-checked:group-[]:ring-inset peer-checked:group-[]:ring-white`}
/>
{label ? (
<p className="ms-2 text-base leading-6 text-medium">{label}</p>
Expand Down
Loading