-
Notifications
You must be signed in to change notification settings - Fork 14
feat: implement ban-tslint-comment rule #423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Implement the `ban-tslint-comment` rule from typescript-eslint to detect and flag legacy TSLint directive comments. TSLint has been deprecated and its directive comments are no longer useful. **Implementation:** - Created complete rule implementation in Go at `internal/plugins/typescript/rules/ban_tslint_comment/ban_tslint_comment.go` - Detects TSLint directives using regex pattern matching: - `tslint:disable` - `tslint:enable` - `tslint:disable-line` - `tslint:disable-next-line` - `tslint:enable-line` - Handles both single-line (`//`) and multi-line (`/* */`) comments - Reports violations with `commentDetected` message ID **Testing:** - Created comprehensive test suite in Go with valid and invalid test cases - Added TypeScript test file with additional edge cases - Enabled test in `packages/rslint-test-tools/rstest.config.mts` **Registration:** - Registered rule in plugin registry at `internal/config/config.go` - Added import for the new rule package - Rule is now available as `@typescript-eslint/ban-tslint-comment` This rule helps in the migration from TSLint to ESLint by identifying and removing legacy TSLint configuration comments. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
✅ Deploy Preview for rslint ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
🤖 This pull request has been linked to DevBird Task #2648 View the task details and manage the automated development workflow in DevBird. Learn more about DevBird here or the announcement blog post here. |
📋 DevBird Task PromptObjectiveImplement the Documentation & Resources
Rule DescriptionThis rule flags TSLint directive comments (e.g., ScopeCreate a complete implementation of the
Technical Requirements
Implementation Patternpackage ban_tslint_comment
import (
"github.com/microsoft/typescript-go/shim/ast"
"github.com/web-infra-dev/rslint/internal/rule"
)
var BanTslintCommentRule = rule.Rule{
Name: "ban-tslint-comment",
Run: func(ctx rule.RuleContext, options any) rule.RuleListeners {
// Implementation here
return rule.RuleListeners{
// AST node listeners
}
},
}Test Requirements
Success Criteria
This comment was automatically added by DevBird. You can disable this feature in DevBird Settings. |
|
AI will fix the CI (until it passes) |
kdy1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix CI
…lints - Replace HasPrefix/HasSuffix + manual slicing with TrimPrefix/TrimSuffix - Add TrimSpace to properly handle whitespace in comments - Fixes staticcheck S1017 violations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Summary
This PR implements the
ban-tslint-commentrule from typescript-eslint to detect and flag legacy TSLint directive comments.Background
TSLint has been deprecated (see palantir/tslint#4534) and its directive comments are no longer useful. This rule helps in the migration from TSLint to ESLint by identifying and removing these legacy configuration comments.
Implementation Details
Rule Implementation
internal/plugins/typescript/rules/ban_tslint_comment/ban_tslint_comment.gotslint:disabletslint:enabletslint:disable-linetslint:disable-next-linetslint:enable-line//) and multi-line (/* */) commentscommentDetectedmessage IDTest Coverage
internal/plugins/typescript/rules/ban_tslint_comment/ban_tslint_comment_test.gopackages/rslint-test-tools/tests/typescript-eslint/rules/ban-tslint-comment.test.tspackages/rslint-test-tools/rstest.config.mtsRegistration
internal/config/config.go@typescript-eslint/ban-tslint-commentTesting
The implementation includes comprehensive test cases covering:
tslint:disable,tslint:enable)tslint:disable-line,tslint:disable-next-line)tslint:disable:rule1 rule2)References
Checklist
🤖 Generated with Claude Code