-
Notifications
You must be signed in to change notification settings - Fork 3
Add a few rules to help with shortcuts #13
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
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.
Pull Request Overview
This PR adds three new ESLint rules to help developers write better keyboard shortcuts in Raycast extensions. The rules enforce best practices around using common shortcuts, avoiding reserved shortcuts, and handling platform-specific shortcuts correctly.
Key Changes:
- Adds
prefer-common-shortcutrule that suggests usingKeyboard.Shortcut.Common.*constants instead of literal shortcut objects - Adds
no-reserved-shortcutrule to warn when shortcuts conflict with Raycast's reserved system shortcuts - Adds
no-ambiguous-platform-shortcutrule to detect ambiguous shortcuts in multi-platform extensions
Reviewed Changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/rules/prefer-common-shortcut.ts | Implements rule to suggest Common shortcuts with auto-fix support |
| lib/rules/no-reserved-shortcut.ts | Implements rule to detect reserved shortcut conflicts |
| lib/rules/no-ambiguous-platform-shortcut.ts | Implements rule to detect platform-ambiguous shortcuts in multi-platform extensions |
| tests/prefer-common-shortcut.test.ts | Test suite for prefer-common-shortcut rule with valid/invalid cases and auto-fix verification |
| tests/no-reserved-shortcut.test.ts | Test suite for no-reserved-shortcut rule |
| tests/no-ambiguous-platform-shortcut.test.ts | Test suite for no-ambiguous-platform-shortcut rule with multi-platform fixture testing |
| tests/fixtures/single-platform/package.json | Test fixture simulating single-platform extension |
| tests/fixtures/multi-platform/package.json | Test fixture simulating multi-platform extension |
| lib/index.ts | Registers new rules and adds them to recommended config |
| docs/rules/prefer-common-shortcut.md | Documentation for prefer-common-shortcut rule |
| docs/rules/no-reserved-shortcut.md | Documentation for no-reserved-shortcut rule |
| docs/rules/no-ambiguous-platform-shortcut.md | Documentation for no-ambiguous-platform-shortcut rule |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| defaultOptions: [], | ||
| create(context) { | ||
| const hasMultiPlatform = hasMultiPlatformConfig( | ||
| (context as TSESLint.RuleContext<any, any>).filename |
Copilot
AI
Nov 14, 2025
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.
Type assertion as TSESLint.RuleContext<any, any> bypasses type safety. The context parameter should already have the correct type from the rule definition. Using any here could mask type errors and should be avoided.
| (context as TSESLint.RuleContext<any, any>).filename | |
| context.filename |
No description provided.