Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[backport] [CNA] use linter preference (#83194)#84087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
devjiwonchoi merged 1 commit intonext-15-5frombackport-next-15-5-83194
Sep 22, 2025

Conversation

@devjiwonchoi
Copy link
Member

backports#83194

@ijjkijjk added create-next-appRelated to our CLI tool for quickly starting a new Next.js application. created-by: Next.js teamPRs by the Next.js team. labelsSep 22, 2025
@devjiwonchoidevjiwonchoi marked this pull request as ready for reviewSeptember 22, 2025 15:28
@ijjk
Copy link
Member

ijjk commentedSep 22, 2025
edited
Loading

Tests Passed

initial:
linterIndexMap[
getPrefOrDefault('linter')askeyoftypeoflinterIndexMap
],
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
],
]??0,

The code could fail if the user's linter preference contains an unexpected value, causingundefined to be passed as the initial prompt selection.

View Details

Analysis

Undefined initial value passed to prompts when linter preference is invalid

What fails: ThelinterIndexMap lookup inpackages/create-next-app/index.ts:321-324 returnsundefined whengetPrefOrDefault('linter') returns a value not in the map ('eslint', 'biome', 'none'), causing the prompts library to receiveinitial: undefined.

How to trigger:

  1. Create or modify the create-next-app config with an invalid linter preference:
# Edit ~/.config/create-next-app/config.json to contain:{"preferences": {"linter":"invalid-value"}}
  1. Run create-next-app without CLI linter flags to trigger the interactive prompt

Result: The prompts library receivesinitial: undefined instead of a valid array index, leading to unpredictable default selection behavior.

Expected: Should default to a valid index (0 = ESLint) when the preference value is not recognized, ensuring consistent user experience.

Fix applied: Added nullish coalescing operator?? 0 to provide fallback to first option (ESLint) when lookup returns undefined.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

We will get at least a default value so wouldn't be undefined

@devjiwonchoidevjiwonchoi merged commitb6a32bb intonext-15-5Sep 22, 2025
262 of 265 checks passed
@devjiwonchoidevjiwonchoi deleted the backport-next-15-5-83194 branchSeptember 22, 2025 18:10
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsOct 7, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@vercelvercel[bot]vercel[bot] left review comments

@ijjkijjkijjk approved these changes

@ztannerztannerAwaiting requested review from ztanner

Assignees

No one assigned

Labels

create-next-appRelated to our CLI tool for quickly starting a new Next.js application.created-by: Next.js teamPRs by the Next.js team.locked

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@devjiwonchoi@ijjk

[8]ページ先頭

©2009-2025 Movatter.jp