Skip to content

Commit f3da0fb

Browse files
authored
refactor (#18)
1 parent 01bf16e commit f3da0fb

File tree

101 files changed

+22301
-1035
lines changed

Some content is hidden

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

101 files changed

+22301
-1035
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,14 @@ jobs:
4242
- name: Install dependencies
4343
run: pnpm install --frozen-lockfile
4444

45-
- name: Run ESLint
46-
run: pnpm lint:check
45+
- name: Lint
46+
run: |
47+
# Enforce zero warnings policy
48+
pnpm lint:check 2>&1 | tee lint-output.txt
49+
if grep -qE "✖.*problem" lint-output.txt; then
50+
echo "Error: Linting issues detected. Run 'pnpm lint:fix' to resolve."
51+
exit 1
52+
fi
4753
4854
- name: Run Prettier
4955
run: pnpm format:check
@@ -105,8 +111,9 @@ jobs:
105111
- name: Run tests
106112
run: pnpm test
107113

108-
- name: Run tests with coverage
114+
- name: Test with coverage
109115
run: pnpm test:coverage
116+
# Coverage thresholds enforced by jest.config.ts
110117

111118
- name: Upload coverage artifacts
112119
if: matrix.node-version == '22.x'

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ pnpm-debug.log*
3232
.DS_Store
3333
Thumbs.db
3434

35-
output/
35+
/output/
3636
coverage

README.md

Lines changed: 1035 additions & 234 deletions
Large diffs are not rendered by default.

eslint.config.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ module.exports = [
7878
},
7979
},
8080

81-
// Configuration for test files
81+
// Configuration for test files - Following FAANG best practices
82+
// Tests have different type safety requirements than production code
8283
{
8384
files: ['**/*.test.ts', '**/*.spec.ts', '**/test/**/*.ts'],
8485

@@ -109,6 +110,7 @@ module.exports = [
109110
beforeAll: 'readonly',
110111
afterAll: 'readonly',
111112
jest: 'readonly',
113+
fail: 'readonly',
112114
},
113115
},
114116

@@ -126,22 +128,26 @@ module.exports = [
126128
...prettier.rules,
127129
'prettier/prettier': 'error',
128130

129-
// Custom TypeScript-specific rules
130-
'@typescript-eslint/explicit-function-return-type': 'error',
131+
// Rules turned OFF for test files (incompatible with testing patterns)
132+
'@typescript-eslint/unbound-method': 'off', // Jest mocks are unbound by design
133+
'@typescript-eslint/only-throw-error': 'off', // Tests verify non-Error throw handling
134+
'@typescript-eslint/require-await': 'off', // Async test helpers often don't await
135+
'@typescript-eslint/explicit-function-return-type': 'off', // Test arrow functions are self-documenting
136+
137+
// Rules downgraded to WARN for test files (useful but not blocking)
138+
'@typescript-eslint/no-explicit-any': 'warn', // Relax from error to warn
139+
'@typescript-eslint/no-unsafe-assignment': 'warn', // Keep as warn
140+
'@typescript-eslint/no-unsafe-member-access': 'warn', // Keep as warn
141+
'@typescript-eslint/no-unsafe-call': 'warn', // Keep as warn
142+
'@typescript-eslint/no-unsafe-return': 'warn', // Downgrade from error to warn
143+
'@typescript-eslint/no-unsafe-argument': 'warn', // Add for consistency
144+
145+
// Standard test file overrides
131146
'@typescript-eslint/no-unused-vars': [
132147
'error',
133148
{ argsIgnorePattern: '^_' },
134149
],
135-
'@typescript-eslint/no-explicit-any': 'error',
136-
'@typescript-eslint/no-unsafe-assignment': 'warn',
137-
'@typescript-eslint/no-unsafe-member-access': 'warn',
138-
'@typescript-eslint/no-unsafe-call': 'warn',
139-
'@typescript-eslint/no-unsafe-return': 'error',
140-
141-
// Allow empty interfaces in tests
142150
'@typescript-eslint/no-empty-object-type': 'off',
143-
144-
// Disable no-undef in test files since Jest globals are defined
145151
'no-undef': 'off',
146152
},
147153
},

examples/allow-list-updates.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"removes": [],
3+
"adds": [
4+
"0x779877A7B0D9E8603169DdbD7836e478b4624789",
5+
"0xa469F39796Cad956bE2E51117693880dB3E6438d"
6+
]
7+
}

examples/chain-update.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
"isEnabled": false,
3434
"capacity": "0",
3535
"rate": "0"
36-
}
36+
},
37+
"remoteChainType": "evm"
3738
}
3839
]
3940
]

examples/grant-roles.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"pool": "0x1234567890123456789012345678901234567890",
3+
"roleType": "both"
4+
}

examples/mint.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"receiver": "0x1234567890123456789012345678901234567890",
3+
"amount": "1000000000000000000000"
4+
}

examples/rate-limiter-config.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"remoteChainSelector": "3478487238524512106",
3+
"outboundConfig": {
4+
"isEnabled": true,
5+
"capacity": "1000000000000000000000",
6+
"rate": "100000000000000000000"
7+
},
8+
"inboundConfig": {
9+
"isEnabled": true,
10+
"capacity": "1000000000000000000000",
11+
"rate": "100000000000000000000"
12+
}
13+
}

examples/revoke-roles.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"pool": "0x1234567890123456789012345678901234567890",
3+
"roleType": "both",
4+
"action": "revoke"
5+
}

0 commit comments

Comments
 (0)