Skip to content

fix: migrate from deprecated tseslint.config to eslint/config#15409

Open
JoshuaKGoldberg wants to merge 2 commits intomicrosoft:mainfrom
JoshuaKGoldberg:tseslint-touchups
Open

fix: migrate from deprecated tseslint.config to eslint/config#15409
JoshuaKGoldberg wants to merge 2 commits intomicrosoft:mainfrom
JoshuaKGoldberg:tseslint-touchups

Conversation

@JoshuaKGoldberg
Copy link

@JoshuaKGoldberg JoshuaKGoldberg commented Mar 19, 2026

Description

Switches from the deprecated tseslint.config() to ESLint core's defineConfig(). I also threw in some little touchups here and there for fun, but I can split those out if you prefer. 😄

Fixes #15408.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes (existing tests)
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

I know #15408 hasn't been triaged yet, but figured this was a straightforward change 🙂 apologies if I've broken some unspoken etiquette rule.

Copilot AI review requested due to automatic review settings March 19, 2026 22:40
@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15409

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15409"

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Mar 19, 2026
export default tseslint.config(
{ ignores: ['dist'] },
export default defineConfig(
globalIgnores(['dist']),
Copy link
Author

Choose a reason for hiding this comment

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

[Explanation] As part of the move to eslint/config's helpers, we've seen users have a much easier time understanding configs with globalIgnores vs. the "object that just has ignores" equivalent. The two do the same thing.

globalIgnores(['dist']),
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
extends: [js.configs.recommended, tseslint.configs.recommended],
Copy link
Author

Choose a reason for hiding this comment

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

...

[Explanation] This ... is unnecessary.

extends: [js.configs.recommended, tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
Copy link
Author

Choose a reason for hiding this comment

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

[Explanation] In ESLint flat config, ecmaVersion defaults to "latest". Which is great in particular for TypeScript users: TypeScript will already catch any too-new-for-the-target-runtime syntax. There's no need to explicitly go back five ecmaVersions.

languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
Copy link
Author

Choose a reason for hiding this comment

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

[Explanation] This is inferred from the ESLint config path now! A relatively recent quality-of-life improvement / simplification on the typescript-eslint side: typescript-eslint/typescript-eslint#11370

@JoshuaKGoldberg
Copy link
Author

@dotnet-policy-service agree

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Aspire’s TypeScript/React template ESLint flat configs to use ESLint core’s defineConfig() (via eslint/config) instead of the deprecated tseslint.config() helper, aligning templates with current ESLint guidance (fixes #15408).

Changes:

  • Migrated multiple eslint.config.* files from tseslint.config() to defineConfig() and introduced globalIgnores() for global ignore patterns.
  • Removed tsconfigRootDir: import.meta.dirname from TypeScript AppHost ESLint configs used by scaffolding/templates.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Aspire.ProjectTemplates/templates/aspire-ts-cs-starter/frontend/eslint.config.js Switches to defineConfig() + globalIgnores() for the TS/React starter template.
src/Aspire.ProjectTemplates/templates/aspire-py-starter/frontend/eslint.config.js Switches to defineConfig() + globalIgnores() for the Python starter’s frontend template.
src/Aspire.Hosting.CodeGeneration.TypeScript/TypeScriptLanguageSupport.cs Updates scaffolded TypeScript AppHost ESLint config by removing tsconfigRootDir.
src/Aspire.Cli/Templating/Templates/ts-starter/frontend/eslint.config.js Switches the CLI TS starter frontend ESLint config to defineConfig() + globalIgnores().
src/Aspire.Cli/Templating/Templates/ts-starter/eslint.config.mjs Removes tsconfigRootDir from the TS AppHost ESLint config template.
playground/FoundryAgentEnterprise/frontend/eslint.config.js Switches playground frontend ESLint config to defineConfig() + globalIgnores().

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@adamint adamint self-assigned this Mar 20, 2026
@adamint adamint added this to the 13.2.x milestone Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provided ESLint configs use deprecated tseslint.config, not eslint/config's defineConfig

3 participants