feat: port @typescript-eslint/prefer-readonly rule#456
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 enhances 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
|
39de93f to
f462ce2
Compare
There was a problem hiding this comment.
Code Review
This pull request ports the @typescript-eslint/prefer-readonly rule. The implementation is comprehensive, covering many edge cases and including an autofix. The accompanying tests are also thorough. I've found a few areas for improvement: one potential for flaky tests due to non-deterministic ordering, a minor typo, and some code duplication in the linter core that could be refactored for better maintainability. Overall, this is a great contribution.
internal/plugins/typescript/rules/prefer_readonly/prefer_readonly.go
Outdated
Show resolved
Hide resolved
3e6b4c1 to
1b1f821
Compare
1b1f821 to
200e5ce
Compare
Summary
Port the
@typescript-eslint/prefer-readonlyrule from typescript-eslint to rslint.This rule enforces that private class members never reassigned outside the constructor should be marked as
readonly.#members that are only read (not written) outside constructoronlyInlineLambdasoption to only check arrow function membersreadonlymodifierthiskeyword) resolutionReportRangeWithFixestoRuleContextfor range-based fix reportingRelated Links
Checklist