@typescript-eslint/prefer-ts-expect-error#484
Conversation
Summary of ChangesHello @ScriptedAlchemy, 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 integrates the 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 introduces a new linting rule, @typescript-eslint/prefer-ts-expect-error, which encourages using @ts-expect-error over @ts-ignore. The changes include the rule's implementation, documentation, and tests. The implementation is a port from another project and seems mostly correct. I've found a minor bug in how it handles comments and a small opportunity for a code style improvement. Overall, this is a good addition to the linter.
internal/plugins/typescript/rules/prefer_ts_expect_error/prefer_ts_expect_error.go
Outdated
Show resolved
Hide resolved
internal/plugins/typescript/rules/prefer_ts_expect_error/prefer_ts_expect_error.go
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR ports the @typescript-eslint/prefer-ts-expect-error rule from ScriptedAlchemy#13. The rule encourages using @ts-expect-error over @ts-ignore in TypeScript directive comments, as @ts-expect-error provides better type safety by requiring an error to be present on the next line.
Changes:
- Adds a new TypeScript ESLint rule that detects
@ts-ignoredirectives and suggests replacing them with@ts-expect-error - Includes comprehensive tests covering single-line comments, multi-line comments, and various edge cases
- Adds rule documentation following the codebase conventions
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/plugins/typescript/rules/prefer_ts_expect_error/prefer_ts_expect_error.go | Core rule implementation with logic to find and replace @ts-ignore directives |
| internal/plugins/typescript/rules/prefer_ts_expect_error/prefer_ts_expect_error_test.go | Comprehensive Go tests with 7 valid and 8 invalid test cases |
| internal/plugins/typescript/rules/prefer_ts_expect_error/prefer_ts_expect_error.md | Rule documentation with examples and original documentation link |
| internal/config/config.go | Registers the new rule in the global rule registry |
| rslint.json | Adds the rule configuration (set to "off" by default) |
| packages/rslint-test-tools/rstest.config.mts | Enables the TypeScript test file |
| packages/rslint-test-tools/tests/typescript-eslint/rules/prefer-ts-expect-error.test.ts | TypeScript-based test file for validation |
| packages/rslint-test-tools/tests/typescript-eslint/rules/snapshots/prefer-ts-expect-error.test.ts.snap | Test snapshots for all invalid test cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 93dc011497
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary: Port @typescript-eslint/prefer-ts-expect-error from ScriptedAlchemy#13.
Related Links:
Checklist: