diff --git a/.eslintrc.js b/.eslintrc.js index 03946bc..3a641ad 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,7 +1,19 @@ module.exports = { - extends: ["next/core-web-vitals"], + extends: [ + 'next', + 'next/core-web-vitals', + 'eslint:recommended', + 'plugin:react/recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier', + ], + plugins: ['react', '@typescript-eslint'], + parserOptions: { + ecmaVersion: 2021, + sourceType: 'module', + }, rules: { - "react/no-unescaped-entities": 0, - "react/display-name": "off", + 'react/no-unescaped-entities': 0, + 'react/display-name': 'off', }, }; diff --git a/.github/dependabot.yml b/.github/dependabot.yml index aa8ea01..0444a57 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,10 +6,10 @@ version: 2 enable-beta-ecosystems: true updates: - - package-ecosystem: "npm" - directory: "/" + - package-ecosystem: 'npm' + directory: '/' schedule: - interval: "weekly" + interval: 'weekly' open-pull-requests-limit: 10 labels: - dependencies diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 35f5906..c78f821 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,7 +1,7 @@ -name: "CodeQL Advanced" +name: 'CodeQL Advanced' on: - merge_group: + merge_group: branches: - master - dev @@ -37,43 +37,42 @@ jobs: - javascript steps: - - name: Harden Runner - uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 - with: - egress-policy: audit - - - name: Checkout repository - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - name: Harden Runner + uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 + with: + egress-policy: audit - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@2cb752a87e96af96708ab57187ab6372ee1973ab # v2.22.0 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. + - name: Checkout repository + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@2cb752a87e96af96708ab57187ab6372ee1973ab # v2.22.0 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@2cb752a87e96af96708ab57187ab6372ee1973ab # v2.22.0 + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@2cb752a87e96af96708ab57187ab6372ee1973ab # v2.22.0 - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@2cb752a87e96af96708ab57187ab6372ee1973ab # v2.22.0 - with: - category: "/language:${{matrix.language}}" + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@2cb752a87e96af96708ab57187ab6372ee1973ab # v2.22.0 + with: + category: '/language:${{matrix.language}}' diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 65e7203..0000000 --- a/.prettierrc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "printWidth": 80, - "tabWidth": 2, - "semi": true, - "importOrder": [ - "", - "^components/(.*)$", - "^generated/(.*)$", - "^hooks/(.*)$", - "^types/(.*)$", - "^utils/(.*)$", - "^[./]" - ], - "importOrderSortSpecifiers": true -} \ No newline at end of file diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..600bf03 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,8 @@ +module.exports = { + semi: true, + trailingComma: 'all', + singleQuote: true, + printWidth: 100, + tabWidth: 2, + plugins: ['prettier-plugin-tailwindcss'], +}; diff --git a/codegen.yml b/codegen.yml index f147312..31926aa 100644 --- a/codegen.yml +++ b/codegen.yml @@ -1,10 +1,10 @@ overwrite: true #schema: "https://api.studio.thegraph.com/query/64099/proof-of-humanity-sepolia/version/latest" -schema: "https://api.studio.thegraph.com/query/64099/proof-of-humanity-mainnet/version/latest" -documents: "schemas/**/*.gql" +schema: 'https://api.studio.thegraph.com/query/64099/proof-of-humanity-mainnet/version/latest' +documents: 'schemas/**/*.gql' generates: ./src/generated/graphql.ts: plugins: - - "typescript" - - "typescript-operations" - - "typescript-graphql-request" + - 'typescript' + - 'typescript-operations' + - 'typescript-graphql-request' diff --git a/env.d.ts b/env.d.ts index 24313e2..9fd76c0 100644 --- a/env.d.ts +++ b/env.d.ts @@ -15,4 +15,4 @@ declare global { } } -export {}; \ No newline at end of file +export {}; diff --git a/next.config.js b/next.config.js index 7fba1bc..30e5ddd 100644 --- a/next.config.js +++ b/next.config.js @@ -5,7 +5,7 @@ const nextConfig = { config.module.rules.push({ test: /\.svg$/i, issuer: /\.[jt]sx?$/, - use: ["@svgr/webpack"], + use: ['@svgr/webpack'], }); return config; @@ -16,15 +16,15 @@ const nextConfig = { CHIADO_RPC: process.env.CHIADO_RPC, SEPOLIA_RPC: process.env.SEPOLIA_RPC, GNOSIS_RPC: process.env.GNOSIS_RPC, - MAINNET_RPC: process.env.MAINNET_RPC + MAINNET_RPC: process.env.MAINNET_RPC, }, images: { remotePatterns: [ { - protocol: "https", + protocol: 'https', hostname: process.env.REACT_APP_IPFS_GATEWAY, - port: "", - pathname: "/ipfs/**", + port: '', + pathname: '/ipfs/**', }, ], }, diff --git a/package.json b/package.json index 71f8fd2..b575e63 100644 --- a/package.json +++ b/package.json @@ -18,13 +18,17 @@ "@types/ua-parser-js": "^0.7.36", "assert": "^2.0.0", "browserify-zlib": "^0.2.0", - "eslint": "^7.32.0", + "eslint": "^9.13.0", "eslint-config-next": "14.0.1", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.2.1", + "eslint-plugin-react": "^7.37.1", "events": "^3.3.0", "os-browserify": "^0.3.0", "path-browserify": "^1.0.1", "postcss": "^8.4.13", "postcss-nested": "^6.0.0", + "prettier-plugin-tailwindcss": "^0.6.8", "process": "^0.11.10", "stream-browserify": "^3.0.0", "tailwindcss": "^3.4.10", @@ -33,7 +37,6 @@ }, "dependencies": { "@cyntler/react-doc-viewer": "^1.16.3", - "react-markdown": "^8.0.7", "@ffmpeg/ffmpeg": "^0.10.1", "@legendapp/state": "^1.11.1", "@web3modal/ethereum": "^2.7.1", @@ -52,12 +55,13 @@ "next": "14.0.1", "pino-pretty": "^11.0.0", "postcss-import": "^14.1.0", - "prettier": "^2.0.0", + "prettier": "^3.3.3", "react": "^18.2.0", "react-dom": "^18.2.0", "react-dropzone": "^14.2.2", "react-easy-crop": "^4.4.0", "react-jazzicon": "^1.0.4", + "react-markdown": "^8.0.7", "react-select": "^5.7.7", "react-toastify": "^9.0.7", "react-webcam": "^7.0.1", diff --git a/public/manifest.json b/public/manifest.json index 5b23fa6..f01dc4f 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,11 +1,11 @@ { - "background_color": "#fff", - "display": "standalone", - "homepage_url": "https://poh.vercel.app", - "name": "Proof of Humanity", - "description": "Proof of Humanity", - "iconPath": "./poh-logo-colored.svg", - "short_name": "PoH", - "start_url": ".", - "theme_color": "#FF9966" -} \ No newline at end of file + "background_color": "#fff", + "display": "standalone", + "homepage_url": "https://poh.vercel.app", + "name": "Proof of Humanity", + "description": "Proof of Humanity", + "iconPath": "./poh-logo-colored.svg", + "short_name": "PoH", + "start_url": ".", + "theme_color": "#FF9966" +} diff --git a/schemas/request.gql b/schemas/request.gql index 56a3656..fde6cc4 100644 --- a/schemas/request.gql +++ b/schemas/request.gql @@ -87,4 +87,4 @@ query Request($id: ID!) { extraData } } -} \ No newline at end of file +} diff --git a/schemas/requests.gql b/schemas/requests.gql index 5e2c893..63ca152 100644 --- a/schemas/requests.gql +++ b/schemas/requests.gql @@ -1,11 +1,5 @@ query Requests($skip: Int, $first: Int, $where: Request_filter) { - requests( - first: $first - skip: $skip - where: $where - orderBy: creationTime - orderDirection: desc - ) { + requests(first: $first, skip: $skip, where: $where, orderBy: creationTime, orderDirection: desc) { id index status { diff --git a/schemas/valid.vouch.gql b/schemas/valid.vouch.gql index f9cc497..f4a19bb 100644 --- a/schemas/valid.vouch.gql +++ b/schemas/valid.vouch.gql @@ -5,4 +5,4 @@ query HumanityVouch($id: ID!) { expirationTime } } -} \ No newline at end of file +} diff --git a/schemas/winner.fragment.gql b/schemas/winner.fragment.gql index 320b61a..7c4fd78 100644 --- a/schemas/winner.fragment.gql +++ b/schemas/winner.fragment.gql @@ -1,17 +1,9 @@ fragment winnerClaim on Humanity { winnerClaim: requests( - where: { + where: { or: [ - { - revocation: false, - status: "resolved", - winnerParty: "requester" - }, - { - revocation: false, - status: "transferring", - winnerParty: "requester" - } + { revocation: false, status: "resolved", winnerParty: "requester" } + { revocation: false, status: "transferring", winnerParty: "requester" } ] } orderBy: resolutionTime @@ -26,4 +18,4 @@ fragment winnerClaim on Humanity { } } } -} \ No newline at end of file +} diff --git a/src/app/Footer.tsx b/src/app/Footer.tsx index 077efe0..6915622 100644 --- a/src/app/Footer.tsx +++ b/src/app/Footer.tsx @@ -1,14 +1,10 @@ -import Image from "next/image"; -import ExternalLink from "components/ExternalLink"; +import Image from 'next/image'; +import ExternalLink from 'components/ExternalLink'; const Footer: React.FC = () => ( -
- - BUILT BY{" "} - kleros +
+ + BUILT BY kleros
diff --git a/src/app/Header/DesktopNavigation.tsx b/src/app/Header/DesktopNavigation.tsx index 8d17418..4c1bca9 100644 --- a/src/app/Header/DesktopNavigation.tsx +++ b/src/app/Header/DesktopNavigation.tsx @@ -1,8 +1,8 @@ -import Link from "next/link"; -import { useSearchParams } from "next/navigation"; -import { sepolia } from "viem/chains"; -import ExternalLink from "components/ExternalLink"; -import { prettifyId } from "utils/identifier"; +import Link from 'next/link'; +import { useSearchParams } from 'next/navigation'; +import { sepolia } from 'viem/chains'; +import ExternalLink from 'components/ExternalLink'; +import { prettifyId } from 'utils/identifier'; interface DesktopNavigationProps { web3Loaded: boolean; @@ -22,25 +22,21 @@ const DesktopNavigation = ({ address, }: DesktopNavigationProps) => { const searchParams = useSearchParams(); - const currentUrl = searchParams.get("url"); + const currentUrl = searchParams.get('url'); return ( -
+
{web3Loaded && chain.id === sepolia.id && ( - - Faucet - + Faucet )} - + Profiles {me && (me.pohId ? ( PoH ID @@ -53,14 +49,14 @@ const DesktopNavigation = ({ }/${me.currentRequest.index}` : `/${prettifyId(address!)}/claim` } - className={`${pathname.includes("/claim") ? "font-bold" : ""}`} + className={`${pathname.includes('/claim') ? 'font-bold' : ''}`} > Register ))} Policy diff --git a/src/app/Header/MobileMenu.tsx b/src/app/Header/MobileMenu.tsx index 7b45a63..99ad674 100644 --- a/src/app/Header/MobileMenu.tsx +++ b/src/app/Header/MobileMenu.tsx @@ -1,9 +1,9 @@ -import Link from "next/link"; -import { useSearchParams } from "next/navigation"; -import { Ref, forwardRef } from "react"; -import { prettifyId } from "utils/identifier"; -import Options from "./Options"; -import WalletSection from "./WalletSection"; +import Link from 'next/link'; +import { useSearchParams } from 'next/navigation'; +import { Ref, forwardRef } from 'react'; +import { prettifyId } from 'utils/identifier'; +import Options from './Options'; +import WalletSection from './WalletSection'; interface MobileMenuProps { policy: string; @@ -17,27 +17,25 @@ interface MobileMenuProps { const MobileMenu = forwardRef( ( { policy, me, pathname, address, web3Loaded, isConnected }: MobileMenuProps, - ref: Ref + ref: Ref, ) => { const searchParams = useSearchParams(); - const currentUrl = searchParams.get("url"); + const currentUrl = searchParams.get('url'); return (