RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/hashintel/hash

Cursor rule

.cursor/rules/typescript-coding-guidelines.mdc

TypeScript coding guidelines / style – check when working on TypeScript files

Cursor rules

Quality

65/100

Scores the file, not the repository.

Length

570 words

8 headings · 2 code blocks

Repository

1.6k

— · pushed 0 days ago

Last changed

3 days ago

First indexed 3 days ago.
hashintel/hash/.cursor/rules/typescript-coding-guidelines.mdcRawGitHub
1---
2description: TypeScript coding guidelines / style – check when working on TypeScript files
3globs: *.ts, *.tsx
4alwaysApply: false
5---
6# General
7 
8- Prefer 'const myFunc = () => {}' over function declarations.
9- Parallelize async calls where appropriate via `Promise.all` instead of sequential fetches in a `for` loop.
10- No `any` allowed. If the input type is genuinely unknown, use `unknown` and write appropriate logic to narrow the type.
11- Prefer `??` over `||`
12- No unchecked index access (`array[0]` might be `undefined`). Optional chain or check and throw and error (depending on whether it is acceptable for the result to be undefined or not).
13- Don't make formatting corrections to lines you aren't already modifying. Auto-fixing will handle it.
14- Avoid single-letter variable names. e.g. `event`, not `e`. Exception: in `for` loops (e.g. `i` is fine).
15- Variable names are all in `camelCase`. No `SCREAMING_SNAKE_CASE`.
16- Check function and type signatures carefully to understand APIs and what fields are available.
17 For external libraries, these should be available in a type declaration file.
18 Don't guess APIs! Check the signatures.
19 
20# Avoid these!
21 
22- Don't make changes unrelated to the user's requests. You can suggest further changes at the end of your work.
23- Don't get stuck fixing linting errors – stop and ask for help sooner.
24- Don't attempt to run the app. Let the user handle testing.
25 
26# Workspaces
27 
28- The project uses yarn workspaces.
29- If you want to install a dependency, you need to do it in the relevant workspace. e.g. `apps/hash-frontend`.
30- The project
31 
32# Frontend
33 
34- Use React function components
35- Use MUI components for all HTML elements (import from `@mui/material`)
36 - Style using the `sx` prop
37 - Flex boxes should use the `Stack` component
38- Use ApolloClient hooks for fetching from the API (e.g. `useQuery`)
39 
40# Entities
41 
42- An `Entity` is a key primitive in the system. They have types which describe their properties. Each entity can have multiple types.
43 
44## Types
45 
46- A `ClosedMultiEntityType` is the combined schema of the entity types an entity has.
47- When requesting entities from the GraphQL API, via `getEntitySubgraphQuery`, a map of `ClosedMultiEntityType`s is available on
48 `closedMultiEntityTypes` in the return field (so long as `includeEntityTypes: "resolved"` has been passed in the `variables.request` object)
49- To retrieve a specific `ClosedMultiEntityType` from the map, use `getClosedMultiEntityTypeFromMap` imported from `@local/hash-graph-sdk/entity`
50- The property and data types for a given `ClosedMultiEntityType` are available in the `definitions` field returned from the API.
51- Labels for entities (human-readable display strings) can be generated by calling `generateEntityLabel(closedMultiEntityType, entity)`
52- If a `ClosedMultiEntityType` is needed for an arbitrary set of `entityTypeIds`, e.g. for draft/proposed entities, use `getClosedMultiEntityTypesQuery`.
53 It also returns a `closedMultiEntityTypes` and `definitions` fields.
54 This should be an array of arrays, where each entry in the array is a set of entityTypeIds you require a closed type for.
55- To get the `icon` for an entity if required, call `getDisplayFieldsForClosedEntityType(closedMultiEntityType)`.
56 
57## Linked entities
58 
59- A 'subgraph' will contain details of entities and entities linked to it.
60 
61# File organization
62 
63- When exports from a module are only used in one other file, they should be created in a subfolder named after the importing file.
64 e.g.
65 
66```md
67- page.tsx
68- page/header.tsx
69- page/header/header-button.tsx
70- page/sidebar.tsx
71```
72 
73- If a module is used by multiple other files, it should be in a `shared` folder at the highest point at which it is needed in the file tree. e.g.
74 
75```md
76- page.tsx
77- api.tsx
78- shared/types.ts // types is used by both page and api
79```
80 

Sections

  • General
  • Avoid these!
  • Workspaces
  • Frontend
  • Entities
  • Types
  • Linked entities
  • File organization

What it covers

code-styletypesdo-not

Stack — with the evidence

typescript

(1.00)

rust

(1.00)

monorepo

(0.85)

node

(0.70)

react

(0.70)

nextjs

(0.70)

express

(0.70)

fastapi

(0.70)

llamaindex

(0.70)

vitest

(0.70)

pytest

(0.70)

eslint

(0.70)

vercel

(0.70)

aws

(0.70)

javascript

(0.60)

turborepo

(0.60)

github-actions

(0.60)

python

(0.50)

Glob targeting

  • *.ts
  • *.tsx

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
hashintel
Language
—
License
—
Archived
no

All configs in this repo

Also in hashintel/hash

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
hashintel/hash.cursor/rules/ai-assistant-guidelines.mdc · 1.6kCursor rulestypescriptrust+16do-not51/1003 days ago
hashintel/hash.cursor/rules/rust-documentation.mdc · 1.6kCursor rulestypescriptrust+16docs33/1003 days ago
hashintel/hash.cursor/rules/git-commit-conventions.mdc · 1.6kCursor rulestypescriptrust+16lint-formatstylegitdo-not51/1003 days ago
hashintel/hash.cursor/rules/meaningful-identifiers.mdc · 1.6kCursor rulestypescriptrust+16do-not32/1003 days ago
hashintel/hash.cursor/rules/rust-coding-style.mdc · 1.6kCursor rulestypescriptrust+16lint-formatstyletypesdependencies+269/1003 days ago
hashintel/hash.cursor/rules/rust-error-handling.mdc · 1.6kCursor rulestypescriptrust+16no sections31/1003 days ago
hashintel/hash.cursor/rules/rust-testing-strategy.mdc · 1.6kCursor rulestypescriptrust+16testlint-formatstyletesting-strategy81/1003 days ago
hashintel/hash.cursor/rules/rust-tracing-practices.mdc · 1.6kCursor rulestypescriptrust+16no sections45/1003 days ago
hashintel/hash.cursor/rules/update-rules.mdc · 1.6kCursor rulestypescriptrust+16no sections4/1003 days ago
hashintel/hash.github/instructions/code-review.instructions.md · 1.6kCopilot instructionstypescriptrust+16lint-formatstylegitdo-not+178/1003 days ago
hashintel/hash.github/instructions/rust-review.instructions.md · 1.6kCopilot instructionstypescriptrust+16lint-formatstylegitdo-not73/1003 days ago
hashintel/hash.github/instructions/typescript-review.instructions.md · 1.6kCopilot instructionstypescriptrust+16testlint-formatstyletypes+266/1003 days ago
hashintel/hashAGENTS.md · 1.6kAGENTS.mdtypescriptrust+16testlint-formatarchtypes+493/1003 days ago
hashintel/hashlibs/@hashintel/ds-components/AGENTS.md · 1.6kAGENTS.mdtypescriptrust+18buildtestlint-formatstyle+597/1003 days ago
hashintel/hashlibs/@hashintel/ds-helpers/AGENTS.md · 1.6kAGENTS.mdtypescriptrust+16archdependenciesagent-behaviour62/1003 days ago
hashintel/hashlibs/@hashintel/petrinaut/AGENTS.md · 1.6kAGENTS.mdtypescriptrust+17buildtestlint-formatstyle80/1003 days ago
Diff against .cursor/rules/ai-assistant-guidelines.mdc Diff against .cursor/rules/rust-documentation.mdc Diff against .cursor/rules/git-commit-conventions.mdc Diff against .cursor/rules/meaningful-identifiers.mdc Diff against .cursor/rules/rust-coding-style.mdc Diff against .cursor/rules/rust-error-handling.mdc Diff against .cursor/rules/rust-testing-strategy.mdc Diff against .cursor/rules/rust-tracing-practices.mdc Diff against .cursor/rules/update-rules.mdc Diff against .github/instructions/code-review.instructions.md Diff against .github/instructions/rust-review.instructions.md Diff against .github/instructions/typescript-review.instructions.md Diff against AGENTS.md Diff against libs/@hashintel/ds-components/AGENTS.md Diff against libs/@hashintel/ds-helpers/AGENTS.md Diff against libs/@hashintel/petrinaut/AGENTS.md

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/1003 days ago
markstev/mark-starter.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+14setuptestlint-formatstyle+699/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+15setuptestlint-formatstyle+799/1003 days ago
deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1Cursor rulestypescriptnextjs+5setuptestlint-formatstyle+799/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack