fix: align no-unused-vars with typescript-eslint#571
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive overhaul of the no-unused-vars linting rule for TypeScript. The update significantly enhances the rule's accuracy and configurability by adding new options such as destructuredArrayIgnorePattern, ignoreClassWithStaticInitBlock, ignoreUsingDeclarations, and enableAutofixRemoval for unused imports. Key changes include a refactored usage detection logic that differentiates between 'defined but never used' and 'assigned a value but never used', improved handling of self-modifying references, declaration merging, ambient modules, and JSX factory imports. The update also provides autofix suggestions for removing unused imports and expands test coverage across various scenarios, including assignments, imports, patterns, and TypeScript-specific constructs. The default configuration for the rule has been updated to ignore variables and arguments starting with an underscore.
a1fb56c to
8cce2f5
Compare
- Implement full no-unused-vars rule with self-modifying reference detection, declaration merging, ambient module handling, and JSX factory usage tracking - Support JSX factory/fragment factory imports for preserve/react-native modes with custom jsxFactory and jsxFragmentFactory compiler options - Add import removal autofix with suggestions for unused imports - Update recommended config to ignore variables and arguments prefixed with underscore (varsIgnorePattern: ^_, argsIgnorePattern: ^_), aligning with community convention - Split large test file into focused test suites (basic, advanced, catch-loops, patterns, report-used, declare, typescript-specific) - Add tsconfig fixtures for JSX modes (preserve, react-jsx, custom factory, fragment factory) and lenient type checking - Update rule documentation with full options reference and TypeScript-specific behavior description
8cce2f5 to
50919e2
Compare
Summary
@typescript-eslint/no-unused-varsrule with the original typescript-eslint implementationisUpdateTarget()helper to correctly track++/--as write references, fixing report positions and message text_-prefixed variables and arguments (varsIgnorePattern: ^_,argsIgnorePattern: ^_), aligning with community conventionRelated Links
N/A
Checklist