Skip to content

Commit cbda0fc

Browse files
authored
Modernise and cleanup lint configuration and build process (#1177)
Migrated eslint-graph-config and solhint-graph-config to be configuration files in repo root that are inherited from for packages. It is presumed we do not need to maintain these config packages for external dependencies, and they have been deleted. Upgraded linting engines (ESLint, Solhint, Prettier) and added linting of Markdown, JSON, and YAML. Upgraded to Node version 20 (from 18). Might not work anymore when using Node version 18. Consistently made Prettier the last to process during linting, upgrading Prettier config to match ESLint config and avoid conflicts. Changed import ordering to be automated (by running yarn lint) using eslint-plugin-simple-import-sort. Also sorts exports. Dropped no-secrets ESLint plugin due to version conflicts and low signal to noise ratio. Upgraded Yarn and resolved dependency version clashes. Upgraded and simplified Husky pre-commit behaviour. Currently using repo root .gitignore as single source for lint files to ignore. This is imperfect, and might need to be subsequently adjusted and revisited. Attempted to preserve Lint/Prettier config parameters, however I think import and export sorting have changed, and in some cases dangling commas will be added where they were previously removed (an improvement IMO). Upgraded linting engines mean more issues are detected, and likely some changes in behaviour. Added incremental and cached linting and building in various places. Bumping versions of contracts and token-distribution as the TS interfaces are not backwards compatible, and minor of other packages as should be considered a different version now. GitHub workflow to run lints.
1 parent 03ffaa9 commit cbda0fc

File tree

91 files changed

+9971
-7771
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+9971
-7771
lines changed

.devcontainer/Dockerfile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ ENV DEBIAN_FRONTEND=noninteractive
66
# Switch to root for installing packages
77
USER root
88

9-
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
10-
119
# Install additional dependencies
1210
RUN apt update && apt install -y \
1311
build-essential \
14-
nodejs \
12+
curl \
1513
jq \
1614
python3 \
1715
python3-pip \
@@ -20,8 +18,12 @@ RUN apt update && apt install -y \
2018
&& apt clean \
2119
&& rm -rf /var/lib/apt/lists/*
2220

23-
# Install Node.js
24-
RUN npm install -g n && n 20.12.0
21+
# Install Node.js 20.x using NodeSource
22+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
23+
apt update && \
24+
apt install -y nodejs && \
25+
apt clean && \
26+
rm -rf /var/lib/apt/lists/*
2527

2628
# Install Solidity compiler using pipx (isolated environment)
2729
RUN pipx install solc-select && \
@@ -59,9 +61,10 @@ RUN curl -L https://foundry.paradigm.xyz | bash && \
5961
chmod 755 /usr/local/bin/forge && \
6062
chmod 755 /usr/local/bin/chisel
6163

62-
# Set up yarn
64+
# Set up yarn and pnpm
6365
RUN corepack enable && \
64-
corepack prepare [email protected] --activate
66+
corepack prepare [email protected] --activate && \
67+
corepack prepare [email protected] --activate
6568

6669
# Ensure all users have access to the tools
6770
RUN chmod 755 /usr/local/bin/* && \

.devcontainer/docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,14 @@ services:
3636
- vscode-data:/home/vscode/.local/share
3737
- vscode-bin:/home/vscode/.local/bin
3838

39+
# Shared pnpm cache (safe due to content-addressable storage)
40+
- pnpm-store:/home/vscode/.local/share/pnpm
41+
- pnpm-cache:/home/vscode/.cache/pnpm
42+
3943
volumes:
4044
vscode-cache:
4145
vscode-config:
4246
vscode-data:
4347
vscode-bin:
48+
pnpm-store:
49+
pnpm-cache:

.devcontainer/setup-git-signing.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env bash
1+
#!/usr/bin/env bash
22
# Automatically configure Git to use SSH signing with forwarded SSH keys
33
set -euo pipefail
44

.github/actions/setup/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@ runs:
44
using: composite
55

66
steps:
7+
- name: Install system dependencies
8+
shell: bash
9+
run: |
10+
sudo apt-get update
11+
sudo apt-get install -y libudev-dev libusb-1.0-0-dev
712
- name: Enable corepack for modern yarn
813
shell: bash
914
run: corepack enable
1015
- name: Install Node.js
1116
uses: actions/setup-node@v4
1217
with:
13-
node-version: 18
18+
node-version: 20
1419
cache: 'yarn'
1520
- name: Install dependencies
1621
shell: bash

.github/workflows/ci-contracts.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ env:
55

66
on:
77
push:
8-
branches: "*"
8+
branches: '*'
99
paths:
1010
- packages/contracts/**
1111
pull_request:
12-
branches: "*"
12+
branches: '*'
1313
paths:
1414
- packages/contracts/**
1515
workflow_dispatch:
@@ -22,10 +22,13 @@ jobs:
2222
uses: actions/checkout@v4
2323
- name: Set up environment
2424
uses: ./.github/actions/setup
25-
- name: Build
25+
- name: Build dependencies
2626
run: |
2727
pushd packages/contracts
28-
yarn build || yarn build
28+
yarn build
29+
popd
30+
pushd packages/sdk
31+
yarn build
2932
- name: Run tests
3033
run: |
3134
pushd packages/contracts

.github/workflows/ci-data-edge.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ env:
55

66
on:
77
push:
8-
branches: "*"
8+
branches: '*'
99
paths:
1010
- packages/data-edge/**
1111
pull_request:
12-
branches: "*"
12+
branches: '*'
1313
paths:
1414
- packages/data-edge/**
1515
workflow_dispatch:
@@ -27,4 +27,6 @@ jobs:
2727
pushd packages/data-edge
2828
yarn build
2929
- name: Run tests
30-
run: yarn test
30+
run: |
31+
pushd packages/data-edge
32+
yarn test

.github/workflows/ci-token-dist.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ env:
66

77
on:
88
push:
9-
branches: "*"
9+
branches: '*'
1010
paths:
1111
- packages/token-distribution/**
1212
pull_request:
13-
branches: "*"
13+
branches: '*'
1414
paths:
1515
- packages/token-distribution/**
1616
workflow_dispatch:
@@ -23,9 +23,15 @@ jobs:
2323
uses: actions/checkout@v4
2424
- name: Set up environment
2525
uses: ./.github/actions/setup
26+
- name: Build contracts (dependency)
27+
run: |
28+
pushd packages/contracts
29+
yarn build
2630
- name: Build
2731
run: |
2832
pushd packages/token-distribution
2933
yarn build
3034
- name: Run tests
31-
run: yarn test
35+
run: |
36+
pushd packages/token-distribution
37+
yarn test

0 commit comments

Comments
 (0)