Skip to content

Commit ea81b54

Browse files
committed
fix(sdk): resolve unused variable warnings in generated contract files
Improve TypeScript and ESLint configuration to properly handle unused variables: - Set `noUnusedLocals` and `noUnusedParameters` to false in tsconfig.json - Add explicit `exclude` for contract client files in tsconfig.json - Upgrade unused variables ESLint rule from warning to error - Add `coverage` directory to ESLint ignores - Add `typecheck` script to package.json - Add Type Check step to CI workflow This approach maintains strict code quality checks while preventing false positives from generated files.
1 parent e55a3d4 commit ea81b54

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ jobs:
4646
- name: Lint
4747
run: pnpm -F @txnlab/nfd-sdk lint
4848

49+
- name: Type Check
50+
run: pnpm -F @txnlab/nfd-sdk typecheck
51+
4952
- name: Test
5053
run: pnpm -F @txnlab/nfd-sdk test
5154

eslint.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ export default tseslint.config(
4343
'@typescript-eslint/no-explicit-any': 'warn',
4444
'@typescript-eslint/explicit-function-return-type': 'off',
4545
'@typescript-eslint/no-unused-vars': [
46-
'warn',
46+
'error',
4747
{ argsIgnorePattern: '^_' },
4848
],
4949
},
5050
},
5151
{
52-
ignores: ['**/node_modules/*', '**/dist/*'],
52+
ignores: ['**/node_modules/*', '**/dist/*', '**/coverage/*'],
5353
},
5454
)

packages/sdk/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"test:coverage": "vitest run --coverage",
1919
"lint": "eslint \"**/*.{js,jsx,ts,tsx}\"",
2020
"format": "prettier --write .",
21+
"typecheck": "tsc --noEmit",
2122
"publish:package": "node scripts/publish.js",
2223
"fetch:openapi": "tsx scripts/fetch-openapi.ts",
2324
"fetch:arc56": "tsx scripts/fetch-arc56.ts",

packages/sdk/tsconfig.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@
1111
"isolatedModules": true,
1212
"noEmit": true,
1313
"strict": true,
14-
"noUnusedLocals": true,
15-
"noUnusedParameters": true,
14+
"noUnusedLocals": false,
15+
"noUnusedParameters": false,
1616
"noFallthroughCasesInSwitch": true,
1717
"paths": {
1818
"@/*": ["./src/*"]
1919
}
2020
},
21-
"include": ["src", "tests"]
21+
"include": ["src", "tests"],
22+
"exclude": [
23+
"src/contracts/NFDInstanceClient.ts",
24+
"src/contracts/NFDRegistryClient.ts"
25+
]
2226
}

0 commit comments

Comments
 (0)