Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 10 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,14 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run ESLint
run: pnpm lint:check
- name: Lint
run: |
# Enforce zero warnings policy
pnpm lint:check 2>&1 | tee lint-output.txt
if grep -qE "✖.*problem" lint-output.txt; then
echo "Error: Linting issues detected. Run 'pnpm lint:fix' to resolve."
exit 1
fi

- name: Run Prettier
run: pnpm format:check
Expand Down Expand Up @@ -105,8 +111,9 @@ jobs:
- name: Run tests
run: pnpm test

- name: Run tests with coverage
- name: Test with coverage
run: pnpm test:coverage
# Coverage thresholds enforced by jest.config.ts

- name: Upload coverage artifacts
if: matrix.node-version == '22.x'
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ pnpm-debug.log*
.DS_Store
Thumbs.db

output/
/output/
coverage
1,269 changes: 1,035 additions & 234 deletions README.md

Large diffs are not rendered by default.

30 changes: 18 additions & 12 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ module.exports = [
},
},

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

Expand Down Expand Up @@ -109,6 +110,7 @@ module.exports = [
beforeAll: 'readonly',
afterAll: 'readonly',
jest: 'readonly',
fail: 'readonly',
},
},

Expand All @@ -126,22 +128,26 @@ module.exports = [
...prettier.rules,
'prettier/prettier': 'error',

// Custom TypeScript-specific rules
'@typescript-eslint/explicit-function-return-type': 'error',
// Rules turned OFF for test files (incompatible with testing patterns)
'@typescript-eslint/unbound-method': 'off', // Jest mocks are unbound by design
'@typescript-eslint/only-throw-error': 'off', // Tests verify non-Error throw handling
'@typescript-eslint/require-await': 'off', // Async test helpers often don't await
'@typescript-eslint/explicit-function-return-type': 'off', // Test arrow functions are self-documenting

// Rules downgraded to WARN for test files (useful but not blocking)
'@typescript-eslint/no-explicit-any': 'warn', // Relax from error to warn
'@typescript-eslint/no-unsafe-assignment': 'warn', // Keep as warn
'@typescript-eslint/no-unsafe-member-access': 'warn', // Keep as warn
'@typescript-eslint/no-unsafe-call': 'warn', // Keep as warn
'@typescript-eslint/no-unsafe-return': 'warn', // Downgrade from error to warn
'@typescript-eslint/no-unsafe-argument': 'warn', // Add for consistency

// Standard test file overrides
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' },
],
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-return': 'error',

// Allow empty interfaces in tests
'@typescript-eslint/no-empty-object-type': 'off',

// Disable no-undef in test files since Jest globals are defined
'no-undef': 'off',
},
},
Expand Down
7 changes: 7 additions & 0 deletions examples/allow-list-updates.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"removes": [],
"adds": [
"0x779877A7B0D9E8603169DdbD7836e478b4624789",
"0xa469F39796Cad956bE2E51117693880dB3E6438d"
]
}
3 changes: 2 additions & 1 deletion examples/chain-update.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"isEnabled": false,
"capacity": "0",
"rate": "0"
}
},
"remoteChainType": "evm"
}
]
]
4 changes: 4 additions & 0 deletions examples/grant-roles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"pool": "0x1234567890123456789012345678901234567890",
"roleType": "both"
}
4 changes: 4 additions & 0 deletions examples/mint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"receiver": "0x1234567890123456789012345678901234567890",
"amount": "1000000000000000000000"
}
13 changes: 13 additions & 0 deletions examples/rate-limiter-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"remoteChainSelector": "3478487238524512106",
"outboundConfig": {
"isEnabled": true,
"capacity": "1000000000000000000000",
"rate": "100000000000000000000"
},
"inboundConfig": {
"isEnabled": true,
"capacity": "1000000000000000000000",
"rate": "100000000000000000000"
}
}
5 changes: 5 additions & 0 deletions examples/revoke-roles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"pool": "0x1234567890123456789012345678901234567890",
"roleType": "both",
"action": "revoke"
}
28 changes: 28 additions & 0 deletions examples/token-deployment-with-remote.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "Cross-Chain Test Token",
"symbol": "XCTEST",
"decimals": 18,
"maxSupply": "1000000000000000000000000",
"preMint": "100000000000000000000000",
"remoteTokenPools": [
{
"remoteChainSelector": "16015286601757825753",
"remotePoolAddress": "0x0000000000000000000000000000000000000000",
"remotePoolInitCode": "0x",
"remoteTokenAddress": "0x0000000000000000000000000000000000000000",
"remoteTokenInitCode": "0x",
"poolType": "BurnMintTokenPool",
"remoteChainConfig": {
"remotePoolFactory": "0x0000000000000000000000000000000000000000",
"remoteRouter": "0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59",
"remoteRMNProxy": "0xba3f6251de62dED61Ff98590cB2fDf6871FbB991",
"remoteTokenDecimals": 18
},
"rateLimiterConfig": {
"isEnabled": true,
"capacity": "100000000000000000000000",
"rate": "1000000000000000000000"
}
}
]
}
12 changes: 10 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ export default {
transform: {
'^.+\\.ts$': 'ts-jest',
},
collectCoverageFrom: ['src/**/*.ts', '!src/**/*.d.ts', '!src/test/**'],
collectCoverageFrom: ['src/**/*.ts', '!src/**/*.d.ts', '!src/test/**', '!src/typechain/**'],
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
coverageReporters: ['text', 'lcov', 'html', 'json-summary'],
coverageThreshold: {
global: {
lines: 85,
branches: 75,
functions: 85,
statements: 85,
},
},
};
Loading