Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 52 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,20 @@ npm run build
npm run typecheck
```

### Formatting
### Formatting and Linting

```bash
# Check formatting (dry run)
npm run format

# Fix formatting issues automatically
npm run format:fix

# Check linting issues (dry run)
npm run lint

# Fix linting issues automatically
npm run lint:fix
```

### Test Environment with Local Node
Expand Down Expand Up @@ -166,9 +176,50 @@ OpenScan includes special support for localhost development:
## Code Style

- **Biome** for formatting and linting (config: `biome.json`)
- Line width: 100 characters
- Indentation: 2 spaces
- Scope: `src/**/*.ts`, `src/**/*.tsx`, `src/**/*.json` (excludes CSS files)
- Enabled rules: All recommended Biome linting rules
- Use `npm run format:fix` to auto-format code before committing
- Use `npm run lint:fix` to auto-fix linting issues (max 1024 diagnostics shown)
- **TypeScript** with strict mode (`noImplicitAny`, `noImplicitReturns`, `noUncheckedIndexedAccess`)
- **React 19** with functional components and hooks

## Coding Standards and Workflow

### Before Committing Code

ALWAYS run these commands before committing to ensure code quality:

```bash
# 1. Fix formatting issues
npm run format:fix

# 2. Fix linting issues
npm run lint:fix

# 3. Verify type safety
npm run typecheck

# 4. Run tests (if applicable)
npm run test:run
```

### Code Quality Requirements

- All code must pass Biome formatting and linting checks
- All TypeScript code must pass type checking with zero errors
- Follow the 100-character line width limit
- Use 2-space indentation consistently
- Adhere to Biome's recommended linting rules

### When Claude Code Modifies Files

- Run `npm run format:fix` and `npm run lint:fix` after making changes
- Address any remaining linting warnings that cannot be auto-fixed
- Ensure TypeScript compilation succeeds with `npm run typecheck`
- Do not commit code with formatting, linting, or type errors

## Important Patterns

### When Modifying Data Fetching
Expand Down
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ The app will open at `http://localhost:3000`

### Use with Anvil/Foundry

After following the installation steps here https://getfoundry.sh/introduction/installation/ you can just run an anvil mainnet fork with `anvil --fork-url https://reth-ethereum.ithaca.xyz/rpc` or if you run any Anvil instance on the port 8545 it would be automatically detected by Openscan, if you run Anvil on a different port make sure to change the RPC on the app settings.
After following the installation steps here <https://getfoundry.sh/introduction/installation/> you can just run an anvil mainnet fork with `anvil --fork-url https://reth-ethereum.ithaca.xyz/rpc` or if you run any Anvil instance on the port 8545 it would be automatically detected by Openscan, if you run Anvil on a different port make sure to change the RPC on the app settings.

### Use with Hardhat node

Expand All @@ -102,6 +102,7 @@ bash scripts/run-test-hardhat-env.sh
```

This script will:

1. Start a Hardhat or Anvil node on port 8545.
2. Deploy test contracts and generate sample transactions
3. Start OpenScan with only Ethereum Mainnet and Localhost networks enabled
Expand All @@ -121,12 +122,33 @@ npm run typecheck

### Lint and prettier

```bash
npm run format:fix
```

```bash
npm run lint:fix
```

## Configuration

### Git pre-commit

Comment thread
AugustoL marked this conversation as resolved.
1. Create a new file under `.git/hooks/pre-commit`

```bash
#!/bin/sh
set -eu

npx @biomejs/biome check --staged --files-ignore-unknown=true --no-errors-on-unmatched
```

2. Make it executable

```bash
chmod +x pre-commit
```

### Environment Variables

#### `REACT_APP_OPENSCAN_NETWORKS`
Expand Down
16 changes: 13 additions & 3 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"files": {
"includes": ["**", "!**/*.css"]
}
"files": {
"includes": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.json", "!**/*.css"]
},
"linter": {
"rules": {
"recommended": true
}
},
"formatter": {
"lineWidth": 100,
"indentStyle": "space",
"indentWidth": 2
}
}
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@
"scripts": {
"start": "NODE_ENV=development webpack serve --config webpack.config.js --mode development",
"build": "NODE_ENV=production webpack --config webpack.config.js --mode production",
"test": "npx vitest",
"test": "npx vitest",
"test:run": "npx vitest run",
"dev": "bash scripts/run-test-env.sh",
"typecheck": "tsc --noEmit",
"format:fix": "npx @biomejs/biome format --write"
"format": "npx @biomejs/biome format",
"format:fix": "npx @biomejs/biome format --write",
"lint": "npx @biomejs/biome lint",
"lint:fix": "npx @biomejs/biome lint --write --max-diagnostics 1024"
},
"eslintConfig": {
"extends": [
Expand Down
Loading
Loading