Skip to content

Support linter configuration overrides from the CLI - #12195

Open
Timothee Guerin (timotheeguerin) wants to merge 5 commits into
microsoft:mainfrom
timotheeguerin:feat/cli-linter-config
Open

Timothee Guerin (timotheeguerin) wants to merge 5 commits into
microsoft:mainfrom
timotheeguerin:feat/cli-linter-config

Conversation

@timotheeguerin

@timotheeguerin Timothee Guerin (timotheeguerin) commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Changing lint policy for a single compilation currently requires editing tspconfig.yaml or maintaining a separate config, even when the goal is just to skip linting or try another ruleset.

Add runtime-only overrides without changing the project's configuration:

tsp compile . --no-linter
tsp compile . --linter-ruleset @typespec/http/all
tsp compile . --linter-rule @typespec/compiler/unused-using=true
tsp compile . --linter-rule @typespec/compiler/unused-using=false

--linter-ruleset can be repeated and accepts library rulesets or file: YAML references. It replaces the configured extends list while preserving configured per-rule settings. CLI file paths resolve from the working directory.

--linter-rule accepts true, false, or a JSON options object and takes precedence over configured rule settings. --no-linter disables lint rules without suppressing compiler diagnostics or emitters, and cannot be combined with either override flag.

@microsoft-github-policy-service microsoft-github-policy-service Bot added compiler:core Issues for @typespec/compiler meta:website TypeSpec.io updates labels Oct 15, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/compiler@12195

commit: b35d513

@github-actions

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • ✅ @typespec/compiler
Show changes

@typespec/compiler - feature ✏️

Override linter configuration for a single compilation without editing tspconfig.yaml. Select rulesets with --linter-ruleset, enable, disable, or configure individual rules with --linter-rule, and skip linting with --no-linter.,> ,> bash,> tsp compile . --linter-ruleset @typespec/http/all,> tsp compile . --linter-rule @typespec/compiler/unused-using=true,> tsp compile . --no-linter,>

@azure-sdk-automation

azure-sdk-automation Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Invalid inherited rule options still block compilation even when CLI overrides replace or disable them.

1 open finding
What changed in this PR

Adds runtime-only linter overrides to the TypeSpec compiler CLI without modifying project configuration.

Changes:

  • Adds ruleset selection, per-rule overrides, and lint disabling.
  • Adds unit and end-to-end coverage.
  • Documents flags, precedence, and path resolution.
File Description
website/​src/​content/​docs/​docs/​handbook/​configuration/​configuration.mdx Documents override behavior.
website/​src/​content/​docs/​docs/​handbook/​cli.md Introduces linter flags.
packages/​compiler/​test/​e2e/​cli/​scenarios/​linter/​using-only.yaml Adds ruleset fixture.
packages/​compiler/​test/​e2e/​cli/​scenarios/​linter/​tspconfig.yaml Configures scenario linting and emission.
packages/​compiler/​test/​e2e/​cli/​scenarios/​linter/​main.tsp Supplies lint-triggering source.
packages/​compiler/​test/​e2e/​cli/​cli.e2e.ts Tests CLI behavior.
packages/​compiler/​test/​core/​linter.test.ts Updates diagnostic expectation.
packages/​compiler/​test/​cli.test.ts Tests override parsing and precedence.
packages/​compiler/​src/​core/​types.ts Clarifies file-reference documentation.
packages/​compiler/​src/​core/​program.ts Applies runtime overrides.
packages/​compiler/​src/​core/​options.ts Adds internal override options.
packages/​compiler/​src/​core/​messages.ts Adds flag diagnostics.
packages/​compiler/​src/​core/​linter.ts Updates origin commentary.
packages/​compiler/​src/​core/​cli/​cli.ts Registers linter flags.
packages/​compiler/​src/​core/​cli/​actions/​compile/​args.ts Parses and resolves overrides.
.chronus/​changes/​feat-cli-linter-config-2026-9-14-22-11-54.md Announces the feature.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/compiler/src/core/program.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No blocking issues remain, and regression coverage addresses precedence, invalid inputs, and emitter preservation.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 15, 2026 14:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved blocking issues remain, and regression coverage addresses precedence, inherited options, validation, and preserved compiler behavior.

0 open findings

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 15, 2026 14:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No blocking issues remain, and focused regression tests cover precedence and diagnostic preservation; tests were not executed.

0 open findings

🧠 Review effort: Balanced

This branch has not been deployed

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

Labels

compiler:core Issues for @typespec/compiler meta:website TypeSpec.io updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants