Skip to content

feat: useHotkeySequences hooks#80

Open
KevinVandy wants to merge 2 commits intomainfrom
hotkeysequences
Open

feat: useHotkeySequences hooks#80
KevinVandy wants to merge 2 commits intomainfrom
hotkeysequences

Conversation

@KevinVandy
Copy link
Member

@KevinVandy KevinVandy commented Mar 24, 2026

🎯 Changes

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • New Features

    • Added new APIs to register multiple hotkey sequences in a single operation across all frameworks: useHotkeySequences (React/Preact/Vue), createHotkeySequences (Solid/Svelte), and injectHotkeySequences (Angular)
    • Support for dynamic and variable-length sequence lists
    • New comprehensive example projects for each framework demonstrating multi-sequence registration
  • Documentation

    • Expanded guides and API references for all frameworks
    • New example implementations showing best practices for registering multiple sequences

@github-actions
Copy link
Contributor

github-actions bot commented Mar 24, 2026

🚀 Changeset Version Preview

6 package(s) bumped directly, 0 bumped as dependents.

🟨 Minor bumps

Package Version Reason
@tanstack/angular-hotkeys 0.6.0 → 0.7.0 Changeset
@tanstack/preact-hotkeys 0.6.0 → 0.7.0 Changeset
@tanstack/react-hotkeys 0.6.0 → 0.7.0 Changeset
@tanstack/solid-hotkeys 0.6.0 → 0.7.0 Changeset
@tanstack/svelte-hotkeys 0.6.0 → 0.7.0 Changeset
@tanstack/vue-hotkeys 0.6.0 → 0.7.0 Changeset

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 24, 2026

Open in StackBlitz

@tanstack/angular-hotkeys

npm i https://pkg.pr.new/@tanstack/angular-hotkeys@80

@tanstack/hotkeys

npm i https://pkg.pr.new/@tanstack/hotkeys@80

@tanstack/hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/hotkeys-devtools@80

@tanstack/preact-hotkeys

npm i https://pkg.pr.new/@tanstack/preact-hotkeys@80

@tanstack/preact-hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/preact-hotkeys-devtools@80

@tanstack/react-hotkeys

npm i https://pkg.pr.new/@tanstack/react-hotkeys@80

@tanstack/react-hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/react-hotkeys-devtools@80

@tanstack/solid-hotkeys

npm i https://pkg.pr.new/@tanstack/solid-hotkeys@80

@tanstack/solid-hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/solid-hotkeys-devtools@80

@tanstack/svelte-hotkeys

npm i https://pkg.pr.new/@tanstack/svelte-hotkeys@80

@tanstack/vue-hotkeys

npm i https://pkg.pr.new/@tanstack/vue-hotkeys@80

@tanstack/vue-hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/vue-hotkeys-devtools@80

commit: 1f650ae

@coderabbitai
Copy link

coderabbitai bot commented Mar 24, 2026

📝 Walkthrough

Walkthrough

This pull request introduces plural sequence registration APIs (useHotkeySequences, createHotkeySequences, injectHotkeySequences) across all six supported frameworks (React, Preact, Vue, Solid, Svelte, Angular), enabling efficient registration of multiple hotkey sequences in a single call. Includes complete source implementations, comprehensive documentation, full test coverage, and working example applications for each framework.

Changes

Cohort / File(s) Summary
Changeset & Configuration
.changeset/plural-sequences.md, docs/config.json
Added changeset entry marking hotkeys packages for minor version bumps. Updated docs config with navigation entries and examples for new plural sequence APIs across all frameworks.
Angular Framework - Implementation
packages/angular-hotkeys/src/injectHotkeySequences.ts, packages/angular-hotkeys/src/index.ts
Implemented injectHotkeySequences function using Angular's effect() for reactive sequence registration. Supports getter-based dynamic sequences and per-definition option merging. Handles cleanup via destroyRef.onDestroy.
Angular Framework - Documentation
docs/framework/angular/guides/sequences.md, docs/framework/angular/reference/*
Added guide section and reference documentation for injectHotkeySequences and InjectHotkeySequenceDefinition.
Angular Framework - Example
examples/angular/injectHotkeySequences/*
Complete Angular example project demonstrating injectHotkeySequences with configuration files, component logic tracking sequence triggers, styling, and HTML templates.
React Framework - Implementation
packages/react-hotkeys/src/useHotkeySequences.ts, packages/react-hotkeys/src/index.ts
Implemented useHotkeySequences hook managing multiple sequences through ref-based registration Map. Syncs callbacks/options on every render to prevent stale closures. Includes comprehensive test suite.
React Framework - Documentation
docs/framework/react/guides/sequences.md, docs/framework/react/reference/*
Added guide section and complete reference documentation for useHotkeySequences and UseHotkeySequenceDefinition.
React Framework - Example
examples/react/useHotkeySequences/*
Complete React/Vite example project with configuration, component tracking sequence triggers, styling, and entry point.
Preact Framework - Implementation
packages/preact-hotkeys/src/useHotkeySequences.ts, packages/preact-hotkeys/src/index.ts
Implemented useHotkeySequences hook for Preact with identical logic to React implementation. Includes comprehensive test suite.
Preact Framework - Documentation
docs/framework/preact/guides/sequences.md, docs/framework/preact/reference/*
Added guide section and reference documentation for useHotkeySequences and UseHotkeySequenceDefinition.
Preact Framework - Example
examples/preact/useHotkeySequences/*
Complete Preact/Vite example project with configuration, component logic, styling, and entry point.
Vue Framework - Implementation
packages/vue-hotkeys/src/useHotkeySequences.ts, packages/vue-hotkeys/src/index.ts
Implemented useHotkeySequences composable using watch for reactive updates. Supports refs/getters for dynamic sequence definitions. Includes internal helper for ref resolution.
Vue Framework - Documentation
docs/framework/vue/guides/sequences.md, docs/framework/vue/quick-start.md, docs/framework/vue/reference/*
Added guide section, quick-start guidance, and reference documentation for useHotkeySequences and UseHotkeySequenceDefinition.
Vue Framework - Example
examples/vue/useHotkeySequences/*
Complete Vue/Vite example project with configuration, component demonstrating sequence registration, styling, and entry point.
Solid Framework - Implementation
packages/solid-hotkeys/src/createHotkeySequences.ts, packages/solid-hotkeys/src/index.ts
Implemented createHotkeySequences primitive using createEffect for reactive registration. Supports function-based definitions and common options. Includes comprehensive test suite.
Solid Framework - Documentation
docs/framework/solid/guides/sequences.md, docs/framework/solid/reference/*
Added guide section and reference documentation for createHotkeySequences and CreateHotkeySequenceDefinition.
Solid Framework - Example
examples/solid/createHotkeySequences/*
Complete SolidJS/Vite example project with configuration, component tracking sequences, styling, and entry point.
Svelte Framework - Implementation
packages/svelte-hotkeys/src/createHotkeySequences.svelte.ts, packages/svelte-hotkeys/src/index.ts
Implemented createHotkeySequences and createHotkeySequencesAttachment for global and element-scoped registration. Uses Svelte's $effect and onDestroy. Supports getter-based dynamic definitions.
Svelte Framework - Documentation
docs/framework/svelte/guides/sequences.md, docs/framework/svelte/reference/*
Added guide section and reference documentation for createHotkeySequences, createHotkeySequencesAttachment, and CreateHotkeySequenceDefinition.
Svelte Framework - Example
examples/svelte/create-hotkey-sequences/*
Complete Svelte/Vite example project with configuration files, component demonstrating sequence registration, styling, and entry point.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 Plural sequences hop into place!
Six frameworks race with hotkey grace,
One call now handles many keys,
React, Vue, Solid with such ease,
Svelte and Angular join the fun,
Preact too—the deed is done! 🎉

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is a template with empty sections and unchecked checklist items, providing no substantive information about the changes, motivation, or testing performed. Fill in the 'Changes' section with details about what was added and why; complete the checklist items or explain which apply; confirm whether a changeset was generated for the release.
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: useHotkeySequences hooks' clearly and concisely summarizes the main change: adding new useHotkeySequences hooks across multiple frameworks.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hotkeysequences

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 12

🧹 Nitpick comments (3)
docs/framework/preact/guides/sequences.md (1)

38-38: Optional: add a commonOptions example snippet.

Since this line explains second-argument precedence, adding a tiny example with useHotkeySequences(definitions, commonOptions) would make the behavior immediately actionable.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/framework/preact/guides/sequences.md` at line 38, Add a short example
demonstrating the second-argument precedence for useHotkeySequences so readers
can see how HotkeysProvider defaults, the second-argument commonOptions, and
each definition’s options merge (e.g., show calling
useHotkeySequences(definitions, commonOptions) with one shared option overridden
by a per-definition options entry). Refer to useHotkeySequences,
HotkeysProvider, commonOptions, definitions, and each definition’s options in
the example so it clearly shows the precedence order in practice.
examples/angular/injectHotkeySequences/src/app/app.component.html (1)

72-74: Announce triggered sequence updates to assistive tech.

At Line 73, this status changes dynamically; adding aria-live="polite" improves screen-reader feedback.

♿ Suggested tweak
-      <div class="info-box success"><strong>Triggered:</strong> {{ seq }}</div>
+      <div class="info-box success" aria-live="polite">
+        <strong>Triggered:</strong> {{ seq }}
+      </div>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/angular/injectHotkeySequences/src/app/app.component.html` around
lines 72 - 74, The dynamic "Triggered" status rendered via the lastSequence()
template binding (as seq) should announce updates to assistive tech; add
aria-live="polite" to the div with class "info-box success" that displays {{ seq
}} so screen readers are notified of changes without interrupting. Target the
template block using lastSequence() / seq and update that div to include the
aria-live attribute.
packages/angular-hotkeys/src/injectHotkeySequences.ts (1)

106-110: Inconsistent enabled handling compared to other framework implementations.

The Angular implementation skips registration when enabled: false at lines 106-110, and always passes enabled: true when registering (line 158). Other framework implementations (React, Vue, Solid, Preact, Svelte) pass the resolved enabled value through to setOptions() or the registration call, allowing the underlying manager to handle enable/disable state.

This inconsistency means:

  • Angular: Toggling enabled causes unregister/re-register cycles
  • Other frameworks: Toggling enabled updates the existing handle via setOptions()

Consider aligning with other frameworks by passing the enabled value through to the handle:

♻️ Suggested alignment with other frameworks
-      const { enabled = true, ...sequenceOpts } = mergedOptions
+      const { enabled = true, target, ...restOptions } = mergedOptions

-      if (!enabled || resolvedSequence.length === 0) {
+      if (resolvedSequence.length === 0) {
         continue
       }

+      const resolvedTarget =
+        target ?? (typeof document !== 'undefined' ? document : null)
+
+      if (!resolvedTarget) {
+        continue
+      }
+
+      const sequenceOpts = { ...restOptions, enabled }

And when registering:

       const handle = manager.register(p.resolvedSequence, p.def.callback, {
         ...p.sequenceOpts,
-        enabled: true,
         target: p.resolvedTarget,
       })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/angular-hotkeys/src/injectHotkeySequences.ts` around lines 106 -
110, The Angular implementation currently destructures enabled from
mergedOptions and skips registration when enabled is false (using const {
enabled = true, ...sequenceOpts } = mergedOptions and continue), and later
always registers with enabled: true; instead, preserve and pass the resolved
enabled value through like other frameworks: do not early-continue on enabled
=== false (still register the sequence handle), and when calling the
registration or setOptions helper (the code path that currently uses
sequenceOpts/registration call), include enabled (the actual resolved enabled)
rather than hardcoding true so the manager can toggle state via
setOptions/update instead of unregistering/re-registering; adjust uses of
mergedOptions, sequenceOpts, and the register/setOptions call accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/framework/angular/guides/sequences.md`:
- Around line 28-48: The example is missing the import for the Angular decorator
used: add an import for Component from '@angular/core' at the top of the snippet
so the `@Component` decorator on AppComponent resolves; keep the existing import
of injectHotkeySequences from '@tanstack/angular-hotkeys' and the AppComponent
class/constructor unchanged.

In `@examples/angular/injectHotkeySequences/src/app/app.component.ts`:
- Line 12: The history property uses the bracket-array form which violates the
lint rule; change its type to the generic form by replacing any occurrences of
string[] with Array<string> (e.g., update history = signal<string[]>([]) to
history = signal<Array<string>>([]) and adjust any other annotations or uses of
history in the AppComponent class accordingly).

In `@examples/angular/injectHotkeySequences/src/app/app.config.ts`:
- Around line 1-6: The file currently imports provideHotkeys but doesn't use it
and pulls in ApplicationConfig as a value import; change the ApplicationConfig
import to a type-only import (import type { ApplicationConfig }) and add
provideHotkeys(...) into the providers array of the exported appConfig so the
example demonstrates hotkey setup; reference the symbols ApplicationConfig,
provideHotkeys, appConfig and provideZoneChangeDetection when making these
edits.

In `@examples/angular/injectHotkeySequences/src/styles.css`:
- Around line 22-27: Remove the duplicate margin declaration in the CSS rule for
selector "header p": delete the earlier "margin: 0" and keep the later "margin:
0 auto" so only one margin declaration remains in the "header p" rule to satisfy
Stylelint and avoid redundancy.

In `@examples/preact/useHotkeySequences/src/index.css`:
- Around line 26-30: The CSS block for the selector "header p" contains a
duplicate margin declaration; remove the redundant "margin: 0;" so the rule only
keeps the intended layout declaration ("margin: 0 auto") in the header p rule to
avoid dead code and ensure the paragraph is centered horizontally.

In `@examples/react/useHotkeySequences/src/index.css`:
- Around line 26-31: The CSS selector "header p" contains a duplicate margin
declaration: remove the redundant "margin: 0" so only "margin: 0 auto" remains
(or consolidate into a single margin rule) within the header p block to satisfy
Stylelint and prevent the overwritten property.

In `@examples/solid/createHotkeySequences/src/index.css`:
- Around line 22-27: The selector "header p" contains a duplicated margin
declaration; remove the redundant "margin: 0" so only the intended "margin: 0
auto" remains (or merge them into a single "margin: 0 auto") alongside the
existing "max-width: 500px" and other properties to satisfy Stylelint and avoid
the overridden rule.

In `@examples/solid/createHotkeySequences/src/index.tsx`:
- Around line 3-8: Reorder the named imports to satisfy the ESLint sort-imports
rule: in the first import list swap createSignal and Show so Show comes before
createSignal, and in the second import list reorder the three symbols so
HotkeysProvider appears before createHotkey and createHotkeySequences
(preserving the relative order between the two create* names).

In `@examples/svelte/create-hotkey-sequences/README.md`:
- Around line 16-19: Update the recreate command in the README so the generated
project name matches the example directory: replace the erroneous
"create-hotkey" token in the shell command with "create-hotkey-sequences" (the
command string in the README's recreate example).

In `@examples/svelte/create-hotkey-sequences/src/index.css`:
- Around line 26-31: The CSS rule for the selector "header p" contains a
duplicate margin declaration; remove the redundant "margin: 0;" and keep the
intended "margin: 0 auto;" in the header p rule (locate the header p block in
index.css) so only a single margin declaration remains and the stylelint error
is resolved.

In `@examples/vue/useHotkeySequences/src/index.css`:
- Around line 26-31: The CSS rule for selector "header p" contains a duplicate
margin declaration; remove the redundant "margin: 0;" and keep a single
consolidated margin declaration (e.g., "margin: 0 auto;") in the "header p" rule
so there is no overridden/unused property.

In `@packages/solid-hotkeys/tests/createHotkeySequences.test.tsx`:
- Around line 2-10: Reorder and split the imports to satisfy ESLint rules:
alphabetize named members inside each import, move type-only imports to
top-level "import type" statements, and place the "solid-js" import before the
relative module import. Specifically, convert "type
CreateHotkeySequenceDefinition" and "type Component" to top-level import type
lines, alphabetize members in the vitest import (afterEach, beforeEach,
describe, expect, it, vi) and in the `@tanstack/hotkeys` import (SequenceManager),
ensure "createSignal" and "Component" from "solid-js" are imported before
"../src/createHotkeySequences", and keep "render" from
"@solidjs/testing-library" ordered appropriately.

---

Nitpick comments:
In `@docs/framework/preact/guides/sequences.md`:
- Line 38: Add a short example demonstrating the second-argument precedence for
useHotkeySequences so readers can see how HotkeysProvider defaults, the
second-argument commonOptions, and each definition’s options merge (e.g., show
calling useHotkeySequences(definitions, commonOptions) with one shared option
overridden by a per-definition options entry). Refer to useHotkeySequences,
HotkeysProvider, commonOptions, definitions, and each definition’s options in
the example so it clearly shows the precedence order in practice.

In `@examples/angular/injectHotkeySequences/src/app/app.component.html`:
- Around line 72-74: The dynamic "Triggered" status rendered via the
lastSequence() template binding (as seq) should announce updates to assistive
tech; add aria-live="polite" to the div with class "info-box success" that
displays {{ seq }} so screen readers are notified of changes without
interrupting. Target the template block using lastSequence() / seq and update
that div to include the aria-live attribute.

In `@packages/angular-hotkeys/src/injectHotkeySequences.ts`:
- Around line 106-110: The Angular implementation currently destructures enabled
from mergedOptions and skips registration when enabled is false (using const {
enabled = true, ...sequenceOpts } = mergedOptions and continue), and later
always registers with enabled: true; instead, preserve and pass the resolved
enabled value through like other frameworks: do not early-continue on enabled
=== false (still register the sequence handle), and when calling the
registration or setOptions helper (the code path that currently uses
sequenceOpts/registration call), include enabled (the actual resolved enabled)
rather than hardcoding true so the manager can toggle state via
setOptions/update instead of unregistering/re-registering; adjust uses of
mergedOptions, sequenceOpts, and the register/setOptions call accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 216e776a-35f5-4f4b-97a0-20356289fa95

📥 Commits

Reviewing files that changed from the base of the PR and between d058c76 and 1f650ae.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (95)
  • .changeset/plural-sequences.md
  • docs/config.json
  • docs/framework/angular/guides/sequences.md
  • docs/framework/angular/reference/functions/injectHotkeySequences.md
  • docs/framework/angular/reference/index.md
  • docs/framework/angular/reference/interfaces/InjectHotkeySequenceDefinition.md
  • docs/framework/preact/guides/sequences.md
  • docs/framework/preact/reference/functions/useHotkeySequences.md
  • docs/framework/preact/reference/index.md
  • docs/framework/preact/reference/interfaces/UseHotkeySequenceDefinition.md
  • docs/framework/react/guides/sequences.md
  • docs/framework/react/reference/functions/useHotkeySequences.md
  • docs/framework/react/reference/index.md
  • docs/framework/react/reference/interfaces/UseHotkeySequenceDefinition.md
  • docs/framework/solid/guides/sequences.md
  • docs/framework/solid/reference/functions/createHotkeySequences.md
  • docs/framework/solid/reference/index.md
  • docs/framework/solid/reference/interfaces/CreateHotkeySequenceDefinition.md
  • docs/framework/svelte/guides/sequences.md
  • docs/framework/svelte/reference/functions/createHotkeySequences.md
  • docs/framework/svelte/reference/functions/createHotkeySequencesAttachment.md
  • docs/framework/svelte/reference/index.md
  • docs/framework/svelte/reference/interfaces/CreateHotkeySequenceDefinition.md
  • docs/framework/vue/guides/sequences.md
  • docs/framework/vue/quick-start.md
  • docs/framework/vue/reference/functions/useHotkeySequences.md
  • docs/framework/vue/reference/index.md
  • docs/framework/vue/reference/interfaces/UseHotkeySequenceDefinition.md
  • examples/angular/injectHotkeySequences/angular.json
  • examples/angular/injectHotkeySequences/package.json
  • examples/angular/injectHotkeySequences/src/app/app.component.css
  • examples/angular/injectHotkeySequences/src/app/app.component.html
  • examples/angular/injectHotkeySequences/src/app/app.component.ts
  • examples/angular/injectHotkeySequences/src/app/app.config.ts
  • examples/angular/injectHotkeySequences/src/index.html
  • examples/angular/injectHotkeySequences/src/main.ts
  • examples/angular/injectHotkeySequences/src/styles.css
  • examples/angular/injectHotkeySequences/tsconfig.json
  • examples/preact/useHotkeySequences/eslint.config.js
  • examples/preact/useHotkeySequences/index.html
  • examples/preact/useHotkeySequences/package.json
  • examples/preact/useHotkeySequences/src/index.css
  • examples/preact/useHotkeySequences/src/index.tsx
  • examples/preact/useHotkeySequences/tsconfig.json
  • examples/preact/useHotkeySequences/vite.config.ts
  • examples/react/useHotkeySequences/eslint.config.js
  • examples/react/useHotkeySequences/index.html
  • examples/react/useHotkeySequences/package.json
  • examples/react/useHotkeySequences/src/index.css
  • examples/react/useHotkeySequences/src/index.tsx
  • examples/react/useHotkeySequences/tsconfig.json
  • examples/react/useHotkeySequences/vite.config.ts
  • examples/solid/createHotkeySequences/index.html
  • examples/solid/createHotkeySequences/package.json
  • examples/solid/createHotkeySequences/src/index.css
  • examples/solid/createHotkeySequences/src/index.tsx
  • examples/solid/createHotkeySequences/tsconfig.json
  • examples/solid/createHotkeySequences/vite.config.ts
  • examples/svelte/create-hotkey-sequences/.gitignore
  • examples/svelte/create-hotkey-sequences/.npmrc
  • examples/svelte/create-hotkey-sequences/README.md
  • examples/svelte/create-hotkey-sequences/index.html
  • examples/svelte/create-hotkey-sequences/package.json
  • examples/svelte/create-hotkey-sequences/src/App.svelte
  • examples/svelte/create-hotkey-sequences/src/Root.svelte
  • examples/svelte/create-hotkey-sequences/src/index.css
  • examples/svelte/create-hotkey-sequences/src/main.ts
  • examples/svelte/create-hotkey-sequences/static/robots.txt
  • examples/svelte/create-hotkey-sequences/svelte.config.js
  • examples/svelte/create-hotkey-sequences/tsconfig.json
  • examples/svelte/create-hotkey-sequences/vite.config.ts
  • examples/vue/useHotkeySequences/eslint.config.js
  • examples/vue/useHotkeySequences/index.html
  • examples/vue/useHotkeySequences/package.json
  • examples/vue/useHotkeySequences/src/App.vue
  • examples/vue/useHotkeySequences/src/index.css
  • examples/vue/useHotkeySequences/src/index.ts
  • examples/vue/useHotkeySequences/src/vue.d.ts
  • examples/vue/useHotkeySequences/tsconfig.json
  • examples/vue/useHotkeySequences/vite.config.ts
  • packages/angular-hotkeys/src/index.ts
  • packages/angular-hotkeys/src/injectHotkeySequences.ts
  • packages/preact-hotkeys/src/index.ts
  • packages/preact-hotkeys/src/useHotkeySequences.ts
  • packages/preact-hotkeys/tests/useHotkeySequences.test.tsx
  • packages/react-hotkeys/src/index.ts
  • packages/react-hotkeys/src/useHotkeySequences.ts
  • packages/react-hotkeys/tests/useHotkeySequences.test.tsx
  • packages/solid-hotkeys/src/createHotkeySequences.ts
  • packages/solid-hotkeys/src/index.ts
  • packages/solid-hotkeys/tests/createHotkeySequences.test.tsx
  • packages/svelte-hotkeys/src/createHotkeySequences.svelte.ts
  • packages/svelte-hotkeys/src/index.ts
  • packages/vue-hotkeys/src/index.ts
  • packages/vue-hotkeys/src/useHotkeySequences.ts

Comment on lines +28 to +48
```ts
import { injectHotkeySequences } from '@tanstack/angular-hotkeys'

@Component({ standalone: true, template: `` })
export class AppComponent {
constructor() {
injectHotkeySequences([
{
sequence: ['G', 'G'],
callback: () =>
window.scrollTo({ top: 0, behavior: 'smooth' }),
},
{
sequence: ['D', 'D'],
callback: () => console.log('delete line'),
options: { timeout: 500 },
},
])
}
}
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Missing Component import in code example.

The example uses @Component decorator but doesn't import it, unlike the "Basic Usage" example above which shows import { Component } from '@angular/core'.

📝 Proposed fix
 ```ts
+import { Component } from '@angular/core'
 import { injectHotkeySequences } from '@tanstack/angular-hotkeys'
 
 `@Component`({ standalone: true, template: `` })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```ts
import { injectHotkeySequences } from '@tanstack/angular-hotkeys'
@Component({ standalone: true, template: `` })
export class AppComponent {
constructor() {
injectHotkeySequences([
{
sequence: ['G', 'G'],
callback: () =>
window.scrollTo({ top: 0, behavior: 'smooth' }),
},
{
sequence: ['D', 'D'],
callback: () => console.log('delete line'),
options: { timeout: 500 },
},
])
}
}
```
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/framework/angular/guides/sequences.md` around lines 28 - 48, The example
is missing the import for the Angular decorator used: add an import for
Component from '@angular/core' at the top of the snippet so the `@Component`
decorator on AppComponent resolves; keep the existing import of
injectHotkeySequences from '@tanstack/angular-hotkeys' and the AppComponent
class/constructor unchanged.

})
export class AppComponent {
lastSequence = signal<string | null>(null)
history = signal<string[]>([])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# Check if the file exists and read line 12
cat -n "examples/angular/injectHotkeySequences/src/app/app.component.ts" | sed -n '1,20p'

Repository: TanStack/hotkeys

Length of output: 766


🏁 Script executed:

# Find ESLint configuration files
find examples/angular/injectHotkeySequences -name ".eslintrc*" -o -name "eslint.config.*" | head -20

Repository: TanStack/hotkeys

Length of output: 42


🏁 Script executed:

# Also check if there's a root-level ESLint config
find . -maxdepth 2 -name ".eslintrc*" -o -name "eslint.config.*" | grep -v node_modules

Repository: TanStack/hotkeys

Length of output: 78


🏁 Script executed:

# Read the eslint config file
cat ./eslint.config.js

Repository: TanStack/hotkeys

Length of output: 669


🏁 Script executed:

# Find if we can access the tanstack config package
find . -type f -name "eslint-config" -o -path "*/node_modules/@tanstack/eslint-config*" | head -20

Repository: TanStack/hotkeys

Length of output: 3937


🏁 Script executed:

# Check the package.json to understand dependencies
cat package.json | head -50

Repository: TanStack/hotkeys

Length of output: 2966


🏁 Script executed:

# Search for any array-type configuration in the repo
rg "array-type" --type json --type js --type ts

Repository: TanStack/hotkeys

Length of output: 42


🏁 Script executed:

# Check the typescript config from `@tanstack/eslint-config`
cat "./node_modules/.pnpm/@tanstack+eslint-config@0.4.0_@typescript-eslint+utils@8.57.1_eslint@9.39.4_jiti@2.6.1__6ca1f9f7b11847c70a7fd36c7acf4bd4/node_modules/@tanstack/eslint-config/dist/typescript.js"

Repository: TanStack/hotkeys

Length of output: 1692


Use Array<string> for history to satisfy the configured TS lint rule.

Line 12 currently uses string[], which violates @typescript-eslint/array-type rule configured to require the generic Array<T> format.

Proposed fix
-  history = signal<string[]>([])
+  history = signal<Array<string>>([])
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
history = signal<string[]>([])
history = signal<Array<string>>([])
🧰 Tools
🪛 ESLint

[error] 12-12: Array type using 'string[]' is forbidden. Use 'Array' instead.

(@typescript-eslint/array-type)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/angular/injectHotkeySequences/src/app/app.component.ts` at line 12,
The history property uses the bracket-array form which violates the lint rule;
change its type to the generic form by replacing any occurrences of string[]
with Array<string> (e.g., update history = signal<string[]>([]) to history =
signal<Array<string>>([]) and adjust any other annotations or uses of history in
the AppComponent class accordingly).

Comment on lines +1 to +6
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'
import { provideHotkeys } from '@tanstack/angular-hotkeys'

export const appConfig: ApplicationConfig = {
providers: [provideZoneChangeDetection({ eventCoalescing: true })],
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Unused import and type-only import issue.

  1. provideHotkeys is imported but not used in the providers array. For an injectHotkeySequences example, you likely want to include it to demonstrate proper setup.
  2. Per ESLint, ApplicationConfig should use a type-only import.
📝 Proposed fix (option A: use provideHotkeys)
-import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'
+import type { ApplicationConfig } from '@angular/core'
+import { provideZoneChangeDetection } from '@angular/core'
 import { provideHotkeys } from '@tanstack/angular-hotkeys'
 
 export const appConfig: ApplicationConfig = {
-  providers: [provideZoneChangeDetection({ eventCoalescing: true })],
+  providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideHotkeys()],
 }
📝 Proposed fix (option B: remove unused import)
-import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'
-import { provideHotkeys } from '@tanstack/angular-hotkeys'
+import type { ApplicationConfig } from '@angular/core'
+import { provideZoneChangeDetection } from '@angular/core'
 
 export const appConfig: ApplicationConfig = {
   providers: [provideZoneChangeDetection({ eventCoalescing: true })],
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'
import { provideHotkeys } from '@tanstack/angular-hotkeys'
export const appConfig: ApplicationConfig = {
providers: [provideZoneChangeDetection({ eventCoalescing: true })],
}
import type { ApplicationConfig } from '@angular/core'
import { provideZoneChangeDetection } from '@angular/core'
import { provideHotkeys } from '@tanstack/angular-hotkeys'
export const appConfig: ApplicationConfig = {
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideHotkeys()],
}
Suggested change
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'
import { provideHotkeys } from '@tanstack/angular-hotkeys'
export const appConfig: ApplicationConfig = {
providers: [provideZoneChangeDetection({ eventCoalescing: true })],
}
import type { ApplicationConfig } from '@angular/core'
import { provideZoneChangeDetection } from '@angular/core'
export const appConfig: ApplicationConfig = {
providers: [provideZoneChangeDetection({ eventCoalescing: true })],
}
🧰 Tools
🪛 ESLint

[error] 1-1: Imports "ApplicationConfig" are only used as type.

(@typescript-eslint/consistent-type-imports)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/angular/injectHotkeySequences/src/app/app.config.ts` around lines 1
- 6, The file currently imports provideHotkeys but doesn't use it and pulls in
ApplicationConfig as a value import; change the ApplicationConfig import to a
type-only import (import type { ApplicationConfig }) and add provideHotkeys(...)
into the providers array of the exported appConfig so the example demonstrates
hotkey setup; reference the symbols ApplicationConfig, provideHotkeys, appConfig
and provideZoneChangeDetection when making these edits.

Comment on lines +22 to +27
header p {
color: #666;
margin: 0;
max-width: 500px;
margin: 0 auto;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove duplicate margin declaration in header p.

margin: 0 on Line 24 is redundant because Line 26 sets margin: 0 auto, and this is flagged by Stylelint.

✂️ Proposed fix
 header p {
   color: `#666`;
-  margin: 0;
   max-width: 500px;
   margin: 0 auto;
 }
🧰 Tools
🪛 Stylelint (17.4.0)

[error] 24-24: Unexpected duplicate "margin" (declaration-block-no-duplicate-properties)

(declaration-block-no-duplicate-properties)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/angular/injectHotkeySequences/src/styles.css` around lines 22 - 27,
Remove the duplicate margin declaration in the CSS rule for selector "header p":
delete the earlier "margin: 0" and keep the later "margin: 0 auto" so only one
margin declaration remains in the "header p" rule to satisfy Stylelint and avoid
redundancy.

Comment on lines +26 to +30
header p {
color: #666;
margin: 0;
max-width: 500px;
margin: 0 auto;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove the duplicate margin declaration in header p.

margin is declared twice in the same block, and the first one is dead code (Line 28 is overridden by Line 30).

🧹 Proposed fix
 header p {
   color: `#666`;
-  margin: 0;
   max-width: 500px;
   margin: 0 auto;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
header p {
color: #666;
margin: 0;
max-width: 500px;
margin: 0 auto;
header p {
color: `#666`;
max-width: 500px;
margin: 0 auto;
}
🧰 Tools
🪛 Stylelint (17.4.0)

[error] 28-28: Unexpected duplicate "margin" (declaration-block-no-duplicate-properties)

(declaration-block-no-duplicate-properties)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/preact/useHotkeySequences/src/index.css` around lines 26 - 30, The
CSS block for the selector "header p" contains a duplicate margin declaration;
remove the redundant "margin: 0;" so the rule only keeps the intended layout
declaration ("margin: 0 auto") in the header p rule to avoid dead code and
ensure the paragraph is centered horizontally.

Comment on lines +3 to +8
import { createSignal, Show } from 'solid-js'
import {
createHotkey,
createHotkeySequences,
HotkeysProvider,
} from '@tanstack/solid-hotkeys'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat -n examples/solid/createHotkeySequences/src/index.tsx | head -20

Repository: TanStack/hotkeys

Length of output: 845


🏁 Script executed:

# Find ESLint configuration files
fd -type f -name ".eslintrc*" -o -name "eslint.config.*" -o -name "eslintignore"

Repository: TanStack/hotkeys

Length of output: 230


🏁 Script executed:

# Check for eslint config in package.json
cat package.json | grep -A 20 '"eslintConfig"'

Repository: TanStack/hotkeys

Length of output: 42


🏁 Script executed:

find . -maxdepth 2 -name ".eslintrc*" -o -name "eslint.config.*" 2>/dev/null

Repository: TanStack/hotkeys

Length of output: 78


🏁 Script executed:

# Look for ESLint config in the root
ls -la | grep -i eslint

Repository: TanStack/hotkeys

Length of output: 128


🏁 Script executed:

# Check package.json for eslintConfig
cat package.json 2>/dev/null | head -50

Repository: TanStack/hotkeys

Length of output: 2966


🏁 Script executed:

cat -n eslint.config.js

Repository: TanStack/hotkeys

Length of output: 844


🏁 Script executed:

# Search for sort-imports mentions in the repo
rg "sort-imports" --type-list | head -20

Repository: TanStack/hotkeys

Length of output: 449


🏁 Script executed:

# Check if tanstack/eslint-config is mentioned anywhere or check node_modules
find . -path ./node_modules -prune -o -type f -name "*.json" -o -name "*.js" -o -name "*.ts" 2>/dev/null | xargs grep -l "sort-imports" 2>/dev/null | head -10

Repository: TanStack/hotkeys

Length of output: 42


🏁 Script executed:

# Let me check the actual sort-imports rule behavior by looking at similar files in the repo
rg "^import \{" examples/solid/createHotkeySequences/src/ -A 3

Repository: TanStack/hotkeys

Length of output: 948


🏁 Script executed:

# Check other import statements in the repo to see if they follow the pattern suggested
rg "^import \{" examples/ -A 3 | head -50

Repository: TanStack/hotkeys

Length of output: 2960


🏁 Script executed:

# Also check package imports in other example files
find examples -name "*.tsx" -o -name "*.ts" -o -name "*.jsx" -o -name "*.js" | head -5 | xargs head -15

Repository: TanStack/hotkeys

Length of output: 1860


🏁 Script executed:

# Let me look for the exact sort-imports configuration by checking web sources
# First, let me verify the alphabetical ordering claim by checking similar multi-line imports
rg -A 5 "^import \{$" packages/ examples/ | grep -A 4 "createHotkey\|formatKey\|injectHotkey" | head -30

Repository: TanStack/hotkeys

Length of output: 1905


🏁 Script executed:

# Check the current sorting order of the solid example more carefully
sed -n '3,8p' examples/solid/createHotkeySequences/src/index.tsx

Repository: TanStack/hotkeys

Length of output: 207


🏁 Script executed:

# Let me check if there are any ESLint configuration hints in a parent or root eslint config
cat eslint.config.js

Repository: TanStack/hotkeys

Length of output: 669


🏁 Script executed:

# Check if there are any other files with explicit import ordering to understand the pattern
rg "^import \{" packages/solid-hotkeys/src/ -A 3 | head -40

Repository: TanStack/hotkeys

Length of output: 3018


🏁 Script executed:

# Look for test files that might have sorted imports
rg "^import \{" packages/solid-hotkeys/tests/ -A 5 | head -50

Repository: TanStack/hotkeys

Length of output: 3277


🏁 Script executed:

# Let me check what `@tanstack/eslint-config` might configure by looking at how other files are structured
find . -path ./node_modules -prune -o -name "*.tsx" -o -name "*.ts" | xargs grep -l "^import { [A-Z]" | head -5

Repository: TanStack/hotkeys

Length of output: 385


🏁 Script executed:

# Let me check more examples to understand the import sorting pattern
rg "^import \{" packages/ | grep -E "^[^:]+:import \{[^}]+\}" | head -15

Repository: TanStack/hotkeys

Length of output: 1577


🏁 Script executed:

# Check if the tanstack config might be documented or if there's a lockfile that shows its version
cat pnpm-lock.yaml 2>/dev/null | grep -A 3 "tanstack/eslint-config" | head -10

Repository: TanStack/hotkeys

Length of output: 513


🏁 Script executed:

# Let me search for information about `@tanstack/eslint-config` and its sort-imports configuration
# First, let me check if there's documentation in the repo or hints in other config files
find . -name "*.md" -o -name "*.txt" | xargs grep -l "sort-imports" 2>/dev/null | head -5

Repository: TanStack/hotkeys

Length of output: 42


🏁 Script executed:

# Let me analyze the ASCII ordering more carefully - the proposed fix suggests case-sensitive sorting
# Let me verify by checking the ASCII values
python3 << 'EOF'
# Current code line 3
current_1 = "createSignal"
current_2 = "Show"

# Proposed code line 3
proposed_1 = "Show"
proposed_2 = "createSignal"

# Check first import
print("First import 'solid-js':")
print(f"Current: {current_1} ({ord(current_1[0])}) < {current_2} ({ord(current_2[0])}): {current_1 < current_2}")
print(f"Proposed: {proposed_1} ({ord(proposed_1[0])}) < {proposed_2} ({ord(proposed_2[0])}): {proposed_1 < proposed_2}")
print()

# Current code lines 5-7
current_1 = "createHotkey"
current_2 = "createHotkeySequences"
current_3 = "HotkeysProvider"

# Proposed code
proposed_1 = "HotkeysProvider"
proposed_2 = "createHotkey"
proposed_3 = "createHotkeySequences"

print("Second import '@tanstack/solid-hotkeys':")
print(f"Current order: {current_1}, {current_2}, {current_3}")
print(f"  {current_1} < {current_2}: {current_1 < current_2}")
print(f"  {current_2} < {current_3}: {current_2 < current_3}")
print()
print(f"Proposed order: {proposed_1}, {proposed_2}, {proposed_3}")
print(f"  {proposed_1} < {proposed_2}: {proposed_1 < proposed_2}")
print(f"  {proposed_2} < {proposed_3}: {proposed_2 < proposed_3}")
EOF

Repository: TanStack/hotkeys

Length of output: 534


Fix named import ordering to satisfy ESLint sort-imports rule.

The imports on lines 3 and 5–7 are not in alphabetical order. Line 3 has createSignal before Show (should be reversed), and the second import has createHotkeySequences and HotkeysProvider out of order (uppercase letters sort before lowercase in case-sensitive ordering).

Proposed fix
-import { createSignal, Show } from 'solid-js'
+import { Show, createSignal } from 'solid-js'
 import {
+  HotkeysProvider,
   createHotkey,
   createHotkeySequences,
-  HotkeysProvider,
 } from '@tanstack/solid-hotkeys'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { createSignal, Show } from 'solid-js'
import {
createHotkey,
createHotkeySequences,
HotkeysProvider,
} from '@tanstack/solid-hotkeys'
import { Show, createSignal } from 'solid-js'
import {
HotkeysProvider,
createHotkey,
createHotkeySequences,
} from '@tanstack/solid-hotkeys'
🧰 Tools
🪛 ESLint

[error] 3-3: Member 'Show' of the import declaration should be sorted alphabetically.

(sort-imports)


[error] 7-7: Member 'HotkeysProvider' of the import declaration should be sorted alphabetically.

(sort-imports)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/solid/createHotkeySequences/src/index.tsx` around lines 3 - 8,
Reorder the named imports to satisfy the ESLint sort-imports rule: in the first
import list swap createSignal and Show so Show comes before createSignal, and in
the second import list reorder the three symbols so HotkeysProvider appears
before createHotkey and createHotkeySequences (preserving the relative order
between the two create* names).

Comment on lines +16 to +19
```sh
# recreate this project
pnpm dlx sv create --template minimal --types ts --install pnpm create-hotkey
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Project name mismatch in recreate command.

The project name create-hotkey doesn't match the example directory name create-hotkey-sequences.

📝 Proposed fix
 ```sh
 # recreate this project
-pnpm dlx sv create --template minimal --types ts --install pnpm create-hotkey
+pnpm dlx sv create --template minimal --types ts --install pnpm create-hotkey-sequences
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/svelte/create-hotkey-sequences/README.md` around lines 16 - 19,
Update the recreate command in the README so the generated project name matches
the example directory: replace the erroneous "create-hotkey" token in the shell
command with "create-hotkey-sequences" (the command string in the README's
recreate example).

Comment on lines +26 to +31
header p {
color: #666;
margin: 0;
max-width: 500px;
margin: 0 auto;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove duplicate margin declaration in header p.

Line 28 is overridden by Line 30, and this triggers the stylelint error. Keep only one margin declaration.

Proposed fix
 header p {
   color: `#666`;
-  margin: 0;
   max-width: 500px;
   margin: 0 auto;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
header p {
color: #666;
margin: 0;
max-width: 500px;
margin: 0 auto;
}
header p {
color: `#666`;
max-width: 500px;
margin: 0 auto;
}
🧰 Tools
🪛 Stylelint (17.4.0)

[error] 28-28: Unexpected duplicate "margin" (declaration-block-no-duplicate-properties)

(declaration-block-no-duplicate-properties)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/svelte/create-hotkey-sequences/src/index.css` around lines 26 - 31,
The CSS rule for the selector "header p" contains a duplicate margin
declaration; remove the redundant "margin: 0;" and keep the intended "margin: 0
auto;" in the header p rule (locate the header p block in index.css) so only a
single margin declaration remains and the stylelint error is resolved.

Comment on lines +26 to +31
header p {
color: #666;
margin: 0;
max-width: 500px;
margin: 0 auto;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -type f -path "*/examples/vue/useHotkeySequences/src/index.css" | head -5

Repository: TanStack/hotkeys

Length of output: 107


🏁 Script executed:

cat -n examples/vue/useHotkeySequences/src/index.css | sed -n '20,35p'

Repository: TanStack/hotkeys

Length of output: 388


Remove duplicate margin declaration in header p.

Line 28 (margin: 0;) is overridden by line 30 (margin: 0 auto;), making it redundant.

Proposed fix
 header p {
   color: `#666`;
-  margin: 0;
   max-width: 500px;
   margin: 0 auto;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
header p {
color: #666;
margin: 0;
max-width: 500px;
margin: 0 auto;
}
header p {
color: `#666`;
max-width: 500px;
margin: 0 auto;
}
🧰 Tools
🪛 Stylelint (17.4.0)

[error] 28-28: Unexpected duplicate "margin" (declaration-block-no-duplicate-properties)

(declaration-block-no-duplicate-properties)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/vue/useHotkeySequences/src/index.css` around lines 26 - 31, The CSS
rule for selector "header p" contains a duplicate margin declaration; remove the
redundant "margin: 0;" and keep a single consolidated margin declaration (e.g.,
"margin: 0 auto;") in the "header p" rule so there is no overridden/unused
property.

Comment on lines +2 to +10
import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest'
import { render } from '@solidjs/testing-library'
import { SequenceManager } from '@tanstack/hotkeys'
import {
createHotkeySequences,
type CreateHotkeySequenceDefinition,
} from '../src/createHotkeySequences'
import { createSignal, type Component } from 'solid-js'

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify this file passes eslint import rules after the fix
pnpm -s eslint packages/solid-hotkeys/tests/createHotkeySequences.test.tsx

Repository: TanStack/hotkeys

Length of output: 1062


Consolidate imports to satisfy ESLint ordering and type-import rules.

This block violates sort-imports, import/order, and import/consistent-type-specifier-style. Sort members alphabetically within imports, extract inline type specifiers to top-level import type statements, and reorder to place solid-js before ../src/createHotkeySequences.

Proposed import cleanup
-import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
 import { render } from '@solidjs/testing-library'
 import { SequenceManager } from '@tanstack/hotkeys'
+import { createSignal } from 'solid-js'
+import type { Component } from 'solid-js'
 import {
   createHotkeySequences,
-  type CreateHotkeySequenceDefinition,
 } from '../src/createHotkeySequences'
-import { createSignal, type Component } from 'solid-js'
+import type { CreateHotkeySequenceDefinition } from '../src/createHotkeySequences'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest'
import { render } from '@solidjs/testing-library'
import { SequenceManager } from '@tanstack/hotkeys'
import {
createHotkeySequences,
type CreateHotkeySequenceDefinition,
} from '../src/createHotkeySequences'
import { createSignal, type Component } from 'solid-js'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { render } from '@solidjs/testing-library'
import { SequenceManager } from '@tanstack/hotkeys'
import { createSignal } from 'solid-js'
import type { Component } from 'solid-js'
import {
createHotkeySequences,
} from '../src/createHotkeySequences'
import type { CreateHotkeySequenceDefinition } from '../src/createHotkeySequences'
🧰 Tools
🪛 ESLint

[error] 2-2: Member 'beforeEach' of the import declaration should be sorted alphabetically.

(sort-imports)


[error] 7-7: Member 'CreateHotkeySequenceDefinition' of the import declaration should be sorted alphabetically.

(sort-imports)


[error] 7-7: Prefer using a top-level type-only import instead of inline type specifiers.

(import/consistent-type-specifier-style)


[error] 9-9: solid-js import should occur before import of ../src/createHotkeySequences

(import/order)


[error] 9-9: Member 'Component' of the import declaration should be sorted alphabetically.

(sort-imports)


[error] 9-9: Prefer using a top-level type-only import instead of inline type specifiers.

(import/consistent-type-specifier-style)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/solid-hotkeys/tests/createHotkeySequences.test.tsx` around lines 2 -
10, Reorder and split the imports to satisfy ESLint rules: alphabetize named
members inside each import, move type-only imports to top-level "import type"
statements, and place the "solid-js" import before the relative module import.
Specifically, convert "type CreateHotkeySequenceDefinition" and "type Component"
to top-level import type lines, alphabetize members in the vitest import
(afterEach, beforeEach, describe, expect, it, vi) and in the `@tanstack/hotkeys`
import (SequenceManager), ensure "createSignal" and "Component" from "solid-js"
are imported before "../src/createHotkeySequences", and keep "render" from
"@solidjs/testing-library" ordered appropriately.

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.

1 participant