Skip to content

[tcgc] add language-specific linter rules for reserved words#4099

Open
iscai-msft wants to merge 6 commits intoAzure:mainfrom
iscai-msft:tcgc/reservedWordsRule
Open

[tcgc] add language-specific linter rules for reserved words#4099
iscai-msft wants to merge 6 commits intoAzure:mainfrom
iscai-msft:tcgc/reservedWordsRule

Conversation

@iscai-msft
Copy link
Copy Markdown
Contributor

fixes #3001

@microsoft-github-policy-service microsoft-github-policy-service bot added the lib:tcgc Issues for @azure-tools/typespec-client-generator-core library label Mar 24, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 24, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@azure-tools/typespec-client-generator-core@4099

commit: e0fdd0c

@azure-sdk
Copy link
Copy Markdown
Collaborator

azure-sdk commented Mar 24, 2026

All changed packages have been documented.

  • @azure-tools/typespec-client-generator-core
Show changes

@azure-tools/typespec-client-generator-core - feature ✏️

Add linter rules for reserved words in languages

@timotheeguerin timotheeguerin added the int:azure-specs Run integration tests against azure-rest-api-specs label Mar 24, 2026
import { createReservedWordRule } from "./create-reserved-word-rule.js";
import { csharpReservedWords } from "./words.js";

export const csharpReservedWordsRule = createReservedWordRule("csharp", "C#", csharpReservedWords);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do you think it really valuable to have this rule as 5 different one and for any new language we'll add we'll need a new one?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if it is just for organization, would keeping the words next to the rule instead of everything in words not be slightlyg better?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it would be so you could individually validate for each language, i.e. if you're trying to generate python, you wouldn't have to see which words fail for csharp. You're right though that this list can grow, and I'm thinking more that since most people generate all sdks at a time, it's ok for them to not be isolated, though I still think I prefer it that way.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

just thinking also what if the rule had some option instead(we don't support that today becuase there wasn't a need for it but we could probably add that easily to the compiler)

like

no-reserverd-words: [csharp, python, java]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ooh yes I like that idea. should I open a separate issue for this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

also missing the doc pages

@azure-sdk
Copy link
Copy Markdown
Collaborator

azure-sdk commented Mar 24, 2026

You can try these changes here

🛝 Playground 🌐 Website

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

int:azure-specs Run integration tests against azure-rest-api-specs lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[tcgc] add language-specific linting rules for special / reserved words

4 participants