Skip to content

Conversation

@ffmcgee725
Copy link
Member

@ffmcgee725 ffmcgee725 commented Jan 28, 2026

Explanation

Initially this job was deactivated, as a lot of files where not passing lint checks due to previously using biome in metamask-sdk, and now we switching to prettier to keep with organization conventions, as well as a lot of stuff being outside the configured conventions of monorepo (one example is using interface instead of type).

This PR here will re-introduce the job that runs yarn lint.

https://consensyssoftware.atlassian.net/browse/WAPI-796

Approach

The strategy prioritizes stability over refactoring:

  • Use eslint-disable comments for intentional patterns and external constraints
  • Make minimal safe code changes (formatting, explicit return types)
  • Avoid behavior-changing modifications

Error Categories & Solutions

1. Naming Convention Violations (@typescript-eslint/naming-convention)

Pattern Example Solution
Snake_case RPC methods eth_sendTransaction, wallet_getCapabilities File-level disable - RPC spec uses snake_case
Snake_case API schemas mmconnect_version, dapp_id File-level disable - Auto-generated analytics schema
Short type parameters T, K File-level disable - Standard TypeScript conventions
External library names AsyncStorage, Bowser Line-level disable - External API naming
Test mock prefixes __mockFetch, __storage File-level disable - Common testing pattern

2. Restricted Globals (no-restricted-globals)

Global Context Solution
window, document Browser-specific code, polyfills File-level disable - Intentional browser APIs
Buffer Polyfill shims File-level disable - Required for cross-platform
process Node.js playground, build configs File-level disable - Node.js environment
alert Browser playground feedback File-level disable - Demo code

3. Import/Export Rules

Rule Context Solution
import-x/no-unassigned-import Polyfills, mock setup File-level disable - Side-effect imports are intentional
import-x/order Test files with mock dependencies File-level disable - Import order affects mock behavior
import-x/no-nodejs-modules Buffer polyfill File-level disable - Required for RN/browser

4. Function/Method Rules

Rule Context Solution
@typescript-eslint/explicit-function-return-type Config files, test helpers, demo code File-level disable or added explicit void returns
no-empty-function Modal stubs, mock implementations Added // No-op comments with void return types
@typescript-eslint/no-misused-promises Event handlers File-level disable - Async handlers are intentional

5. Class Property Syntax (no-restricted-syntax)

Pattern Solution
Private class fields without # File-level disable or migrated to #property syntax where safe
Parameter properties File-level disable - Constructor shorthand is intentional

6. Test-Specific Rules

Rule Context Solution
@typescript-eslint/no-shadow Vitest globals (describe, it, expect) File-level disable
id-length Vitest alias t File-level disable - Standard pattern
@typescript-eslint/unbound-method Mock assertions File-level disable
promise/param-names Test promise patterns File-level disable

7. JSDoc Rules

Rule Solution
jsdoc/require-param-description File-level disable for complex nested params and test helpers
jsdoc/require-returns File-level disable for auto-generated or obvious returns

8. Other Patterns

Rule Context Solution
id-denylist (err) Catch clauses File-level disable or renamed to error
@typescript-eslint/prefer-nullish-coalescing Empty object fallbacks in configs Changed || to ?? or file-level disable
no-async-promise-executor Complex async flows File-level disable - Async executor needed
require-unicode-regexp Webpack/test configs File-level disable

TypeScript Configuration Changes

  • packages/connect-multichain/tsconfig.json: Removed test file exclusions to enable type-aware linting
  • packages/connect-evm/tsconfig.json: Removed test file exclusions
  • playground/playground-ui/tsconfig.json: Removed test file exclusions
  • playground/node-playground/tsconfig.json: Enabled strict: true for nullish coalescing rules
  • integrations/wagmi/tsconfig.node.json: Added strictNullChecks: true

Auto-Generated Files

Files marked with /* eslint-disable -- AUTO-GENERATED FILE */:

  • playground/*/src/wagmi/metamask-connector.ts (copied from integrations/wagmi/)
  • packages/analytics/src/schema.ts (API schema types)

Code Changes (Non-Disable)

Minimal code changes were made where safe:

  • Added explicit void return types to empty methods
  • Changed || to ?? for nullish coalescing where behavior is identical
  • Fixed type vs interface for Wagmi module augmentation
  • Fixed import ordering in test files where order affects mock behavior

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants