feat: port 4 @typescript-eslint non-null assertion rules#459
Conversation
Summary of ChangesHello @fansenze, 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 expands rslint's TypeScript linting capabilities by integrating four crucial rules from TypeScript-ESLint. These additions aim to improve the reliability and clarity of TypeScript codebases by identifying and discouraging potentially unsafe or redundant uses of non-null assertions. The new rules help developers write more idiomatic and type-safe TypeScript, reducing the likelihood of runtime errors related to null or undefined values. Highlights
Changelog
Activity
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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request successfully ports four non-null assertion related rules from TypeScript-ESLint to rslint. The implementation for each rule (no-extra-non-null-assertion, no-non-null-asserted-nullish-coalescing, no-non-null-asserted-optional-chain, no-non-null-assertion) is well-structured, including rule logic, documentation, and comprehensive test cases. The code is clear and seems to correctly implement the behavior of the original ESLint rules, including handling complex cases like control flow for unassigned variables and providing helpful suggestions for fixes. I've made one suggestion to refactor a small part of the code for better readability and maintainability. Overall, this is a great contribution.
internal/plugins/typescript/rules/no_extra_non_null_assertion/no_extra_non_null_assertion.go
Outdated
Show resolved
Hide resolved
32aef7a to
b79a695
Compare
b79a695 to
a3b9a97
Compare
5b014d4 to
20635c3
Compare
Summary
Port 4 TypeScript-ESLint non-null assertion rules to rslint.
Rules ported
@typescript-eslint/no-extra-non-null-assertion@typescript-eslint/no-non-null-asserted-nullish-coalescing??(with suggestions)@typescript-eslint/no-non-null-asserted-optional-chain@typescript-eslint/no-non-null-assertion!(with optional chain suggestions)References
Checklist