Skip to content

Conversation

@mathieudutour
Copy link
Member

No description provided.

Copy link

Copilot AI left a 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-shortcut rule that suggests using Keyboard.Shortcut.Common.* constants instead of literal shortcut objects
  • Adds no-reserved-shortcut rule to warn when shortcuts conflict with Raycast's reserved system shortcuts
  • Adds no-ambiguous-platform-shortcut rule 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
Copy link

Copilot AI Nov 14, 2025

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.

Suggested change
(context as TSESLint.RuleContext<any, any>).filename
context.filename

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants