Skip to content

[ESLint] Implement @metamask/eslint-config-browser for browser environment packages #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
georgewrmarshall opened this issue May 12, 2025 · 0 comments

Comments

@georgewrmarshall
Copy link
Contributor

Description

Add browser environment ESLint configuration support to our codebase by implementing @metamask/eslint-config-browser for packages that require browser environment globals and rules. This will provide appropriate linting rules for browser APIs and patterns, and help eliminate the need for numerous eslint-disable comments throughout the codebase.

Technical Details

  • Install @metamask/eslint-config-browser as a dev dependency
  • Update the eslint.config.mjs to extend the browser configuration for appropriate packages/files
  • Create a specific configuration block for browser-specific files/packages in our ESLint config
  • This should target primarily the web-related packages rather than Node.js packages
  • Consider using file patterns like 'apps/storybook-react/**/*.{ts,tsx,js,jsx}' to apply browser rules

Implementation example:

// In eslint.config.mjs
import browser from '@metamask/eslint-config-browser';

// Then in the config array
{
  files: ['apps/storybook-react/**/*.{ts,tsx,js,jsx}', 'packages/design-system-react/**/*.{ts,tsx,js,jsx}'],
  extends: [browser],
}

Acceptance Criteria

  • @metamask/eslint-config-browser package installed and properly configured in our project
  • Browser environment rules applied to all appropriate web/browser-focused packages and files
  • No new lint errors introduced by the change
  • Reduction in the number of eslint-disable comments required for browser-related code
  • ESLint should properly recognize browser globals (like window, document, etc.) without warning
  • CI pipeline passes with the new configuration

References

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

No branches or pull requests

1 participant