Skip to content

Meta: fix some no-optional-chaining lint issues#9399

Merged
fregante merged 4 commits into
mainfrom
no-optional-chaining
May 9, 2026
Merged

Meta: fix some no-optional-chaining lint issues#9399
fregante merged 4 commits into
mainfrom
no-optional-chaining

Conversation

@fregante
Copy link
Copy Markdown
Member

@fregante fregante commented May 9, 2026

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

$optional restored with comment

'Confirm bypass rules and merge (squash)',
].includes(textContent)
) {
if (!/squash/i.test($(confirmMergeButton).textContent)) {
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.

/sq/i will also work. However, that doesn't mean we should use it. It's very unlikely these labels will change anytime soon, so let's keep it safe

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

let's keep it safe

What failure type are you expecting from look for "squash" string in "merge button label"?

'Confirm bypass rules and merge (squash)',
].includes(textContent)
) {
if (!/squash/i.test($(confirmMergeButton).textContent)) {
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.

Let's share the logic with sync-pr-commit-title instead of duplicating it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If I have to restore $optional I don’t think it can be shared

$optional('[aria-checked="true"]', menu)?.setAttribute('aria-checked', 'false');
currentFilter.setAttribute('aria-checked', 'true');
}
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Dead code from #5090

event.currentTarget.blur();

// Prevent multiple clicks
event.currentTarget.disabled = true;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In this case we'll also get events for the hidden hotkey button, but there's no drawbacks in temporarily disabling that one too.

}

const commitSha = await getLatestCommitToFile(url.branch, url.filePath);
if (!commitSha) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

A file exists, so its commit also exists

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

$optional restored with comment

@fregante fregante changed the title Meta: fix some no-optional-chaining issues Meta: fix some no-optional-chaining lint issues May 9, 2026
@github-actions github-actions Bot added the meta Related to Refined GitHub itself label May 9, 2026
@fregante fregante mentioned this pull request May 9, 2026
@fregante fregante marked this pull request as ready for review May 9, 2026 09:58
@fregante
Copy link
Copy Markdown
Member Author

fregante commented May 9, 2026

Should be good as a first pass

@fregante
Copy link
Copy Markdown
Member Author

fregante commented May 9, 2026

Merging. If you find further tweaks please include them in https://github.com/refined-github/refined-github/tree/code-tweaks-and-fixes

@fregante fregante merged commit 30246ce into main May 9, 2026
13 checks passed
@fregante fregante deleted the no-optional-chaining branch May 9, 2026 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta Related to Refined GitHub itself

Development

Successfully merging this pull request may close these issues.

2 participants