Skip to content

Commit f01c38b

Browse files
authored
Merge pull request #159 from ethdebug/statics
Add linting and formatting tooling
2 parents 8c00726 + 18ccd99 commit f01c38b

230 files changed

Lines changed: 3969 additions & 3366 deletions

File tree

Some content is hidden

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

.eslintignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
node_modules/
2+
dist/
3+
coverage/
4+
*.d.ts
5+
*.config.js
6+
*.config.ts
7+
8+
# Auto-generated files
9+
packages/format/src/schemas/yamls.ts
10+
11+
# Docusaurus
12+
packages/web/.docusaurus/
13+
packages/web/build/

.eslintrc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"plugins": ["@typescript-eslint"],
4+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
5+
"rules": {
6+
"@typescript-eslint/no-explicit-any": "warn",
7+
"@typescript-eslint/no-unused-vars": [
8+
"error",
9+
{ "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }
10+
],
11+
"@typescript-eslint/no-namespace": "off",
12+
"@typescript-eslint/no-empty-object-type": "off",
13+
"no-console": "warn",
14+
"require-yield": "off"
15+
},
16+
"env": {
17+
"node": true,
18+
"es2022": true
19+
}
20+
}

.git-blame-ignore-revs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Prettier formatting
2+
# Apply Prettier formatting
3+
d42ac838468820243ce5bfaed89bfd686f296bee
4+
5+
# ESLint fixes
6+
# Apply ESLint fixes and adjust configuration
7+
1080960d9e200e302315e8a6006312cd44fdeaa4
8+
9+
# Additional Prettier formatting
10+
# Apply remaining Prettier formatting fixes
11+
b3b53a99b599e56c0277999d9e1c0e246f669e00

.github/workflows/ci.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
11
name: Continuous integration checks
22
on:
3-
- pull_request
3+
- pull_request
44

55
jobs:
6+
lint-and-format:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
11+
- uses: actions/setup-node@v3
12+
with:
13+
node-version: 20
14+
cache: yarn
15+
cache-dependency-path: yarn.lock
16+
17+
- name: Install dependencies
18+
run: yarn install --frozen-lockfile
19+
20+
- name: Check formatting
21+
run: yarn format:check
22+
23+
- name: Lint
24+
run: yarn lint
25+
626
run-tests:
727
runs-on: ubuntu-latest
828
steps:

.github/workflows/gh-pages.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ jobs:
2929
folder: ./packages/web/build
3030
branch: gh-pages
3131
# default deployer
32-
git-config-name: 'github-actions[bot]'
33-
git-config-email: 'github-actions[bot]@users.noreply.github.com'
32+
git-config-name: "github-actions[bot]"
33+
git-config-email: "github-actions[bot]@users.noreply.github.com"
3434
# don't break preview deployments
3535
clean-exclude: pr-preview
3636
force: false
37-
38-

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.prettierignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
node_modules/
2+
dist/
3+
coverage/
4+
*.log
5+
.DS_Store
6+
yarn.lock
7+
package-lock.json
8+
9+
# Auto-generated files
10+
packages/format/src/schemas/yamls.ts
11+
12+
# Docusaurus build output
13+
packages/web/.docusaurus/
14+
packages/web/build/
15+
16+
# Contains embedded source code with specific formatting for findSourceRange
17+
packages/web/spec/program/example.mdx

.prettierrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"printWidth": 80,
3+
"singleQuote": false
4+
}

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ This repository contains a
4646
with the formal JSON Schemas defined by this project (in YAML format).
4747

4848
This repository also contains the source materials for the following NPM packages:
49+
4950
- **@ethdebug/format** in
5051
[`packages/format/`](https://github.com/ethdebug/format/tree/main/packages/format)
5152
distributes the formal schemas for use in TypeScript
@@ -75,6 +76,7 @@ To build and run the site locally, please ensure you have Node.js
7576
(LTS or better) and `yarn` installed globally.
7677

7778
First, clone this repo and install the Node.js dependencies:
79+
7880
```console
7981
git clone https://github.com/ethdebug/format.git
8082
cd format
@@ -96,10 +98,12 @@ This project uses a dual-license approach:
9698

9799
- All other code and documentation in this repository is licensed under the [MIT License](LICENSE).
98100

99-
[^1]: See [Debugging data format -
100-
Wikipedia](https://en.wikipedia.org/wiki/Debugging_data_format)
101+
[^1]:
102+
See [Debugging data format -
103+
Wikipedia](https://en.wikipedia.org/wiki/Debugging_data_format)
101104

102105
[^2]: See [DWARF - Wikipedia](https://en.wikipedia.org/wiki/DWARF)
103106

104-
[^3]: See [Using type predicates](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates)
105-
section from TypeScript's Narrowing documentation.
107+
[^3]:
108+
See [Using type predicates](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates)
109+
section from TypeScript's Narrowing documentation.

bin/bundle-schema.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { addSchema } from "@hyperjump/json-schema/draft-2020-12";
22
import { bundle as bundleSchema } from "@hyperjump/json-schema/bundle";
33
import { schemas, describeSchema } from "@ethdebug/format";
4-
import type { JSONSchema } from "json-schema-typed/draft-2020-12"
54

65
async function main() {
76
const schema = { id: process.argv[2] }; // a bit brittle
87

98
if (!schema.id) {
109
console.error(
11-
"Please provide a schema ID, e.g. `schema:ethdebug/format/pointer`"
10+
"Please provide a schema ID, e.g. `schema:ethdebug/format/pointer`",
1211
);
1312
process.exit(1);
1413
}

0 commit comments

Comments
 (0)