-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(contracts): linting & formatting updates, including CI workflow (…
…#77) * chore: upgrade to latest/consistent eslint dependencies * chore(contracts): fix ESLint errors * chore(contracts): .eslintrc.js -> .eslintrc * chore(contracts): run prettier --fix on contracts * chore(contracts): remove comments from tsconfig.json * chore(contracts): fix type errors in contracts.test.ts * ci(contracts): add GitHub Action for CI/CD
- Loading branch information
Showing
19 changed files
with
404 additions
and
583 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: CI Workflow (Contracts) | ||
|
||
on: | ||
push: | ||
branches: [ dev, main ] | ||
paths: | ||
- 'contracts/**' | ||
- '.github/workflows/ci-contracts.yaml' | ||
|
||
pull_request: | ||
branches: [ dev, main ] | ||
paths: | ||
- 'contracts/**' | ||
- '.github/workflows/ci-contracts.yaml' | ||
|
||
jobs: | ||
run-ci: | ||
if: "!contains(github.event.head_commit.message, 'chore: release v')" | ||
name: Lint, Typecheck | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- uses: pnpm/action-setup@v2 | ||
name: Install pnpm | ||
with: | ||
version: 8 | ||
run_install: false | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- uses: actions/cache@v4 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm --filter ./contracts install | ||
|
||
- name: Install dependencies (bootstrap) | ||
run: pnpm --filter ./contracts/bootstrap install | ||
|
||
- name: Lint | ||
run: pnpm --filter ./contracts run lint | ||
|
||
- name: Prettier | ||
run: pnpm --filter ./contracts run prettier | ||
|
||
- name: Typecheck (bootstrap) | ||
run: pnpm --filter ./contracts/bootstrap run typecheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"airbnb-base", | ||
"plugin:import/errors", | ||
"plugin:import/warnings", | ||
"plugin:import/typescript", | ||
"plugin:prettier/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"rules": { | ||
"@typescript-eslint/no-explicit-any": "error", | ||
"@typescript-eslint/ban-ts-comment": "warn", | ||
"import/prefer-default-export": "off", | ||
"import/extensions": [ | ||
"error", | ||
"ignorePackages", | ||
{ | ||
"js": "never", | ||
"jsx": "never", | ||
"ts": "never", | ||
"tsx": "never" | ||
} | ||
], | ||
"import/no-extraneous-dependencies": [ | ||
"error", | ||
{ | ||
"devDependencies": ["**/*.test.ts"] | ||
} | ||
], | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
"tabWidth": 4 | ||
} | ||
] | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts"], | ||
"rules": { | ||
"no-continue": "off", | ||
"no-console": "off", | ||
"max-classes-per-file": "off", | ||
"import/no-extraneous-dependencies": "off" | ||
} | ||
}, | ||
{ | ||
"files": ["*.algo.ts"], | ||
"rules": { | ||
"object-shorthand": "off", | ||
"class-methods-use-this": "off", | ||
"no-undef": "off", | ||
"max-classes-per-file": "off", | ||
"no-bitwise": "off", | ||
"operator-assignment": "off", | ||
"prefer-template": "off", | ||
"prefer-destructuring": "off", | ||
"no-param-reassign": "off", | ||
"no-restricted-syntax": "off", | ||
"no-continue": "off", | ||
"no-unused-vars": "off", | ||
"@typescript-eslint/ban-ts-comment": "off" | ||
} | ||
}, | ||
{ | ||
"files": ["*.test.ts"], | ||
"rules": { | ||
"no-await-in-loop": "off" | ||
} | ||
} | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
contracts/artifacts | ||
contracts/clients |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
{ | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
] | ||
} | ||
"recommendations": ["dbaeumer.vscode-eslint"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit" | ||
}, | ||
} | ||
"source.fixAll.eslint": "explicit" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.