Skip to content

Add ESLint configuration for TypeScript#235

Open
MiWeiss wants to merge 1 commit into
mainfrom
chore/add-eslint
Open

Add ESLint configuration for TypeScript#235
MiWeiss wants to merge 1 commit into
mainfrom
chore/add-eslint

Conversation

@MiWeiss

@MiWeiss MiWeiss commented Jan 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Added ESLint with TypeScript support for static code analysis
  • Configured sensible rules for browser extension development
  • Added lint scripts to package.json

Changes Made

New Dependencies

"eslint": "^8.57.0",
"@typescript-eslint/parser": "^5.62.0",
"@typescript-eslint/eslint-plugin": "^5.62.0"

New Scripts

"lint": "eslint \"src/**/*.{ts,tsx}\"",
"lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix"

Configuration File (.eslintrc.json)

Extends:

  • eslint:recommended - Core ESLint rules
  • plugin:@typescript-eslint/recommended - TypeScript-specific rules

Custom Rules:

  • @typescript-eslint/no-explicit-any: "warn" - Warn on any types (don't block)
  • @typescript-eslint/no-unused-vars: "warn" - Warn on unused vars, allow _ prefix
  • no-console: "off" - Allow console statements (common in extensions)

Environment:

  • Browser, ES2020, Node.js, WebExtensions APIs

Ignored Patterns:

  • dist/, node_modules/, webpack/, .temp/

Why This Matters

Benefits:

  1. Catch bugs early - Static analysis finds issues before runtime
  2. Consistent style - Enforces team coding standards
  3. Better maintainability - Easier to read and understand code
  4. IDE integration - Real-time feedback while coding
  5. CI/CD ready - Can add linting to workflows

Common Issues Detected:

  • Unused variables and imports
  • Missing return types
  • Unreachable code
  • Type mismatches
  • Potential null/undefined issues

Usage

Check for linting issues:

npm run lint

Auto-fix issues where possible:

npm run lint:fix

Next Steps

Consider adding:

  • Lint step to CI/CD workflows
  • Pre-commit hook for automatic linting
  • Additional rules based on team preferences

Test Plan

  • Run npm install to install new dependencies
  • Run npm run lint and verify it checks TypeScript files
  • Fix any immediate linting issues found
  • Verify npm run lint:fix auto-fixes applicable issues

🤖 Generated with Claude Code

Added ESLint with TypeScript support to improve code quality:

New dependencies:
- eslint@^8.57.0
- @typescript-eslint/parser@^5.62.0
- @typescript-eslint/eslint-plugin@^5.62.0

New npm scripts:
- npm run lint: Check code for linting issues
- npm run lint:fix: Automatically fix linting issues

Configuration (.eslintrc.json):
- Extends recommended ESLint and TypeScript ESLint rules
- Allows console statements (common in browser extensions)
- Warns on unused variables (with _ prefix exception)
- Configured for browser and WebExtensions environment
- Ignores build output and dependencies

This provides static analysis to catch common bugs, enforce
consistent code style, and improve code maintainability.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant