Skip to content

cli: Use camelCase for program name in anchor.workspace templates#3581

Merged
acheroncrypto merged 2 commits intosolana-foundation:masterfrom
acheroncrypto:cli-use-camelcase-for-program-name-in-anchor.workspace-templates
Mar 8, 2025
Merged

cli: Use camelCase for program name in anchor.workspace templates#3581
acheroncrypto merged 2 commits intosolana-foundation:masterfrom
acheroncrypto:cli-use-camelcase-for-program-name-in-anchor.workspace-templates

Conversation

@acheroncrypto
Copy link
Collaborator

Problem

The TS test template code uses PascalCase for anchor.workspace property accessors.

Example (from anchor init program-name):

const program = anchor.workspace.ProgramName as Program<ProgramName>;

Given camelCase is the case convention in JS/TS for property accessors, and this is pretty much the only place where we use PascalCase when accessing a property in the whole library, it would be better to also use camelCase here to make casing consistent.

Summary of changes

Use camelCase for program name in anchor.workspace templates:

const program = anchor.workspace.programName as Program<ProgramName>;

Note: This change only affects the generated templates, and using PascalCase (or pretty much any other case) still works (#2579).

@vercel
Copy link

vercel bot commented Mar 7, 2025

@acheroncrypto is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@acheroncrypto acheroncrypto added cli fix Bug fix PR labels Mar 7, 2025
@acheroncrypto acheroncrypto merged commit 58313de into solana-foundation:master Mar 8, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli fix Bug fix PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant