Skip to content

Commit

Permalink
Merge pull request ubiquity#264 from 0x4007/chore/merge-chore/sync-te…
Browse files Browse the repository at this point in the history
…mplate-template
  • Loading branch information
0x4007 authored Jul 22, 2024
2 parents 80c5451 + a544ea2 commit 04592bb
Show file tree
Hide file tree
Showing 30 changed files with 1,831 additions and 1,456 deletions.
8 changes: 5 additions & 3 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@
"useGitignore": true,
"language": "en",
"words": [
"blockscan",
"funder",
"Funder",
"binkey",
"binsec",
"blockscan",
"chainlist",
"cirip",
"Claimability",
"dataurl",
"devpool",
"ethersproject",
"fract",
"funder",
"Funder",
"gnosisscan",
"godb",
"greyscale",
"IERC",
"keccak",
"keypair",
"Knip",
"libsodium",
"mswjs",
"Numberish",
"outdir",
"Rpcs",
Expand Down
90 changes: 19 additions & 71 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,24 @@
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json"],
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "sonarjs"],
"plugins": ["@typescript-eslint", "sonarjs", "filename-rules"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:sonarjs/recommended"],
"ignorePatterns": ["**/*.js"],
"ignorePatterns": ["**/*.js", ".github/knip.ts"],
"rules": {
"prefer-arrow-callback": [
"warn",
{
"allowNamedFunctions": true,
},
],
"func-style": [
"warn",
"declaration",
{
"allowArrowFunctions": false,
},
],
"filename-rules/match": [2, "/^(e2e\\.ts$|.*/e2e\\.ts$|[a-z0-9]+(?:[-._a-z0-9]+)*\\.ts|\\.[a-z0-9]+)$/"],
"prefer-arrow-callback": ["warn", { "allowNamedFunctions": true }],
"func-style": ["warn", "declaration", { "allowArrowFunctions": false }],
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"constructor-super": "error",
"no-invalid-this": "off",
"@typescript-eslint/no-invalid-this": ["error"],
"@typescript-eslint/no-invalid-this": ["error", { "capIsConstructor": false }],
"no-restricted-syntax": ["error", "ForInStatement"],
"use-isnan": "error",
"no-unneeded-ternary": "error",
"no-nested-ternary": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
Expand All @@ -49,60 +41,16 @@
"sonarjs/no-identical-expressions": "error",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "interface",
"format": ["PascalCase"],
"custom": {
"regex": "^I[A-Z]",
"match": false,
},
},
{
"selector": "memberLike",
"modifiers": ["private"],
"format": ["camelCase"],
"leadingUnderscore": "require",
},
{
"selector": "typeLike",
"format": ["PascalCase"],
},
{
"selector": "typeParameter",
"format": ["PascalCase"],
"prefix": ["T"],
},
{
"selector": "variable",
"format": ["camelCase", "UPPER_CASE"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow",
},
{
"selector": "variable",
"format": ["camelCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow",
},
{
"selector": "variable",
"modifiers": ["destructured"],
"format": null,
},
{
"selector": "variable",
"types": ["boolean"],
"format": ["PascalCase"],
"prefix": ["is", "should", "has", "can", "did", "will", "does"],
},
{
"selector": "variableLike",
"format": ["camelCase"],
},
{
"selector": ["function", "variable"],
"format": ["camelCase"],
},
{ "selector": "interface", "format": ["StrictPascalCase"], "custom": { "regex": "^I[A-Z]", "match": false } },
{ "selector": "memberLike", "modifiers": ["private"], "format": ["strictCamelCase"], "leadingUnderscore": "require" },
{ "selector": "typeLike", "format": ["StrictPascalCase"] },
{ "selector": "typeParameter", "format": ["StrictPascalCase"], "prefix": ["T"] },
{ "selector": "variable", "format": ["strictCamelCase", "UPPER_CASE"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" },
{ "selector": "variable", "format": ["strictCamelCase"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" },
{ "selector": "variable", "modifiers": ["destructured"], "format": null },
{ "selector": "variable", "types": ["boolean"], "format": ["StrictPascalCase"], "prefix": ["is", "should", "has", "can", "did", "will", "does"] },
{ "selector": "variableLike", "format": ["strictCamelCase"] },
{ "selector": ["function", "variable"], "format": ["strictCamelCase"] },
],
},
}
14 changes: 14 additions & 0 deletions .github/knip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { KnipConfig } from "knip";

const config: KnipConfig = {
entry: ["build/esbuild-build.ts", "static/scripts/rewards/init.ts"],
project: ["src/**/*.ts", "static/scripts/**/*.ts"],
ignore: ["src/types/config.ts", "**/__mocks__/**", "**/__fixtures__/**", "lib/**/*"],
ignoreExportsUsedInFile: true,
// eslint can also be safely ignored as per the docs: https://knip.dev/guides/handling-issues#eslint--jest
ignoreDependencies: ["eslint-config-prettier", "eslint-plugin-prettier"],
eslint: true,
ignoreBinaries: ["forge"],
};

export default config;
24 changes: 9 additions & 15 deletions .github/workflows/cypress-testing.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
name: test

name: Run Cypress testing suite
on:
push:
branches:
- main
- development
pull_request:
branches:
- main
- development

env:
FOUNDRY_PROFILE: ci
workflow_dispatch:
workflow_run:
workflows: ["Build"]
types:
- completed

jobs:
tests:
name: Cypress tests
cypress-run:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -65,6 +57,8 @@ jobs:
PAYMENT_TOKEN_ADDRESS: "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d"
RPC_PROVIDER_URL: "http://localhost:8545"
UBIQUIBOT_PRIVATE_KEY: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/kebab-case.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/knip-reporter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Knip-reporter

on:
workflow_run:
workflows: ["Knip"]
types:
- completed

jobs:
knip-reporter:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion != 'success' }}
steps:
- uses: actions/download-artifact@v4
with:
name: knip-results
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Read pr number
id: pr-number
uses: juliangruber/read-file-action@v1
with:
path: ./pr-number.txt
trim: true

- name: Report knip results to pull request
uses: gitcoindev/knip-reporter@main
with:
verbose: true
comment_id: ${{ github.workflow }}-reporter
command_script_name: knip-ci
annotations: true
ignore_results: false
json_input: true
json_input_file_name: knip-results.json
pull_request_number: ${{ steps.pr-number.outputs.content }}
token: ${{ secrets.GITHUB_TOKEN }}
38 changes: 38 additions & 0 deletions .github/workflows/knip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Knip

on:
pull_request:

jobs:
run-knip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

# needed to use yarn v4
- name: Enable corepack
run: corepack enable

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.10.0

- name: Install toolchain
run: yarn install

- name: Store PR number
run: echo ${{ github.event.number }} > pr-number.txt

- name: Run Knip
run: yarn knip || yarn knip --reporter json > knip-results.json

- name: Upload knip result
if: failure()
uses: actions/upload-artifact@v4
with:
name: knip-results
path: |
knip-results.json
pr-number.txt
30 changes: 0 additions & 30 deletions .github/workflows/scripts/kebab-case.sh

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/scripts/kebabalize.sh

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/test.yml

This file was deleted.

Loading

0 comments on commit 04592bb

Please sign in to comment.