From 251124e611220d1eb6016a86b35c70bad6d2c9c0 Mon Sep 17 00:00:00 2001 From: Grigory Date: Sun, 5 Apr 2026 13:41:22 +0500 Subject: [PATCH 01/79] `linkify-user-edit-history-popup` - Drop feature (#9161) --- build/__snapshots__/features-meta.json | 5 --- build/__snapshots__/imported-features.json | 1 - readme.md | 1 - .../linkify-user-edit-history-popup.tsx | 36 ------------------- source/refined-github.ts | 1 - 5 files changed, 44 deletions(-) delete mode 100644 source/features/linkify-user-edit-history-popup.tsx diff --git a/build/__snapshots__/features-meta.json b/build/__snapshots__/features-meta.json index 3d48ade8b331..3ad979ad474f 100644 --- a/build/__snapshots__/features-meta.json +++ b/build/__snapshots__/features-meta.json @@ -421,11 +421,6 @@ "description": "Makes certain text clickable, like issue references in the issue title and discussion sidebar.", "screenshot": "https://github.com/user-attachments/assets/1d31f695-c198-477e-a3ae-cc0687417a90" }, - { - "id": "linkify-user-edit-history-popup", - "description": "Linkifies the username in the edit history popup.", - "screenshot": "https://user-images.githubusercontent.com/1402241/88917988-9ebb7480-d260-11ea-8690-0a3440f1ebbc.png" - }, { "id": "linkify-user-labels", "description": "Links the \"Contributor\", \"Member\" and \"Collaborator\" labels on comments to the author’s commits on the repo.", diff --git a/build/__snapshots__/imported-features.json b/build/__snapshots__/imported-features.json index 9c3d37179aaf..3e264d9fca9e 100644 --- a/build/__snapshots__/imported-features.json +++ b/build/__snapshots__/imported-features.json @@ -78,7 +78,6 @@ "linkify-line-numbers", "linkify-symbolic-links", "linkify-text", - "linkify-user-edit-history-popup", "linkify-user-labels", "linkify-user-location", "list-prs-for-branch", diff --git a/readme.md b/readme.md index 41219adad42b..5762105456e0 100644 --- a/readme.md +++ b/readme.md @@ -368,7 +368,6 @@ https://github.com/refined-github/refined-github/wiki/Contributing#metadata-guid - [](# "reload-failed-proxied-images") [Retries downloading images that failed downloading due to GitHub limited proxying.](https://user-images.githubusercontent.com/14858959/64068746-21991100-cc45-11e9-844e-827f5ac9b51e.png) - [](# "unwrap-unnecessary-dropdowns") [Makes some dropdowns 1-click instead of unnecessarily 2-click.](https://github-production-user-asset-6210df.s3.amazonaws.com/83146190/258554504-97d4079a-2aae-4aea-a870-653a267494a8.png) - [](# "prevent-link-loss") [Suggests fixing links that are wrongly shortened by GitHub.](https://github-production-user-asset-6210df.s3.amazonaws.com/83146190/260087535-a0f19995-5f4a-44e9-87d8-cf742b9bfeed.gif) -- [](# "linkify-user-edit-history-popup") [Linkifies the username in the edit history popup.](https://user-images.githubusercontent.com/1402241/88917988-9ebb7480-d260-11ea-8690-0a3440f1ebbc.png) - [](# "prevent-duplicate-pr-submission") [Avoids creating duplicate PRs when mistakenly clicking "Create pull request" more than once.](https://user-images.githubusercontent.com/16872793/89589967-e029c200-d814-11ea-962b-3ff1f6236781.gif) - [](# "command-palette-navigation-shortcuts") Adds keyboard shortcuts to select items in command palette using ctrl n and ctrl p (macOS only). - [](# "prevent-comment-loss") [While writing/editing comments, open the preview links in new tab instead of navigating away from the page.](https://user-images.githubusercontent.com/17681399/282616531-2befcabe-5c80-4b9a-bfb5-7b9917847bb5.gif) diff --git a/source/features/linkify-user-edit-history-popup.tsx b/source/features/linkify-user-edit-history-popup.tsx deleted file mode 100644 index 1da544378ee7..000000000000 --- a/source/features/linkify-user-edit-history-popup.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import React from 'dom-chef'; -import * as pageDetect from 'github-url-detection'; - -import {wrap} from '../helpers/dom-utils.js'; -import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; - -function linkify(avatar: HTMLImageElement): void { - const userName = avatar.alt.slice(1); - // Linkify name first - wrap(avatar.nextElementSibling!, ); - - // Then linkify avatar - wrap(avatar, ); -} - -function init(signal: AbortSignal): void { - observe('details-dialog .Box-header .mr-3 > img:not([alt*="[bot]"])', linkify, {signal}); -} - -void features.add(import.meta.url, { - include: [ - pageDetect.isConversation, - ], - init, -}); - -/* - -Test URLs: - -- User edits: https://github.com/refined-github/sandbox/issues/24#issue-1299932109 -- App edits: https://github.com/renovatebot/renovate/pull/30606#issue-2449330214 -- Ghost edits: https://github.com/Mottie/GitHub-userscripts/issues/88#issuecomment-502933879 - -*/ diff --git a/source/refined-github.ts b/source/refined-github.ts index c4a8acffb414..90f0faec22b4 100644 --- a/source/refined-github.ts +++ b/source/refined-github.ts @@ -142,7 +142,6 @@ import './features/pr-jump-to-first-non-viewed-file.js'; import './features/keyboard-navigation.js'; import './features/vertical-front-matter.js'; import './features/pr-first-commit-title.js'; -import './features/linkify-user-edit-history-popup.js'; import './features/clean-repo-filelist-actions.js'; import './features/prevent-duplicate-pr-submission.js'; import './features/quick-label-removal.js'; From 54492a6fe86262923af23ad939eb8ff0a6fc9282 Mon Sep 17 00:00:00 2001 From: Grigory Date: Mon, 6 Apr 2026 20:13:19 +0500 Subject: [PATCH 02/79] `easy-toggle-commit-messages` - Restore feature on compare pages (#9165) --- source/features/easy-toggle-commit-messages.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/features/easy-toggle-commit-messages.tsx b/source/features/easy-toggle-commit-messages.tsx index 4c840a3290b0..dd57593a836d 100644 --- a/source/features/easy-toggle-commit-messages.tsx +++ b/source/features/easy-toggle-commit-messages.tsx @@ -21,6 +21,7 @@ function toggleCommitMessage(event: DelegateEvent): void { $optional([ '[data-testid="commit-row-show-description-button"]', // Commit list '[data-testid="latest-commit-details-toggle"]', // File/folder + '.ellipsis-expander', // Compare ], event.delegateTarget)?.dispatchEvent( new MouseEvent('click', {bubbles: true, altKey: event.altKey}), ); @@ -29,6 +30,7 @@ function toggleCommitMessage(event: DelegateEvent): void { const commitMessagesSelector = [ '[data-testid="commit-row-item"]', '[data-testid="latest-commit"]', // Commit message in file tree header + '.js-commits-list-item', // Compare ]; function init(signal: AbortSignal): void { @@ -55,6 +57,7 @@ Test URLs: - Repo root: https://github.com/refined-github/sandbox/tree/254a81ef488dcb3866cf8a4cacde501d9faaa588 - Commit list: https://github.com/refined-github/refined-github/commits/main/?after=384131b0be3d4097f7cc633f76aecd43f1292471+69 - File/folder: https://github.com/refined-github/sandbox/tree/254a81ef488dcb3866cf8a4cacde501d9faaa588/.github/workflows +- Compare: https://github.com/refined-github/sandbox/compare/default-a...Dont-mess How to test: From f8bf2bb541fcd01cd4c4a3a1e6be3cb5e3aa498a Mon Sep 17 00:00:00 2001 From: SeongJaeSong <58547105+SeongJaeSong@users.noreply.github.com> Date: Tue, 7 Apr 2026 16:20:31 +0900 Subject: [PATCH 03/79] `highlight-non-default-base-branch` - Simplify query (#9168) --- .../features/highlight-non-default-base-branch.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/source/features/highlight-non-default-base-branch.tsx b/source/features/highlight-non-default-base-branch.tsx index 3ee91720174c..879ae1c0dcf2 100644 --- a/source/features/highlight-non-default-base-branch.tsx +++ b/source/features/highlight-non-default-base-branch.tsx @@ -5,8 +5,6 @@ import batchedFunction from 'batched-function'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import {buildRepoUrl} from '../github-helpers/index.js'; -import getDefaultBranch from '../github-helpers/get-default-branch.js'; import observe from '../helpers/selector-observer.js'; import {expectToken} from '../github-helpers/github-token.js'; import abbreviateString from '../helpers/abbreviate-string.js'; @@ -23,6 +21,8 @@ function isClosed(prLink: HTMLElement): boolean { function buildQuery(issueIds: string[]): string { return ` repository() { + nameWithOwner + defaultBranchRef {name} ${issueIds.map(id => ` ${id}: pullRequest(number: ${id.replaceAll(/\D/g, '')}) { baseRef {id} @@ -35,10 +35,8 @@ function buildQuery(issueIds: string[]): string { async function add(prLinks: HTMLElement[]): Promise { const query = buildQuery(prLinks.map(pr => pr.id)); - const [data, defaultBranch] = await Promise.all([ - api.v4(query), - getDefaultBranch(), - ]); + const data = await api.v4(query); + const defaultBranch = data.repository.defaultBranchRef?.name; for (const prLink of prLinks) { const pr: BranchInfo = data.repository[prLink.id]; @@ -52,7 +50,7 @@ async function add(prLinks: HTMLElement[]): Promise { continue; } - const branch = pr.baseRef && buildRepoUrl('tree', pr.baseRefName); + const branch = pr.baseRef && `/${data.repository.nameWithOwner}/tree/${pr.baseRefName}`; const displayName = abbreviateString(pr.baseRefName, 25); prLink.parentElement!.querySelector('.text-small.color-fg-muted .d-none.d-md-inline-flex')!.append( From 6e37a446bfff8c821ae77bdae1f6cb0b7a59386d Mon Sep 17 00:00:00 2001 From: Grigory Date: Tue, 7 Apr 2026 23:42:02 +0500 Subject: [PATCH 04/79] Improve compatibility with Firefox (#9171) --- .github/workflows/release.yml | 2 +- package-lock.json | 11 +++++------ package.json | 2 +- source/options/reload-without.ts | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 318e62807556..fe5cf88839eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,7 +67,7 @@ jobs: steps: - uses: actions/download-artifact@v8 - name: Create release notes - run: echo "{\"release_notes\":{\"en-US\":\"https://github.com/${{ github.repository }}/releases/tag/${{ needs.Version.outputs.version }}\"}}" > /tmp/amo-metadata.json + run: echo "{\"version\":{\"release_notes\":{\"en-US\":\"https://github.com/${{ github.repository }}/releases/tag/${{ needs.Version.outputs.version }}\"}}}" > /tmp/amo-metadata.json - name: Upload build and source code run: npx web-ext@9 sign --channel listed --amo-metadata /tmp/amo-metadata.json env: diff --git a/package-lock.json b/package-lock.json index d97bfafb7a03..bb74ff54bb52 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,7 +41,7 @@ "uint8array-extras": "^1.5.0", "webext-alert": "^1.1.0", "webext-base-css": "^2.1.0", - "webext-bugs": "^1.1.1", + "webext-bugs": "^2.0.1", "webext-content-scripts": "^2.7.2", "webext-detect": "^5.3.1", "webext-dynamic-content-scripts": "^10.0.4", @@ -10632,15 +10632,14 @@ } }, "node_modules/webext-bugs": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/webext-bugs/-/webext-bugs-1.1.1.tgz", - "integrity": "sha512-9WrxICnaV6fBibJ29MUxib9WsaVNhPn/CKwqZUJJgXhNeaIECJNcSge/tif7AxVCFxFuC8YZNb4XDzDgS7oseg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/webext-bugs/-/webext-bugs-2.0.1.tgz", + "integrity": "sha512-M3Yn7lK+HjnNZL54INAvYmuphETgF9HxrJET4Q7q20jfC1HWSqWxfti4reRsOuKJWh8m0sXIyws3pMnmCsOBcA==", "license": "MIT", "dependencies": { "filter-altered-clicks": "^2.1.1", - "webext-alert": "^1.0.3", + "webext-alert": "^1.1.0", "webext-detect": "^5.3.2", - "webext-polyfill-kinda": "^1.0.2", "webext-tools": "^3.0.0" }, "engines": { diff --git a/package.json b/package.json index 28fc48070e47..e61c22af17a0 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "uint8array-extras": "^1.5.0", "webext-alert": "^1.1.0", "webext-base-css": "^2.1.0", - "webext-bugs": "^1.1.1", + "webext-bugs": "^2.0.1", "webext-content-scripts": "^2.7.2", "webext-detect": "^5.3.1", "webext-dynamic-content-scripts": "^10.0.4", diff --git a/source/options/reload-without.ts b/source/options/reload-without.ts index 96cf8ad3ac50..4b4bb0c05f75 100644 --- a/source/options/reload-without.ts +++ b/source/options/reload-without.ts @@ -1,11 +1,11 @@ import {StorageItem} from 'webext-storage'; import webextAlert from 'webext-alert'; import {isScriptableUrl} from 'webext-content-scripts'; -import {isFirefox} from 'webext-detect'; import {createContextMenu} from 'webext-tools'; // Always Firefox… https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/storage/StorageArea/setAccessLevel -const area = isFirefox() ? 'local' : 'session'; +// Don't use `isFirefox` - #9065 +const area = chrome.storage.session?.setAccessLevel === undefined ? 'local' : 'session'; export const contentScriptToggle = new StorageItem('contentScript', { area, From 60be4b7f74b1a85f1979effde7597d6ec9a8a6a5 Mon Sep 17 00:00:00 2001 From: Grigory Date: Sun, 12 Apr 2026 18:27:36 +0500 Subject: [PATCH 05/79] Show PR reviews on mobile (#9178) --- source/refined-github.css | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/source/refined-github.css b/source/refined-github.css index 7543cf3058c1..7f81fb059cb2 100644 --- a/source/refined-github.css +++ b/source/refined-github.css @@ -208,3 +208,25 @@ div[data-target='readme-toc.content'] div.blob-wrapper img { /* For debugging */ /* color: red !important; */ } + +/* Show PR reviews on mobile */ +/* Info: https://github.com/refined-github/refined-github/issues/9074 */ +/* Test (no CI checks): https://github.com/refined-github/sandbox/pulls?q=is%3Apr+review%3Aapproved */ +/* Test: https://github.com/refined-github/refined-github/pulls?q=is%3Apr+review%3Aapproved */ +@media (max-width: 768px) { + .js-issue-row .markdown-title ~ .d-flex { + flex-direction: column; + + .d-md-inline-flex { + display: inline-flex !important; + /* Hide [•] 1 review approval*/ + font-size: 0; + a { + font-size: 12px; + } + .ml-1 { + margin-left: 0 !important; + } + } + } +} From 1b470e06f1edca1977acdde97fc956044dcd8a2c Mon Sep 17 00:00:00 2001 From: Grigory Date: Mon, 13 Apr 2026 21:28:00 +0500 Subject: [PATCH 06/79] Fix Watch/Unwatch button height on mobile (#9189) --- source/features/github-bugs.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/features/github-bugs.css b/source/features/github-bugs.css index e1201f6afb24..9d710015729c 100644 --- a/source/features/github-bugs.css +++ b/source/features/github-bugs.css @@ -153,6 +153,14 @@ div[class^='prc-PageHeader-Description'] } } +/* Fix Watch/Unwatch button height on mobile */ +/* Info: https://github.com/refined-github/refined-github/issues/9183 */ +/* Test: https://github.com/refined-github/refined-github */ +#responsive-meta-container + button[data-testid='notifications-subscriptions-menu-button'] { + height: 32px; +} + /* Test URLs: From ac9dacfd4b191151dc43a8b35ac420025208ebcf Mon Sep 17 00:00:00 2001 From: Grigory Date: Mon, 13 Apr 2026 21:34:12 +0500 Subject: [PATCH 07/79] `parse-backticks` - Handle linked PR titles (#9191) --- source/features/parse-backticks.css | 4 ++++ source/features/parse-backticks.tsx | 2 ++ 2 files changed, 6 insertions(+) diff --git a/source/features/parse-backticks.css b/source/features/parse-backticks.css index 7f3a8e456a48..a4aad1c69e8c 100644 --- a/source/features/parse-backticks.css +++ b/source/features/parse-backticks.css @@ -8,4 +8,8 @@ font-size: 85%; margin: 0; padding: 0.2em 0.4em; + + &:is(span[class^='LinkedPullRequests'] > *) { + font-size: 95%; + } } diff --git a/source/features/parse-backticks.tsx b/source/features/parse-backticks.tsx index 26b3f1f7fd04..c87b2fb805f4 100644 --- a/source/features/parse-backticks.tsx +++ b/source/features/parse-backticks.tsx @@ -20,6 +20,8 @@ const selectors = [ // `isIssue` linked PRs // https://github.com/refined-github/refined-github/issues/7856 + 'span[class^="LinkedPullRequests-module__PrTitle"]', + // TODO: Drop in October 2026 'span[id$="--label"]', // `isPRFiles` sticky header PR title From 3e5dc1fe5293af9152297f74ecc4e64f5b9171cd Mon Sep 17 00:00:00 2001 From: Grigory Date: Mon, 13 Apr 2026 21:38:54 +0500 Subject: [PATCH 08/79] Fix PR title width on small & medium screens (#9181) --- source/features/github-bugs.css | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source/features/github-bugs.css b/source/features/github-bugs.css index 9d710015729c..a63978910a67 100644 --- a/source/features/github-bugs.css +++ b/source/features/github-bugs.css @@ -161,6 +161,22 @@ div[class^='prc-PageHeader-Description'] height: 32px; } +/* Fix PR title width on small & medium screens */ +/* Info: https://github.com/refined-github/refined-github/issues/9180 */ +/* Test: https://github.com/refined-github/refined-github/pull/9179/changes */ +react-app[app-name='pull-requests'] { + @media (max-width: 1011px) { + div[class^='prc-PageHeader-TitleArea'] { + grid-area: 2 / 1 / auto / -1; + } + } + @container (width <= 1011px) { + div[class^='prc-PageHeader-TitleArea'] { + grid-area: 2 / 1 / auto / -1; + } + } +} + /* Test URLs: From 94bad2cb6b99b7273218c7e7537baf22c72d749d Mon Sep 17 00:00:00 2001 From: Floh <48927090+Flohhhhh@users.noreply.github.com> Date: Tue, 14 Apr 2026 02:38:22 -0400 Subject: [PATCH 09/79] `file-age-color` - Dim older files (#9162) Co-authored-by: fregante --- source/features/file-age-color.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/features/file-age-color.tsx b/source/features/file-age-color.tsx index e489ce335e7a..ac0f8c5183f0 100644 --- a/source/features/file-age-color.tsx +++ b/source/features/file-age-color.tsx @@ -11,12 +11,19 @@ import features from '../feature-manager.js'; import {createHeatIndexFunction} from '../helpers/math.js'; const calculateHeatIndex = createHeatIndexFunction([0, -2_000_000_000]); +const month = 30 * 24 * 60 * 60 * 1000; function addHeatIndex(lastUpdateElement: HTMLElement): void { // `datetime` attribute used by pre-React version const lastUpdate = new Date(lastUpdateElement.getAttribute('datetime') ?? lastUpdateElement.title); const diff = Date.now() - lastUpdate.getTime(); + // Dim files older than 4 months; dimmer after 12 + if (diff > 4 * month) { + lastUpdateElement.style.opacity = diff > 12 * month ? '0.6' : '0.8'; + return; + } + lastUpdateElement.setAttribute('data-rgh-heat', String(calculateHeatIndex(-diff))); } From a5108df8fc830272b3be97380e64c18aae2fe183 Mon Sep 17 00:00:00 2001 From: Grigory Date: Tue, 14 Apr 2026 11:39:16 +0500 Subject: [PATCH 10/79] `quick-review` - Enhance native "Add your review" button (#9192) --- source/features/quick-review.tsx | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/source/features/quick-review.tsx b/source/features/quick-review.tsx index f68c8dc5757f..35b1cd0fd6ea 100644 --- a/source/features/quick-review.tsx +++ b/source/features/quick-review.tsx @@ -23,6 +23,9 @@ const emojis = ['🚀', '🐿️', '⚡️', '🤌', '🥳', '🥰', '🤩', ' // Be careful not to select the "Submit review" button in the dialog const reviewMenuButtonSelector = 'button[class*="ReviewMenuButton-module__ReviewMenuButton"]'; +const openReviewMenuDeepLink = 'review-changes-modal'; +const openReviewMenuDeepLinkSelector = `#${openReviewMenuDeepLink}`; + async function quickApprove(event: DelegateEvent): Promise { const approval = event.altKey ? '' : prompt('Approve instantly? You can add a custom message or leave empty'); if (approval === null) { @@ -47,7 +50,7 @@ async function quickApprove(event: DelegateEvent): Promise { async function addSidebarReviewButton(reviewersSection: Element): Promise { const reviewFormUrl = new URL(location.href); reviewFormUrl.pathname += '/files'; - reviewFormUrl.hash = 'review-changes-modal'; + reviewFormUrl.hash = openReviewMenuDeepLink; // Occasionally this button appears before "Reviewers", so let's wait a bit longer await delay(300); @@ -86,6 +89,17 @@ async function initSidebarReviewButton(signal: AbortSignal): Promise { delegate('.rgh-quick-approve', 'click', quickApprove, {signal}); } +function initNativeReviewButton(signal: AbortSignal): void { + observe('section[aria-label="Review Request Banner"] a[type="button"]', enhanceNativeReviewButton, {signal}); +} + +function enhanceNativeReviewButton(button: HTMLAnchorElement): void { + // Clone button to remove GitHub's event listeners, which interfere with ours + const clonedButton = button.cloneNode(true); + clonedButton.hash = openReviewMenuDeepLink; + button.replaceWith(clonedButton); +} + function focusReviewTextarea(event: DelegateEvent): void { if ('newState' in event && event.newState === 'open') { $('textarea', event.delegateTarget).focus(); @@ -93,7 +107,7 @@ function focusReviewTextarea(event: DelegateEvent): void { } async function initReviewButtonEnhancements(signal: AbortSignal): Promise { - delegate('#review-changes-modal', 'toggle', focusReviewTextarea, {capture: true, signal}); + delegate(openReviewMenuDeepLinkSelector, 'toggle', focusReviewTextarea, {capture: true, signal}); const reviewDropdownButton = await elementReady([ reviewMenuButtonSelector, @@ -117,7 +131,7 @@ function initNativeDeepLinking(signal: AbortSignal): void { observe(reviewMenuButtonSelector, openReviewDialog, {signal}); // Old view -- TODO: Drop in the fall of 2026 // Cannot target the [popover] itself because observe() can't see hidden elements - observe('[popovertarget="review-changes-modal"]', openReviewPopup, {signal}); + observe(`[popovertarget="${openReviewMenuDeepLink}"]`, openReviewPopup, {signal}); } void features.add(import.meta.url, { @@ -125,6 +139,11 @@ void features.add(import.meta.url, { pageDetect.isPRConversation, ], init: initSidebarReviewButton, +}, { + include: [ + pageDetect.isPRConversation, + ], + init: initNativeReviewButton, }, { shortcuts: { v: 'Open PR review popup', @@ -135,7 +154,7 @@ void features.add(import.meta.url, { init: initReviewButtonEnhancements, }, { asLongAs: [ - () => location.hash === '#review-changes-modal', + () => location.hash === openReviewMenuDeepLinkSelector, pageDetect.isPRFiles, ], init: initNativeDeepLinking, @@ -147,5 +166,6 @@ Test URLs: - Open PR (review, approve) https://github.com/refined-github/sandbox/pull/10 - Closed PR (only review) https://github.com/refined-github/sandbox/pull/26 +- PRs with your review requested: https://github.com/pulls/review-requested */ From 7a58ced2277281fc6f2eb1dd8a1b646cad21f107 Mon Sep 17 00:00:00 2001 From: Ezra Ashenafi Date: Tue, 14 Apr 2026 09:41:48 +0300 Subject: [PATCH 11/79] `releases-tab` - Register hotkey explicitly as workaround for #8867 (#9164) --- source/features/releases-tab.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/features/releases-tab.tsx b/source/features/releases-tab.tsx index cb9da6b3121e..e7824743371e 100644 --- a/source/features/releases-tab.tsx +++ b/source/features/releases-tab.tsx @@ -20,6 +20,7 @@ import {appendBefore} from '../helpers/dom-utils.js'; import {repoUnderlineNavUl, repoUnderlineNavDropdownUl} from '../github-helpers/selectors.js'; import GetReleasesCount from './releases-tab.gql'; import {expectToken} from '../github-helpers/github-token.js'; +import {registerHotkey} from '../github-helpers/hotkey.js'; function detachHighlightFromCodeTab(codeTab: HTMLAnchorElement): void { codeTab.dataset.selectedLinks = codeTab.dataset.selectedLinks!.replace('repo_releases ', ''); @@ -112,6 +113,9 @@ async function init(signal: AbortSignal): Promise { observe(repoUnderlineNavUl, addReleasesTab, {signal}); observe(repoUnderlineNavDropdownUl, addReleasesDropdownItem, {signal}); observe(['[data-menu-item="i0code-tab"] a', 'a#code-tab'], detachHighlightFromCodeTab, {signal}); + // Workaround for #8867 + // TODO: remove once the issue is resolved + registerHotkey('g r', buildRepoUrl('releases'), {signal}); } void features.add(import.meta.url, { From 0500c2c446ead7b411dcaaedd56eb8dd4389698e Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 15:23:31 +0700 Subject: [PATCH 12/79] `conversation-authors` - Disable collaborator highlighting on PRs (#9194) Co-authored-by: fregante <1402241+fregante@users.noreply.github.com> Co-authored-by: Grigory --- source/features/conversation-authors.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/source/features/conversation-authors.tsx b/source/features/conversation-authors.tsx index 8afb3b10d561..b11f8868dd2d 100644 --- a/source/features/conversation-authors.tsx +++ b/source/features/conversation-authors.tsx @@ -23,11 +23,7 @@ const collaborators = new CachedFunction('repo-collaborators', { async function highlightCollaborators(signal: AbortSignal): Promise { await expectToken(); const list = await collaborators.get(); - observe([ - // Old issue lists - TODO: Drop in 2026 - '.js-issue-row [data-hovercard-type="user"]', - 'a[class^="IssueItem-module__authorCreatedLink"]', - ], author => { + observe('a[class^="IssueItem-module__authorCreatedLink"]', author => { const name = author.textContent.trim(); if (list.includes(name) && name !== getLoggedInUser()) { author.classList.add('rgh-collaborator'); @@ -38,7 +34,7 @@ async function highlightCollaborators(signal: AbortSignal): Promise { function highlightSelf(signal: AbortSignal): void { // "Opened by {user}" and "Created by {user}" observe([ - // Old issue lists - TODO: Drop in 2026 + // PRs - TODO: Drop in 2026 `.opened-by a[title$="ed by ${CSS.escape(getLoggedInUser()!)}"]`, `a[class^="IssueItem-module__authorCreatedLink"][data-hovercard-url="/users/${CSS.escape(getLoggedInUser()!)}/hovercard"]`, ], author => { @@ -48,7 +44,7 @@ function highlightSelf(signal: AbortSignal): void { void features.add(import.meta.url, { include: [ - pageDetect.isRepoIssueOrPRList, + pageDetect.isRepoIssueList, ], init: highlightCollaborators, }, { @@ -63,6 +59,6 @@ void features.add(import.meta.url, { Test URLs: https://github.com/issues -https://github.com/refined-github/refined-github/pulls +https://github.com/refined-github/refined-github/issues */ From d11c14eebee18687b582dbdbd17675a720ac58ed Mon Sep 17 00:00:00 2001 From: Calvin Magezi Date: Wed, 15 Apr 2026 19:12:35 +0300 Subject: [PATCH 13/79] `same-page-links` - Update feature (#9195) Co-authored-by: Grigory --- package-lock.json | 16 ++++++++-------- package.json | 2 +- source/features/same-page-links.tsx | 22 ++++++++++++++-------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index bb74ff54bb52..fac2255dfdfa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "fit-textarea": "^2.0.0", "flat-zip": "^1.0.1", "github-reserved-names": "^2.1.1", - "github-url-detection": "^11.1.3", + "github-url-detection": "^11.2.1", "indent-textarea": "^4.0.0", "js-abbreviation-number": "^1.4.0", "linkify-issues": "^4.2.0", @@ -5806,18 +5806,18 @@ } }, "node_modules/github-reserved-names": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/github-reserved-names/-/github-reserved-names-2.1.1.tgz", - "integrity": "sha512-p8eMxZksQzh/z1awZz7NniSODL2QphpmpKNfGqPiN+BA/YjUaNtHkZoxK+kk/GP6go4imM1jprU0JAQG4tJ2mg==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/github-reserved-names/-/github-reserved-names-2.1.3.tgz", + "integrity": "sha512-/Ba658MDdVXkPn2oXdfBQFD8MMuTADQyGCAq4jhoisz5sVjCN6AQaSFVSii81bnP4m7yV7ezlDLJ7KHN/T/3vg==", "license": "MIT" }, "node_modules/github-url-detection": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/github-url-detection/-/github-url-detection-11.1.3.tgz", - "integrity": "sha512-yIi7NJ34EYfwX7o3GhxlJKqflQsVq/CiOI8Q1DtQgQ22kaaodua4+efJ51GSLynhVx/fCweW8BIKVHvtBQV/WQ==", + "version": "11.2.1", + "resolved": "https://registry.npmjs.org/github-url-detection/-/github-url-detection-11.2.1.tgz", + "integrity": "sha512-lxmDkx8v/uGB7u1hCgT5udLgnxNhhahE0ehYlbrM+T23aTU5fPfzfx2jswmuvcoW2Mdf7deYi6fZ4PmN6Zam/Q==", "license": "MIT", "dependencies": { - "github-reserved-names": "^2.1.1" + "github-reserved-names": "^2.1.3" }, "engines": { "node": ">=22.18" diff --git a/package.json b/package.json index e61c22af17a0..1077e1581d8e 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "fit-textarea": "^2.0.0", "flat-zip": "^1.0.1", "github-reserved-names": "^2.1.1", - "github-url-detection": "^11.1.3", + "github-url-detection": "^11.2.1", "indent-textarea": "^4.0.0", "js-abbreviation-number": "^1.4.0", "linkify-issues": "^4.2.0", diff --git a/source/features/same-page-links.tsx b/source/features/same-page-links.tsx index f36985522f3c..3046a54ce0d6 100644 --- a/source/features/same-page-links.tsx +++ b/source/features/same-page-links.tsx @@ -8,15 +8,19 @@ function fix(button: HTMLAnchorElement): void { } function init(signal: AbortSignal): void { - observe([ - '[data-testid="state-reason-link"] + [target="_blank"]', // "Closing issue" link - '[data-testid="issue-metadata-fixed"] [target="_blank"]', // Reference PR link in issue header - '[data-testid^="timeline-row-border"] [target="_blank"]', // Commit linkbacks in PRs - ], fix, {signal}); + observe(`a[target="_blank"]:is(${[ + '[class^="ClosedEvent-module__closerLink"]', // "Closing issue" link + '[class^="LinkedPullRequest-module__pullRequestLink"]', // Linked PR links in issue headers + '[class^="prc-ActionList-ActionListContent"][aria-keyshortcuts="#"]', // Linked PR links in issue header menu + 'ul[data-testid="issue-viewer-linked-pr-container"] *', // Linked PR and release links on issue sidebar + '[class^="ReferencedEventInner-module__commitHashLink"]', // Commit linkbacks on issue timeline + 'div[data-testid="list-row-linked-pull-requests"] > *', // Linked PRs on issue list + ].join(',')})`, fix, {signal}); } void features.add(import.meta.url, { include: [ + pageDetect.isIssueList, pageDetect.isIssue, ], init, @@ -26,7 +30,9 @@ void features.add(import.meta.url, { Test URLs -- "Closing issue" link https://github.com/refined-github/refined-github/issues/8346#event-16947543136 -- "Reference PR link" https://github.com/refined-github/refined-github/pull/8367 -- "Commit Linkbacks" https://github.com/sindresorhus/np/issues/82#event-22200037448, https://github.com/cli/cli/issues/10238 +- "Closing issue" link: https://github.com/refined-github/refined-github/issues/8346#event-16947543136 +- Linked PR links on issue page: https://github.com/refined-github/refined-github/issues/8346 +- Linked PR links in issue header menu: https://github.com/refined-github/sandbox/issues/130 +- Commit linkbacks: https://github.com/sindresorhus/np/issues/82#event-22200037448, https://github.com/cli/cli/issues/10238 +- Linked PRs on issue list: https://github.com/refined-github/refined-github/issues?q=is%3Aissue%20has%3Alinked%20reason%3Acompleted */ From 5d588a09f7e0970d4c878e55018db26c692fd937 Mon Sep 17 00:00:00 2001 From: Grigory Date: Wed, 15 Apr 2026 21:15:45 +0500 Subject: [PATCH 14/79] `linkify-user-labels` - Expand to PR list (#9175) --- build/__snapshots__/features-meta.json | 2 +- readme.md | 2 +- source/features/linkify-user-labels.tsx | 21 +++++++++++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/build/__snapshots__/features-meta.json b/build/__snapshots__/features-meta.json index 3ad979ad474f..6c0f65e2b7b3 100644 --- a/build/__snapshots__/features-meta.json +++ b/build/__snapshots__/features-meta.json @@ -423,7 +423,7 @@ }, { "id": "linkify-user-labels", - "description": "Links the \"Contributor\", \"Member\" and \"Collaborator\" labels on comments to the author’s commits on the repo.", + "description": "Links the \"Contributor\", \"Member\" and \"Collaborator\" labels on comments and PRs to the author’s commits on the repo.", "css": true, "screenshot": "https://user-images.githubusercontent.com/1402241/177033344-4d4eea63-e075-4096-b2d4-f4b879f1df31.png" }, diff --git a/readme.md b/readme.md index 5762105456e0..b18fad775301 100644 --- a/readme.md +++ b/readme.md @@ -211,7 +211,7 @@ https://github.com/refined-github/refined-github/wiki/Contributing#metadata-guid - [](# "dim-bots") [Dims commits and PRs by bots to reduce noise.](https://user-images.githubusercontent.com/1402241/220607557-f8ea0863-f05b-48c8-a447-1fec42af0afd.gif) - [](# "esc-to-cancel") [Adds a shortcut to cancel editing a issue/PR title: esc.](https://user-images.githubusercontent.com/35100156/98303086-d81d2200-1fbd-11eb-8529-70d48d889bcf.gif) - [](# "no-duplicate-list-update-time") [Hides the update time of issues/PRs in lists when it matches the open/closed/merged time.](https://user-images.githubusercontent.com/1402241/111357166-ac3a3900-864e-11eb-884a-d6d6da88f7e2.png) -- [](# "linkify-user-labels") [Links the "Contributor", "Member" and "Collaborator" labels on comments to the author’s commits on the repo.](https://user-images.githubusercontent.com/1402241/177033344-4d4eea63-e075-4096-b2d4-f4b879f1df31.png) +- [](# "linkify-user-labels") [Links the "Contributor", "Member" and "Collaborator" labels on comments and PRs to the author’s commits on the repo.](https://user-images.githubusercontent.com/1402241/177033344-4d4eea63-e075-4096-b2d4-f4b879f1df31.png) - [](# "jump-to-conversation-close-event") [Adds a link to jump to the latest close event of a issue/PR.](https://user-images.githubusercontent.com/16872793/177792713-64219754-f8df-4629-a9ec-33259307cfe7.gif) - [](# "close-as-unplanned") [Lets you "close issue as unplanned" in one click instead of three.](https://github-production-user-asset-6210df.s3.amazonaws.com/1402241/279745773-709cde60-c26a-4a0e-89e1-56444d25ebdf.png) - [](# "locked-issue") [Show a label on locked issues and PRs.](https://user-images.githubusercontent.com/1402241/283015579-0a04becc-9bff-4aef-8770-272d6804970b.png) diff --git a/source/features/linkify-user-labels.tsx b/source/features/linkify-user-labels.tsx index d94b6f189478..32776c267fc5 100644 --- a/source/features/linkify-user-labels.tsx +++ b/source/features/linkify-user-labels.tsx @@ -1,6 +1,7 @@ import './linkify-user-labels.css'; import React from 'dom-chef'; +import {$} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; import {wrap} from '../helpers/dom-utils.js'; @@ -9,7 +10,19 @@ import {buildRepoUrl} from '../github-helpers/index.js'; import getCommentAuthor from '../github-helpers/get-comment-author.js'; import observe from '../helpers/selector-observer.js'; -function linkify(label: Element): void { +function getAuthor(label: HTMLElement): string { + const prMetadataRow = label.closest('.opened-by'); + if (!prMetadataRow) { + return getCommentAuthor(label); + } + + const userPrsLink = $('a[data-hovercard-type="user"]', prMetadataRow); + // The link always ends with author + const username = userPrsLink.href.split('author%3A')[1]; + return username; +} + +function linkify(label: HTMLElement): void { if (label.closest('a')) { throw new Error('Already linkified, feature needs to be updated'); } @@ -19,7 +32,7 @@ function linkify(label: Element): void { label.parentElement!.querySelector('.rgh-linkify-user-labels')?.remove(); const url = new URL(buildRepoUrl('commits')); - url.searchParams.set('author', getCommentAuthor(label)); + url.searchParams.set('author', getAuthor(label)); wrap(label, ); } @@ -42,6 +55,7 @@ void features.add(import.meta.url, { pageDetect.isRepo, ], include: [ + pageDetect.isPRList, pageDetect.hasComments, ], init, @@ -78,4 +92,7 @@ https://github.com/refined-github/sandbox/issues/74#issuecomment-2143792189 Collaborator review comment https://github.com/editorconfig/editorconfig-emacs/pull/389/changes#r2809824690 +Pull requests from a contributor +https://github.com/refined-github/refined-github/pulls?q=is%3Apr+author%3Anotlmn + */ From 7ff5e1b579b4c3d4cd68f625736764d1974bb335 Mon Sep 17 00:00:00 2001 From: SeongJaeSong <58547105+SeongJaeSong@users.noreply.github.com> Date: Thu, 16 Apr 2026 23:39:54 +0900 Subject: [PATCH 15/79] `highlight-non-default-base-branch` - Support global PR/issue lists (#9170) Co-authored-by: Grigory Co-authored-by: fregante --- .../highlight-non-default-base-branch.tsx | 157 ++++++++++++------ 1 file changed, 106 insertions(+), 51 deletions(-) diff --git a/source/features/highlight-non-default-base-branch.tsx b/source/features/highlight-non-default-base-branch.tsx index 879ae1c0dcf2..8823b49b39f0 100644 --- a/source/features/highlight-non-default-base-branch.tsx +++ b/source/features/highlight-non-default-base-branch.tsx @@ -2,6 +2,7 @@ import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; import GitPullRequestIcon from 'octicons-plain-react/GitPullRequest'; import batchedFunction from 'batched-function'; +import {elementExists} from 'select-dom'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; @@ -9,75 +10,126 @@ import observe from '../helpers/selector-observer.js'; import {expectToken} from '../github-helpers/github-token.js'; import abbreviateString from '../helpers/abbreviate-string.js'; -type BranchInfo = { - baseRef: string; - baseRefName: string; +type BaseBranch = { + ref: string | undefined; + refName: string; +}; + +type Pr = { + link: HTMLAnchorElement; + owner: string; + repo: string; + number: number; }; function isClosed(prLink: HTMLElement): boolean { - return Boolean(prLink.closest('.js-issue-row')!.querySelector(['.octicon.merged', '.octicon.closed'])); + const row = prLink.closest([ + '.js-issue-row', // Legacy DOM + 'li', + ])!; + return elementExists([ + // Legacy DOM + '.octicon.merged', + '.octicon.closed', + // React DOM + '.octicon-git-merge', + '.octicon-git-pull-request-closed', + ], row); } -function buildQuery(issueIds: string[]): string { - return ` - repository() { - nameWithOwner - defaultBranchRef {name} - ${issueIds.map(id => ` - ${id}: pullRequest(number: ${id.replaceAll(/\D/g, '')}) { - baseRef {id} - baseRefName - } - `).join('\n')} - } - `; +function buildQuery(prsByRepo: Map): string { + return [...prsByRepo.values()].map(prs => { + const {owner, repo} = prs[0]; + return ` + ${api.escapeKey('repo', owner, repo)}: repository(owner: "${owner}", name: "${repo}") { + nameWithOwner + defaultBranchRef {name} + ${prs.map(pr => ` + ${api.escapeKey('pr', pr.number)}: pullRequest(number: ${pr.number}) { + ref: baseRef {id} + refName: baseRefName + } + `).join('\n')} + } + `; + }).join('\n'); } -async function add(prLinks: HTMLElement[]): Promise { - const query = buildQuery(prLinks.map(pr => pr.id)); - const data = await api.v4(query); - const defaultBranch = data.repository.defaultBranchRef?.name; +function renderBranches(pr: Pr, baseBranch: BaseBranch, nameWithOwner: string): void { + const branch = baseBranch.ref && `/${nameWithOwner}/tree/${baseBranch.refName}`; + const displayName = abbreviateString(baseBranch.refName, 25); - for (const prLink of prLinks) { - const pr: BranchInfo = data.repository[prLink.id]; - if (pr.baseRefName === defaultBranch) { - continue; - } + const badge = ( + + + {' To '} + + + {displayName} + + + + ); - // Avoid noise on old PRs pointing to `master` #3910 - // If the PR is open, it means that `master` still exists - if (pr.baseRefName === 'master' && isClosed(prLink)) { - continue; - } + const metadataRow = pr.link.matches('.js-issue-row *') + // Legacy DOM + ? pr.link.parentElement!.querySelector('.text-small.color-fg-muted .d-none.d-md-inline-flex')! + // React DOM + : pr.link.closest('li')!.querySelector([ + 'div[data-testid="list-row-repo-name-and-number"]', // Issue list + 'div[class^="Description"]', // Preview global PR list + ])!; + metadataRow.append(badge); +} - const branch = pr.baseRef && `/${data.repository.nameWithOwner}/tree/${pr.baseRefName}`; - const displayName = abbreviateString(pr.baseRefName, 25); - - prLink.parentElement!.querySelector('.text-small.color-fg-muted .d-none.d-md-inline-flex')!.append( - - - {' To '} - - - {displayName} - - - , - ); +async function add(prLinks: HTMLAnchorElement[]): Promise { + const prs = new Set(); + for (const link of prLinks) { + const [, owner, repo, , number] = link.pathname.split('/'); + prs.add({ + link, owner, repo, number: Number(number), + }); + } + + const prsByRepo = Map.groupBy(prs, pr => `${pr.owner}/${pr.repo}`); + const data = await api.v4(buildQuery(prsByRepo)); + + for (const repoPrs of prsByRepo.values()) { + const {owner, repo} = repoPrs[0]; + const repository = data[api.escapeKey('repo', owner, repo)]; + const defaultBranch = repository.defaultBranchRef.name; + for (const pr of repoPrs) { + const baseBranch: BaseBranch = repository[api.escapeKey('pr', pr.number)]; + if (baseBranch.refName === defaultBranch) { + continue; + } + + // Avoid noise on old PRs pointing to `master` #3910 + // If the PR is open, it means that `master` still exists + if (baseBranch.refName === 'master' && isClosed(pr.link)) { + continue; + } + + renderBranches(pr, baseBranch, repository.nameWithOwner); + } } } async function init(signal: AbortSignal): Promise { await expectToken(); - observe('.js-issue-row .js-navigation-open[data-hovercard-type="pull_request"]', batchedFunction(add, {delay: 100}), {signal}); + observe([ + '.js-issue-row a[data-hovercard-type="pull_request"]', // Repo and global PR lists + 'a[data-hovercard-type="pull_request"][data-testid="listitem-title-link"]', // Preview global PR list + 'a[data-hovercard-type="pull_request"][data-testid="issue-pr-title-link"]', // Issue list + ], batchedFunction(add, {delay: 100}), {signal}); } void features.add(import.meta.url, { include: [ - pageDetect.isRepoIssueOrPRList, + pageDetect.isIssueOrPRList, ], init, }); @@ -86,6 +138,9 @@ void features.add(import.meta.url, { Test URLs: -https://github.com/refined-github/sandbox/pulls?q=is%3Apr+is%3Aopen+pr+branch +- Repo PR list: https://github.com/refined-github/sandbox/pulls?q=is%3Apr+non+default +- Repo issue list: https://github.com/refined-github/sandbox/issues?q=is%3Apr+non+default +- Global PR list: https://github.com/pulls?q=is%3Apr+repo%3Arefined-github%2Fsandbox+non+default +- Global issue list: https://github.com/issues?q=is%3Apr+repo%3Arefined-github%2Fsandbox+non+default */ From baec0202fb0a9a1aa4df07e7ef1adcc27dacd75b Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Apr 2026 21:40:41 +0700 Subject: [PATCH 16/79] Meta: Warn contributors against using `?.` indiscriminately (#9197) Co-authored-by: fregante --- eslint-suppressions.json | 187 +++++++++++++++++++++++++++++++++++ eslint.config.js | 47 ++++++++- source/features/bugs-tab.tsx | 20 ++-- 3 files changed, 241 insertions(+), 13 deletions(-) create mode 100644 eslint-suppressions.json diff --git a/eslint-suppressions.json b/eslint-suppressions.json new file mode 100644 index 000000000000..37344ca5dd6a --- /dev/null +++ b/eslint-suppressions.json @@ -0,0 +1,187 @@ +{ + "source/features/bugs-tab.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/clean-conversation-filters.tsx": { + "refined-github/no-optional-chaining": { + "count": 4 + } + }, + "source/features/clean-readme-url.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/clean-repo-sidebar.tsx": { + "refined-github/no-optional-chaining": { + "count": 3 + } + }, + "source/features/conversation-activity-filter.tsx": { + "refined-github/no-optional-chaining": { + "count": 2 + } + }, + "source/features/cross-deleted-pr-branches.tsx": { + "refined-github/no-optional-chaining": { + "count": 2 + } + }, + "source/features/easy-toggle-commit-messages.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/expand-all-hidden-comments.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/extend-conversation-status-filters.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/fit-textareas.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/github-actions-indicators.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/hide-low-quality-comments.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/highest-rated-comment.tsx": { + "refined-github/no-optional-chaining": { + "count": 2 + } + }, + "source/features/highlight-non-default-base-branch.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/keyboard-navigation.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/link-to-github-io.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/linkify-symbolic-links.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/list-prs-for-file.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/netiquette.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/new-or-deleted-file.tsx": { + "refined-github/no-optional-chaining": { + "count": 2 + } + }, + "source/features/new-repo-disable-projects-and-wikis.tsx": { + "refined-github/no-optional-chaining": { + "count": 4 + } + }, + "source/features/pr-first-commit-title.tsx": { + "refined-github/no-optional-chaining": { + "count": 2 + } + }, + "source/features/quick-new-issue.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/reactions-avatars.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/releases-tab.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/rgh-deduplicator.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/rgh-feature-descriptions.tsx": { + "refined-github/no-optional-chaining": { + "count": 2 + } + }, + "source/features/rgh-improve-new-issue-form.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/show-names.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/sort-conversations-by-update-time.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/status-subscription.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/sync-pr-commit-title.tsx": { + "refined-github/no-optional-chaining": { + "count": 3 + } + }, + "source/features/unread-anywhere.tsx": { + "refined-github/no-optional-chaining": { + "count": 2 + } + }, + "source/features/unreleased-commits.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/update-pr-from-base-branch.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + }, + "source/features/useful-not-found-page.tsx": { + "refined-github/no-optional-chaining": { + "count": 2 + } + }, + "source/features/visit-tag.tsx": { + "refined-github/no-optional-chaining": { + "count": 1 + } + } +} \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.js index 70726d6ec77a..6c357541e305 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -4,6 +4,40 @@ import svelteParser from 'svelte-eslint-parser'; import {includeIgnoreFile} from '@eslint/compat'; import {fileURLToPath} from 'node:url'; +const refinedGithubPlugin = { + rules: { + 'no-optional-chaining': { + create(context) { + const {sourceCode} = context; + return { + 'MemberExpression[optional=true]'(node) { + // Exception: usage is on a line with an inline comment, or preceded by a comment explaining why + const currentLine = (sourceCode.lines[node.loc.start.line - 1] ?? ''); + const hasInlineComment = /\/\//.test(currentLine.slice(currentLine.indexOf('?.') + 2)); + const previousLine = (sourceCode.lines[node.loc.start.line - 2] ?? '').trim(); + if (hasInlineComment || previousLine.startsWith('//') || previousLine.endsWith('*/')) { + return; + } + + if (node.object.type === 'CallExpression' && node.object.callee.name === '$') { + context.report({ + node, + message: 'Either use $optional() with `?.` or $() without. $() will throw when the element is not found.', + }); + return; + } + + context.report({ + node, + message: 'Use `!.` instead of `?.`. Add a comment on the same or preceding line describing in which scenario the value can CURRENTLY be null. If you cannot find such a scenario, use `!.` instead.', + }); + }, + }; + }, + }, + }, +}; + const gitignorePath = fileURLToPath(new URL('.gitignore', import.meta.url)); export default [ @@ -102,10 +136,6 @@ export default [ selector: 'TSNonNullExpression > CallExpression > [name=$]', message: 'Unused null expression: !', }, - { - selector: 'MemberExpression[optional=true][object.callee.name=$]', - message: 'Either use $optional() with `?.` or $() without. $() will throw when the element is not found.', - }, { message: 'Init functions wrapped with onetime() must have a name ending with "Once"', selector: 'ObjectExpression > Property[key.name=init] > CallExpression[callee.name=onetime]:not([arguments.0.name=/Once$/])', @@ -287,4 +317,13 @@ export default [ }, }, }, + { + files: ['source/features/**'], + plugins: { + 'refined-github': refinedGithubPlugin, + }, + rules: { + 'refined-github/no-optional-chaining': 'error', + }, + }, ]; diff --git a/source/features/bugs-tab.tsx b/source/features/bugs-tab.tsx index 7d38b3bc7f24..f0fe794fc49d 100644 --- a/source/features/bugs-tab.tsx +++ b/source/features/bugs-tab.tsx @@ -17,14 +17,14 @@ import CountBugs from './bugs-tab.gql'; import {expectToken} from '../github-helpers/github-token.js'; type ApiResponse = { - issues?: { - totalCount?: number; + issues: { + totalCount: number; }; - labels?: { - nodes?: Array<{ + labels: { + nodes: Array<{ name: string; issues: { - totalCount?: number; + totalCount: number; }; }>; }; @@ -37,14 +37,16 @@ type Bugs = { async function countBugs(): Promise { const {repository} = await api.v4(CountBugs) as {repository: ApiResponse}; - const bugTypeCount = repository?.issues?.totalCount ?? 0; + const bugTypeCount = repository.issues.totalCount; - let label = repository?.labels?.nodes?.find(label => label.name === 'bug'); - label ??= repository?.labels?.nodes?.find(label => isBugLabel(label.name)); + let label = repository.labels.nodes.find(label => label.name === 'bug'); + label ??= repository.labels.nodes.find(label => isBugLabel(label.name)); - const bugLabelCount = label?.issues?.totalCount ?? 0; + // Label might not be found if the repo uses a non-standard bug label name + const bugLabelCount = label?.issues.totalCount ?? 0; const bugCount = Math.max(bugTypeCount, bugLabelCount); + // Label might not be found if the repo uses a non-standard bug label name return {label: label?.name ?? 'bug', count: bugCount}; } From 1cd5dde2d842fdd95c179d076b7771c42ce7a147 Mon Sep 17 00:00:00 2001 From: Grigory Date: Thu, 16 Apr 2026 20:04:19 +0500 Subject: [PATCH 17/79] Meta: Update small CSS fixes and improvements (#9182) --- .git-blame-ignore-revs | 1 + eslint-suppressions.json | 5 -- source/features/github-bugs.css | 65 +++++++++++--------------- source/refined-github.css | 82 ++++++++++----------------------- 4 files changed, 53 insertions(+), 100 deletions(-) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index d100808276fe..97cc6cca9ffc 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,3 +1,4 @@ 01dd06acceb957ae824d346a5ff8736ee7320c8a b6dc0edc94cebdee74d67f5919f46c28cd96b9f8 a62b707f3d893f424458b9453e938071e4271c6e +9ad9bc41f3028a41423c7026b6709e66d72c9260 diff --git a/eslint-suppressions.json b/eslint-suppressions.json index 37344ca5dd6a..4517e2206a49 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -64,11 +64,6 @@ "count": 2 } }, - "source/features/highlight-non-default-base-branch.tsx": { - "refined-github/no-optional-chaining": { - "count": 1 - } - }, "source/features/keyboard-navigation.tsx": { "refined-github/no-optional-chaining": { "count": 1 diff --git a/source/features/github-bugs.css b/source/features/github-bugs.css index a63978910a67..167211507f92 100644 --- a/source/features/github-bugs.css +++ b/source/features/github-bugs.css @@ -13,13 +13,14 @@ a[class*='PinnedIssue-module__Link'] code { border-radius: 6px; } -/* Limit width of comment form on commit pages #5032 */ -#all_commit_comments .timeline-comment-wrapper { - max-width: 780px; /* This is the limit applied on the comment thread by `.comment-holder` */ -} - /* Fix spacing of repo header button icons #5620 */ -.pagehead-actions :is(.btn, summary) .octicon:not(.octicon-triangle-down) { +.pagehead-actions :is( + .btn, + .Button--secondary, + [class^='prc-Button-ButtonBase'], + summary + ) + .octicon:not(.octicon-triangle-down) { margin-right: 4px !important; } @@ -28,23 +29,17 @@ a[class*='PinnedIssue-module__Link'] code { [action$='/releases'] .subnav-search-icon { margin-top: -1px; } - #release-filter::-webkit-calendar-picker-indicator { margin-top: -4px; } -/* Add margin to release download icon #6510 */ -.Box-row :is(.octicon-package, .octicon-file-zip):has(+ a[rel='nofollow']) { - margin-right: 4px; -} - -/* Mute unclickable reaction buttons, disable hover */ -/* Test: https://github.com/refined-github/sandbox/pull/48 */ +/* TODO: Drop after React PR conversations */ +/* Mute unclickable reaction buttons, disable hover #6795 */ +/* Test: https://github.com/facebook/react/pull/20646 */ :root .social-reaction-summary-item:disabled { filter: grayscale(0.5); background-color: transparent; } - :root .social-reaction-summary-item.user-has-reacted:disabled { color: var( --reactionButton-selected-fgColor-rest, @@ -56,6 +51,7 @@ a[class*='PinnedIssue-module__Link'] code { ) !important; } +/* TODO: Drop after React PR conversations */ /* Hide inactive comment box tabs #7108 */ /* Test: https://github.com/refined-github/sandbox/issues/74 */ .comment-form-head.tabnav:has(~ div .octicon-lock) { @@ -63,32 +59,12 @@ a[class*='PinnedIssue-module__Link'] code { } /* Fit rendered markdown div to its content #7187 */ +/* Test: https://github.com/refined-github/sandbox/compare/default-a...fregante-patch-2?expand=1 */ div.markdown-body { min-height: 2em !important; } -/* Sponsor button in mobile view #7853 */ -/* Test: https://github.com/refined-github/refined-github */ -#dialog-show-responsive-sponsor-modal { - width: var(--base-size-32); - height: var(--base-size-32); - padding: 0; -} - -/* Notifications "Unread" dropdown overlap (Safari, Mobile) */ -/* Info: https://github.com/refined-github/refined-github/issues/7959 */ -/* Test: https://github.com/notifications */ -#dialog-show-notifications-tabs-nav ~ action-menu { - flex-shrink: 0; -} - -/* Long release asset download links break the layout */ -/* Info: https://github.com/refined-github/refined-github/issues/8065 */ -/* Test: https://github.com/hkint/xiaomi-ax3000t-immortalwrt-hanwckf-firmware-build/releases/tag/ImmortalWrt_2024.11.13-0026 */ -svg.octicon-package + a.Truncate[href*='/releases/download/'] > .Truncate-text { - white-space: wrap; -} - +/* TODO: drop in October 2026 */ /* Notifications "Group by" button unnecessary space */ /* Info: https://github.com/refined-github/refined-github/pull/8208 */ /* Test: https://github.com/notifications */ @@ -104,7 +80,7 @@ svg.octicon-package + a.Truncate[href*='/releases/download/'] > .Truncate-text { } } -/* Issue picker does not clip unbreakable issue titles in PRs */ +/* Fix issue picker overflowing the viewport in PRs when it contains long unbreakable issue titles */ /* Info: https://github.com/refined-github/refined-github/pull/8454 */ /* Test: type "#113" in https://github.com/refined-github/sandbox/pull/4 */ .suggester-container li { @@ -153,6 +129,7 @@ div[class^='prc-PageHeader-Description'] } } +/* TODO: Drop in October 2026 */ /* Fix Watch/Unwatch button height on mobile */ /* Info: https://github.com/refined-github/refined-github/issues/9183 */ /* Test: https://github.com/refined-github/refined-github */ @@ -177,6 +154,18 @@ react-app[app-name='pull-requests'] { } } +/* Fix checks state icon alignment in file tree sidebar */ +/* Info: https://github.com/refined-github/refined-github/issues/9198 */ +/* Test: https://github.com/refined-github/refined-github/pull/8958/changes */ +div[class^='PRIVATE_TreeView-item-visual'] > .flex-items-center.flex-row + > div:has(> svg) { + line-height: 0; + + & > svg { + vertical-align: text-top !important; + } +} + /* Test URLs: diff --git a/source/refined-github.css b/source/refined-github.css index 7f81fb059cb2..2ca6c60e6dd0 100644 --- a/source/refined-github.css +++ b/source/refined-github.css @@ -43,39 +43,31 @@ https://github.com/notifications?query=reason%3Acomment (which is an unsaved fil display: contents !important; } +/* Test: https://github.com/refined-github/refined-github/404 */ [alt='404 “This is not the web page you are looking for”'] { animation: fade-in 2s ease-out; } /* Lighten deletions in Markdown */ +/* Info: https://github.com/refined-github/refined-github/pull/958 */ .markdown-body del { color: var(--fgColor-muted, var(--color-fg-muted, fuchsia)); } -/* Make
visibly clickable */ -.markdown-body summary /* Summary elements are always clickable when present */, -.markdown-body details:not([open]) { - /* Summary-less details have unselectable clickable elements */ - cursor: pointer; -} - -/* Remove the "New repository" button in the dashboard sidebar */ -.dashboard-sidebar a.Button[href='/new'] { - display: none; -} - /* Expand empty diffs in PRs */ +/* Info: https://github.com/refined-github/refined-github/issues/1630 */ +/* Test: https://github.com/webpack/webpack/pull/6446/changes */ :root .file .data.empty { padding: 54px; text-align: center; } - :root .file .data table { text-align: left; } /* Improve dropdown expansion animation (e.g. top-right dropdown in comments) */ /* It normally pops in from the center */ +/* Info: https://github.com/refined-github/refined-github/pull/1715 */ .dropdown-menu-sw { transform-origin: 90% top; } @@ -94,16 +86,7 @@ pr-branches vertical-align: middle; } -/* Hide duplicate "You can also open this in GitHub Desktop" in PRs’ mergeability box */ -#partial-pull-merging .js-remove-unless-platform { - display: none; -} - -/* Increase scrollable area in GitHub Actions #3591 */ -.WorkflowRunLogsScroll { - height: auto !important; -} - +/* TODO: Drop after legacy PR files view is removed */ /* Keep diff stats in "Jump to" dropdown when the header is fixed #3925 */ .select-menu-item-text .diffstat { display: inline !important; @@ -123,44 +106,22 @@ pr-branches z-index: 2147483647; } +/* TODO: Drop after July 2026 */ /* Space out "Edit" and "Open with" buttons on PR page, also for `view-last-pr-deployment` #4281 */ .gh-header-actions [aria-label='Edit Pull Request title'] { margin-left: 4px !important; margin-right: 4px !important; } -/* Remove the underline on PR filename copy button hover #4871 */ -.file-header .file-info clipboard-copy { - display: inline-block; -} - -/* Ensure all buttons in the repo file navigation header are aligned in the center rather than to the top */ -.file-navigation.flex-items-start { - align-items: center !important; -} - /* Bold username in conversation lists #4899 */ -:is(.js-issue-row, .js-pinned-issue-list-item) [data-hovercard-type='user'] { +/* Test: https://github.com/refined-github/refined-github/pulls */ +/* Test: https://github.com/refined-github/refined-github/issues */ +:is(.js-issue-row, span[class^='PinnedIssue-module__issueMetadata']) + a[data-hovercard-type='user'], +a[class^='IssueItem-module__authorCreatedLink'] { font-weight: 600; } -/* Fit large images in the window when viewing single files */ -div[data-target='readme-toc.content'] div.blob-wrapper img { - max-width: 100%; -} - -/* Hide label on Milestones link if there are zero milestones #5120 */ -/* TODO: Drop in March 2025 if they don't add it to https://github.com/tc39/ecma402/issues */ -[data-selected-links^='repo_milestones ']:has([title='0']) { - width: 36px; /* Size it so only the icon is visible */ - overflow: hidden; /* Crop the text out */ - padding-left: 10px; -} - -[data-selected-links^='repo_milestones ']:has([title='0']) svg { - margin-right: 20px; /* Push the text farther away from the text so it's cropped out */ -} - .rgh-bg-none { background: none !important; } @@ -177,16 +138,13 @@ div[data-target='readme-toc.content'] div.blob-wrapper img { height: 72px; } +/* Make the gray "Star" icon in the feed yellow */ +/* Info: https://github.com/refined-github/refined-github/pull/8407 */ +/* Test: https://github.com/feed */ .octicon-star-fill { color: var(--button-star-iconColor); } -/* Untruncate long job name #8372 */ -/* Test: https://github.com/valkey-io/valkey-glide/actions/runs/14163355151/job/39672349767 */ -.ActionListItem .ActionListItem-label--truncate { - white-space: unset !important; -} - /* Add hover effect to attachment row on the release page #8339 */ /* Test: https://github.com/refined-github/refined-github/releases/tag/25.7.16 */ @media (min-width: 800px) { @@ -230,3 +188,13 @@ div[data-target='readme-toc.content'] div.blob-wrapper img { } } } + +/* Untruncate long asset name */ +/* Info: https://github.com/refined-github/refined-github/issues/9184 */ +/* Test: https://github.com/hkint/xiaomi-ax3000t-immortalwrt-hanwckf-firmware-build/releases/tag/ImmortalWrt_2024.11.13-0026 */ +.col-12.col-lg-6:has(.octicon-package + a[href*='/releases/download/']) { + width: 100%; + .Truncate-text.text-bold { + white-space: wrap; + } +} From 3e9a88d05c25f58a6f5cee6dfa48f51ed43a4d13 Mon Sep 17 00:00:00 2001 From: Kushal Niroula Date: Fri, 17 Apr 2026 05:09:19 +0545 Subject: [PATCH 18/79] `patch-diff-links` - Add to whole PRs (#9196) Co-authored-by: Federico Co-authored-by: Grigory --- source/features/patch-diff-links.tsx | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/source/features/patch-diff-links.tsx b/source/features/patch-diff-links.tsx index af4356942374..60da1cbfa142 100644 --- a/source/features/patch-diff-links.tsx +++ b/source/features/patch-diff-links.tsx @@ -1,10 +1,18 @@ import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; +import DiffIcon from 'octicons-plain-react/Diff'; + import features from '../feature-manager.js'; import {getCleanPathname} from '../github-helpers/index.js'; import observe from '../helpers/selector-observer.js'; +function getPrUrl(extension: 'patch' | 'diff'): string { + const pathname = getCleanPathname(); + const [owner, repo, , id] = pathname.split('/'); + return `/${owner}/${repo}/pull/${id}.${extension}`; +} + function getCommitUrl(extension: 'patch' | 'diff'): string { // The replacement avoids a redirection isPRCommit const pathname = getCleanPathname().replace(/\/pull\/\d+\/commits/, '/commit'); @@ -45,16 +53,36 @@ async function addPatchDiffLinks(commitMeta: HTMLElement): Promise { ); } +async function addPrPatchDiffLinks(prHeader: HTMLElement): Promise { + prHeader.append( +
  • + +
    + Git URLs: + patch + {' · '} + diff +
    +
  • , + ); +} + async function init(signal: AbortSignal): Promise { observe([ '.commit-meta > :is(span, div):last-child', // `isPRCommit` + old `isSingleCommit` '[class*="commit-header-actions"] + div pre', ], addPatchDiffLinks, {signal}); + + observe([ + '.react-overview-code-button-action-list > ul', + '#local-panel > ul', // TODO: Drop after legacy PR files view is removed + ], addPrPatchDiffLinks, {signal}); } void features.add(import.meta.url, { include: [ pageDetect.isCommit, + pageDetect.isPR, ], exclude: [ pageDetect.isPRCommit404, @@ -68,5 +96,6 @@ Test URLs: - Commit:https://github.com/refined-github/refined-github/commit/132272786fdc058193e089d8c06f2a158844e101 - PR Commit: https://github.com/refined-github/refined-github/pull/7751/commits/07ddf838c211075701e9a681ab061a158b05ee79 +- PR: https://github.com/refined-github/refined-github/pull/7751 */ From 3dd997a0edb7428086c708fd9f52ff99f26478f4 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 00:52:57 +0700 Subject: [PATCH 19/79] Meta: sort imports (#9224) Co-authored-by: fregante <1402241+fregante@users.noreply.github.com> --- source/background.ts | 10 +++++----- source/feature-data.ts | 2 +- source/features/action-pr-link.tsx | 2 +- source/features/action-used-by-link.tsx | 4 ++-- source/features/actionable-pr-view-file.tsx | 4 ++-- source/features/actions-run-removal.tsx | 6 +++--- source/features/archive-forks-link.tsx | 2 +- .../features/avoid-accidental-submissions.tsx | 4 ++-- source/features/batch-mark-files-as-viewed.tsx | 8 ++++---- source/features/bugs-tab.tsx | 12 ++++++------ source/features/ci-link.tsx | 4 ++-- source/features/clean-conversation-filters.tsx | 10 +++++----- source/features/clean-conversation-headers.tsx | 6 +++--- source/features/clean-conversation-sidebar.tsx | 4 ++-- .../features/clean-repo-filelist-actions.tsx | 6 +++--- source/features/clean-repo-sidebar.tsx | 4 ++-- source/features/clean-repo-tabs.tsx | 12 ++++++------ .../features/clear-pr-merge-commit-message.tsx | 6 +++--- source/features/click-outside-modal.tsx | 2 +- source/features/close-as-unplanned.tsx | 2 +- source/features/close-out-of-view-modals.tsx | 4 ++-- source/features/closing-remarks.tsx | 12 ++++++------ source/features/collapsible-content-button.tsx | 10 +++++----- .../command-palette-navigation-shortcuts.tsx | 2 +- source/features/comment-excess.tsx | 10 +++++----- .../features/comments-time-machine-links.tsx | 14 +++++++------- source/features/confirm-release.tsx | 2 +- source/features/conflict-marker.tsx | 6 +++--- source/features/conventional-commits.tsx | 4 ++-- .../features/conversation-activity-filter.tsx | 14 +++++++------- source/features/conversation-authors.tsx | 4 ++-- .../conversation-links-on-repo-lists.tsx | 4 ++-- source/features/convert-release-to-draft.tsx | 10 +++++----- source/features/cross-deleted-pr-branches.tsx | 4 ++-- source/features/deep-reblame.tsx | 12 ++++++------ source/features/default-branch-button.tsx | 12 ++++++------ source/features/dim-bots.tsx | 8 ++++---- source/features/download-folder-button.tsx | 4 ++-- .../features/easy-toggle-commit-messages.tsx | 4 ++-- source/features/easy-toggle-files.tsx | 4 ++-- source/features/embed-gist-inline.tsx | 2 +- source/features/esc-to-cancel.tsx | 2 +- source/features/esc-to-deselect-line.tsx | 2 +- source/features/expand-all-hidden-comments.tsx | 6 +++--- .../extend-conversation-status-filters.tsx | 4 ++-- source/features/extend-diff-expander.tsx | 2 +- source/features/file-age-color.tsx | 2 +- source/features/fit-textareas.tsx | 4 ++-- source/features/fix-no-pr-search.tsx | 2 +- source/features/github-actions-indicators.tsx | 12 ++++++------ .../global-conversation-list-filters.tsx | 2 +- .../hidden-review-comments-indicator.tsx | 10 +++++----- source/features/hide-inactive-deployments.tsx | 2 +- source/features/hide-low-quality-comments.tsx | 8 ++++---- source/features/highest-rated-comment.tsx | 8 ++++---- .../highlight-non-default-base-branch.tsx | 4 ++-- source/features/improve-shortcut-help.tsx | 4 ++-- .../jump-to-change-requested-comment.tsx | 4 ++-- .../jump-to-conversation-close-event.tsx | 8 ++++---- source/features/keyboard-navigation.tsx | 6 +++--- .../features/last-notification-page-button.tsx | 4 ++-- source/features/link-to-changelog-file.tsx | 2 +- source/features/link-to-compare-diff.tsx | 4 ++-- source/features/linkify-branch-references.tsx | 2 +- source/features/linkify-commit-sha.tsx | 4 ++-- source/features/linkify-line-numbers.tsx | 2 +- source/features/linkify-symbolic-links.tsx | 6 +++--- source/features/linkify-text.tsx | 4 ++-- source/features/linkify-user-labels.tsx | 6 +++--- source/features/linkify-user-location.tsx | 2 +- source/features/list-prs-for-branch.tsx | 8 ++++---- source/features/list-prs-for-file.tsx | 8 ++++---- source/features/locked-issue.tsx | 6 +++--- source/features/mark-merge-commits-in-list.tsx | 12 ++++++------ source/features/mark-private-orgs.tsx | 4 ++-- source/features/more-dropdown-links.tsx | 10 +++++----- source/features/more-file-links.tsx | 6 +++--- source/features/netiquette.tsx | 18 +++++++++--------- source/features/new-milestone-button.tsx | 2 +- source/features/new-or-deleted-file.tsx | 2 +- .../new-repo-disable-projects-and-wikis.tsx | 8 ++++---- .../features/no-duplicate-list-update-time.tsx | 2 +- source/features/no-modals.tsx | 2 +- source/features/one-click-diff-options.tsx | 6 +++--- source/features/one-click-pr-or-gist.tsx | 2 +- .../features/one-click-review-submission.tsx | 4 ++-- source/features/open-all-conversations.tsx | 4 ++-- source/features/open-all-notifications.tsx | 10 +++++----- .../features/open-issue-to-latest-comment.tsx | 2 +- source/features/parse-backticks.tsx | 4 ++-- source/features/pinned-issues-update-time.tsx | 6 +++--- source/features/pr-base-commit.tsx | 12 ++++++------ source/features/pr-branch-auto-delete.tsx | 6 +++--- source/features/pr-commit-lines-changed.tsx | 2 +- source/features/pr-filters.tsx | 12 ++++++------ source/features/pr-first-commit-title.tsx | 4 ++-- .../pr-jump-to-first-non-viewed-file.tsx | 4 ++-- source/features/prevent-comment-loss.tsx | 2 +- .../prevent-duplicate-pr-submission.tsx | 2 +- source/features/preview-hidden-comments.tsx | 2 +- .../features/previous-next-commit-buttons.tsx | 2 +- source/features/previous-version.tsx | 8 ++++---- source/features/profile-gists-link.tsx | 12 ++++++------ source/features/profile-hotkey.tsx | 4 ++-- source/features/pull-request-hotkeys.tsx | 2 +- source/features/quick-comment-edit.tsx | 8 ++++---- source/features/quick-file-edit.tsx | 6 +++--- source/features/quick-label-removal.tsx | 10 +++++----- source/features/quick-mention.tsx | 10 +++++----- source/features/quick-repo-deletion.tsx | 14 +++++++------- .../features/quick-review-comment-deletion.tsx | 8 ++++---- source/features/quick-review.tsx | 12 ++++++------ source/features/reactions-avatars.tsx | 6 +++--- source/features/release-download-count.tsx | 12 ++++++------ source/features/releases-dropdown.tsx | 6 +++--- .../features/reload-failed-proxied-images.tsx | 2 +- source/features/repo-age.tsx | 10 +++++----- source/features/repo-avatars.tsx | 4 ++-- source/features/repo-header-info.tsx | 8 ++++---- source/features/repo-wide-file-finder.tsx | 8 ++++---- source/features/rerun-workflow.tsx | 2 +- source/features/restore-file.tsx | 10 +++++----- source/features/rgh-deduplicator.tsx | 2 +- source/features/rgh-dim-commits.tsx | 4 ++-- source/features/rgh-feature-descriptions.tsx | 12 ++++++------ source/features/rgh-improve-new-issue-form.tsx | 12 ++++++------ source/features/rgh-linkify-features.tsx | 8 ++++---- source/features/rgh-linkify-yolo.tsx | 2 +- source/features/rgh-netiquette.tsx | 8 ++++---- source/features/rgh-options-link.tsx | 2 +- source/features/rgh-pr-template.tsx | 2 +- source/features/rgh-token-user.tsx | 10 +++++----- source/features/same-branch-author-commits.tsx | 2 +- .../select-all-notifications-shortcut.tsx | 2 +- source/features/select-notifications.tsx | 16 ++++++++-------- source/features/selection-in-new-tab.tsx | 2 +- source/features/shorten-links.tsx | 2 +- .../show-associated-branch-prs-on-fork.tsx | 8 ++++---- source/features/show-names.tsx | 10 +++++----- source/features/show-open-prs-of-forks.tsx | 6 +++--- source/features/show-whitespace.tsx | 4 ++-- source/features/sidebar-focus-file.tsx | 2 +- source/features/small-user-avatars.tsx | 4 ++-- .../sort-conversations-by-update-time.tsx | 6 +++--- source/features/status-subscription.tsx | 4 ++-- source/features/sticky-sidebar.tsx | 4 ++-- source/features/suggest-commit-title-limit.tsx | 4 ++-- source/features/swap-branches-on-compare.tsx | 2 +- source/features/sync-pr-commit-title.tsx | 14 +++++++------- source/features/tab-to-indent.tsx | 2 +- source/features/table-input.tsx | 10 +++++----- source/features/tag-changes-link.tsx | 8 ++++---- source/features/tags-on-commits-list.tsx | 10 +++++----- source/features/unclip-checks.tsx | 2 +- source/features/unfinished-comments.tsx | 2 +- source/features/unread-anywhere.tsx | 10 +++++----- .../features/unwrap-unnecessary-dropdowns.tsx | 2 +- source/features/update-pr-from-base-branch.tsx | 14 +++++++------- source/features/useful-not-found-page.tsx | 8 ++++---- source/features/vertical-front-matter.tsx | 2 +- source/features/view-last-pr-deployment.tsx | 2 +- source/features/visit-tag.tsx | 12 ++++++------ source/features/warn-pr-from-master.tsx | 4 ++-- source/features/warning-for-disallow-edits.tsx | 2 +- source/github-events/on-field-keydown.tsx | 2 +- source/github-events/on-pr-merge.ts | 2 +- source/github-helpers/dom-formatters.tsx | 8 ++++---- source/github-helpers/get-default-branch.ts | 4 ++-- source/github-helpers/get-tab-count.ts | 2 +- source/github-helpers/get-user-avatar.ts | 2 +- source/github-helpers/get-user-permission.ts | 4 ++-- source/github-helpers/github-token.ts | 4 ++-- .../github-helpers/is-conversation-locked.ts | 4 ++-- source/github-helpers/load-details-menu.ts | 2 +- source/github-helpers/toast.tsx | 2 +- source/github-widgets/notice-bar.tsx | 2 +- source/helpers/bisect.tsx | 6 +++--- source/helpers/click-all.ts | 2 +- source/helpers/fetch-dom.ts | 2 +- source/helpers/hotfix.tsx | 4 ++-- source/helpers/selector-observer.tsx | 6 +++--- source/helpers/show-whitespace-on-line.test.ts | 2 +- source/options.tsx | 16 ++++++++-------- source/options/reload-without.ts | 2 +- 184 files changed, 521 insertions(+), 521 deletions(-) diff --git a/source/background.ts b/source/background.ts index 7519dc6f0933..67c626165e4f 100644 --- a/source/background.ts +++ b/source/background.ts @@ -1,17 +1,17 @@ import 'webext-dynamic-content-scripts'; import 'webext-bugs/options-menu-item'; import {customizeNoAllUrlsErrorMessage} from 'webext-bugs/no-all-urls'; -import {globalCache} from 'webext-storage-cache'; // Also needed to regularly clear the cache +import {isSafari} from 'webext-detect'; +import {handleMessages} from 'webext-msg'; import addPermissionToggle from 'webext-permission-toggle'; import {StorageItem} from 'webext-storage'; -import {handleMessages} from 'webext-msg'; -import {isSafari} from 'webext-detect'; +import {globalCache} from 'webext-storage-cache'; // Also needed to regularly clear the cache -import optionsStorage, {hasToken} from './options-storage.js'; -import isDevelopmentVersion from './helpers/is-development-version.js'; import {doesBrowserActionOpenOptions} from './helpers/feature-utils.js'; import {styleHotfixes} from './helpers/hotfix.js'; +import isDevelopmentVersion from './helpers/is-development-version.js'; import {fetchText} from './helpers/isomorphic-fetch.js'; +import optionsStorage, {hasToken} from './options-storage.js'; import addReloadWithoutContentScripts from './options/reload-without.js'; const {version, permissions} = chrome.runtime.getManifest(); diff --git a/source/feature-data.ts b/source/feature-data.ts index c736fa61fbe3..0552eba38309 100644 --- a/source/feature-data.ts +++ b/source/feature-data.ts @@ -1,6 +1,6 @@ // Run `npm run vitest` to update these files -import importedFeaturesRaw from '../build/__snapshots__/imported-features.json' with {type: 'json'}; import featuresMetasRaw from '../build/__snapshots__/features-meta.json' with {type: 'json'}; +import importedFeaturesRaw from '../build/__snapshots__/imported-features.json' with {type: 'json'}; import renamedFeatures from './feature-renames.json' with {type: 'json'}; export const importedFeatures = importedFeaturesRaw as FeatureId[]; diff --git a/source/features/action-pr-link.tsx b/source/features/action-pr-link.tsx index c7293b14d84f..53264a40228a 100644 --- a/source/features/action-pr-link.tsx +++ b/source/features/action-pr-link.tsx @@ -1,8 +1,8 @@ import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import {getConversationNumber} from '../github-helpers/index.js'; +import observe from '../helpers/selector-observer.js'; function setSearchParameter(anchorElement: HTMLAnchorElement, name: string, value: string): void { const parameters = new URLSearchParams(anchorElement.search); diff --git a/source/features/action-used-by-link.tsx b/source/features/action-used-by-link.tsx index 5c63b51e4390..f5294e9363c0 100644 --- a/source/features/action-used-by-link.tsx +++ b/source/features/action-used-by-link.tsx @@ -1,7 +1,7 @@ import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; -import SearchIcon from 'octicons-plain-react/Search'; import * as pageDetect from 'github-url-detection'; +import SearchIcon from 'octicons-plain-react/Search'; +import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import observe from '../helpers/selector-observer.js'; diff --git a/source/features/actionable-pr-view-file.tsx b/source/features/actionable-pr-view-file.tsx index 64ed86ed36a3..a367c505d4c0 100644 --- a/source/features/actionable-pr-view-file.tsx +++ b/source/features/actionable-pr-view-file.tsx @@ -1,10 +1,10 @@ -import {elementExists} from 'select-dom'; import * as pageDetect from 'github-url-detection'; +import {elementExists} from 'select-dom'; import features from '../feature-manager.js'; import {getBranches} from '../github-helpers/pr-branches.js'; -import observe from '../helpers/selector-observer.js'; import {deletedHeadRepository} from '../github-helpers/selectors.js'; +import observe from '../helpers/selector-observer.js'; /** Rebuilds the "View file" link because it points to the base repo and to the commit, instead of the head repo and its branch */ function alter(viewFileLink: HTMLAnchorElement): void { diff --git a/source/features/actions-run-removal.tsx b/source/features/actions-run-removal.tsx index ff9e9a5b3428..2f128c0a60fa 100644 --- a/source/features/actions-run-removal.tsx +++ b/source/features/actions-run-removal.tsx @@ -1,13 +1,13 @@ import './actions-run-removal.css'; import React from 'dom-chef'; -import TrashIcon from 'octicons-plain-react/Trash'; -import SquareCircleIcon from 'octicons-plain-react/SquareCircle'; import * as pageDetect from 'github-url-detection'; +import SquareCircleIcon from 'octicons-plain-react/SquareCircle'; +import TrashIcon from 'octicons-plain-react/Trash'; import {$, $optional} from 'select-dom/strict.js'; -import observe from '../helpers/selector-observer.js'; import features from '../feature-manager.js'; +import observe from '../helpers/selector-observer.js'; function addQuickButtons(contextMenuIcon: HTMLElement): void { const contextMenuDetails = contextMenuIcon.closest('details')!; diff --git a/source/features/archive-forks-link.tsx b/source/features/archive-forks-link.tsx index 91792563ee37..2dc8af955371 100644 --- a/source/features/archive-forks-link.tsx +++ b/source/features/archive-forks-link.tsx @@ -2,8 +2,8 @@ import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import {buildRepoUrl} from '../github-helpers/index.js'; +import observe from '../helpers/selector-observer.js'; function addLinkToBanner(banner: HTMLElement): void { if (banner.lastChild!.textContent.includes('repository has been archived')) { diff --git a/source/features/avoid-accidental-submissions.tsx b/source/features/avoid-accidental-submissions.tsx index 7040afc6358c..512ff93f53dd 100644 --- a/source/features/avoid-accidental-submissions.tsx +++ b/source/features/avoid-accidental-submissions.tsx @@ -1,7 +1,7 @@ +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; -import {elementExists} from 'select-dom'; import * as pageDetect from 'github-url-detection'; -import delegate, {type DelegateEvent} from 'delegate-it'; +import {elementExists} from 'select-dom'; import features from '../feature-manager.js'; import {modKey as moduleKey} from '../github-helpers/hotkey.js'; diff --git a/source/features/batch-mark-files-as-viewed.tsx b/source/features/batch-mark-files-as-viewed.tsx index 2005114578ee..b80b036eea6c 100644 --- a/source/features/batch-mark-files-as-viewed.tsx +++ b/source/features/batch-mark-files-as-viewed.tsx @@ -1,12 +1,12 @@ -import {$$, elementExists} from 'select-dom'; -import {$} from 'select-dom/strict.js'; import {onAbort} from 'abort-utils'; -import * as pageDetect from 'github-url-detection'; import delegate, {type DelegateEvent} from 'delegate-it'; +import * as pageDetect from 'github-url-detection'; +import {$$, elementExists} from 'select-dom'; +import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; -import clickAll from '../helpers/click-all.js'; import showToast from '../github-helpers/toast.js'; +import clickAll from '../helpers/click-all.js'; import getItemsBetween from '../helpers/get-items-between.js'; export const viewedToggleSelector = [ diff --git a/source/features/bugs-tab.tsx b/source/features/bugs-tab.tsx index f0fe794fc49d..cf570f7d7674 100644 --- a/source/features/bugs-tab.tsx +++ b/source/features/bugs-tab.tsx @@ -1,20 +1,20 @@ import React from 'dom-chef'; -import {CachedFunction} from 'webext-storage-cache'; -import {$} from 'select-dom/strict.js'; -import {elementExists} from 'select-dom'; -import BugIcon from 'octicons-plain-react/Bug'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; +import BugIcon from 'octicons-plain-react/Bug'; +import {elementExists} from 'select-dom'; +import {$} from 'select-dom/strict.js'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; +import isBugLabel from '../github-helpers/bugs-label.js'; +import {expectToken} from '../github-helpers/github-token.js'; import {cacheByRepo, triggerRepoNavOverflow} from '../github-helpers/index.js'; import SearchQuery from '../github-helpers/search-query.js'; import abbreviateNumber from '../helpers/abbreviate-number.js'; import {highlightTab, unhighlightTab} from '../helpers/dom-utils.js'; -import isBugLabel from '../github-helpers/bugs-label.js'; import CountBugs from './bugs-tab.gql'; -import {expectToken} from '../github-helpers/github-token.js'; type ApiResponse = { issues: { diff --git a/source/features/ci-link.tsx b/source/features/ci-link.tsx index a84def3a5aa7..d83720a5fbe2 100644 --- a/source/features/ci-link.tsx +++ b/source/features/ci-link.tsx @@ -5,11 +5,11 @@ import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; +import {expectToken} from '../github-helpers/github-token.js'; import {buildRepoUrl} from '../github-helpers/index.js'; +import {isSmallDevice} from '../helpers/dom-utils.js'; import observe from '../helpers/selector-observer.js'; import getChecks from './ci-link.gql'; -import {expectToken} from '../github-helpers/github-token.js'; -import {isSmallDevice} from '../helpers/dom-utils.js'; async function getCommitWithChecks(): Promise { const {repository} = await api.v4(getChecks); diff --git a/source/features/clean-conversation-filters.tsx b/source/features/clean-conversation-filters.tsx index 07ef496814b3..ca1a1410d968 100644 --- a/source/features/clean-conversation-filters.tsx +++ b/source/features/clean-conversation-filters.tsx @@ -1,15 +1,15 @@ -import {CachedFunction} from 'webext-storage-cache'; -import {$optional} from 'select-dom/strict.js'; -import {elementExists} from 'select-dom'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; +import {elementExists} from 'select-dom'; +import {$optional} from 'select-dom/strict.js'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; -import {cacheByRepo} from '../github-helpers/index.js'; -import HasAnyProjects from './clean-conversation-filters.gql'; import api from '../github-helpers/api.js'; import {expectToken, expectTokenScope} from '../github-helpers/github-token.js'; +import {cacheByRepo} from '../github-helpers/index.js'; import observe from '../helpers/selector-observer.js'; +import HasAnyProjects from './clean-conversation-filters.gql'; const hasAnyProjects = new CachedFunction('has-projects', { async updater(): Promise { diff --git a/source/features/clean-conversation-headers.tsx b/source/features/clean-conversation-headers.tsx index 0deb159e6457..42f2aa43088b 100644 --- a/source/features/clean-conversation-headers.tsx +++ b/source/features/clean-conversation-headers.tsx @@ -1,17 +1,17 @@ import './clean-conversation-headers.css'; import React from 'dom-chef'; -import {$, $optional} from 'select-dom/strict.js'; import elementReady from 'element-ready'; -import ArrowLeftIcon from 'octicons-plain-react/ArrowLeft'; import * as pageDetect from 'github-url-detection'; +import ArrowLeftIcon from 'octicons-plain-react/ArrowLeft'; +import {$, $optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import getDefaultBranch from '../github-helpers/get-default-branch.js'; -import observe from '../helpers/selector-observer.js'; import {expectToken} from '../github-helpers/github-token.js'; import {parseReferenceRaw} from '../github-helpers/pr-branches.js'; import {assertNodeContent} from '../helpers/dom-utils.js'; +import observe from '../helpers/selector-observer.js'; async function highlightNonDefaultBranchPrs(base: HTMLElement, baseBranch: string): Promise { const wasDefaultBranch = pageDetect.isClosedConversation() && baseBranch === 'master'; diff --git a/source/features/clean-conversation-sidebar.tsx b/source/features/clean-conversation-sidebar.tsx index d322c404579b..a298a35b34ce 100644 --- a/source/features/clean-conversation-sidebar.tsx +++ b/source/features/clean-conversation-sidebar.tsx @@ -1,14 +1,14 @@ import './clean-conversation-sidebar.css'; import React from 'dom-chef'; +import * as pageDetect from 'github-url-detection'; import {elementExists} from 'select-dom'; import {$, $optional} from 'select-dom/strict.js'; -import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; +import {removeTextNodeContaining} from '../helpers/dom-utils.js'; import onElementRemoval from '../helpers/on-element-removal.js'; import observe from '../helpers/selector-observer.js'; -import {removeTextNodeContaining} from '../helpers/dom-utils.js'; // Don't cache: https://github.com/refined-github/refined-github/issues/7283 const canEditSidebar = (): boolean => elementExists('.discussion-sidebar-item [data-hotkey="l"]'); diff --git a/source/features/clean-repo-filelist-actions.tsx b/source/features/clean-repo-filelist-actions.tsx index 054184875cf0..4f22e0578d9f 100644 --- a/source/features/clean-repo-filelist-actions.tsx +++ b/source/features/clean-repo-filelist-actions.tsx @@ -1,11 +1,11 @@ import React from 'dom-chef'; -import {$, $optional} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; import PlusIcon from 'octicons-plain-react/Plus'; +import {$, $optional} from 'select-dom/strict.js'; -import observe from '../helpers/selector-observer.js'; -import {assertNodeContent, wrap} from '../helpers/dom-utils.js'; import features from '../feature-manager.js'; +import {assertNodeContent, wrap} from '../helpers/dom-utils.js'; +import observe from '../helpers/selector-observer.js'; import './clean-repo-filelist-actions.css'; /** Add tooltip on a wrapper to avoid breaking dropdown functionality */ diff --git a/source/features/clean-repo-sidebar.tsx b/source/features/clean-repo-sidebar.tsx index 5eabe7186df9..39a51a32a943 100644 --- a/source/features/clean-repo-sidebar.tsx +++ b/source/features/clean-repo-sidebar.tsx @@ -1,9 +1,9 @@ import './clean-repo-sidebar.css'; -import {elementExists} from 'select-dom'; -import {$, $optional} from 'select-dom/strict.js'; import domLoaded from 'dom-loaded'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; +import {elementExists} from 'select-dom'; +import {$, $optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import {buildRepoUrl} from '../github-helpers/index.js'; diff --git a/source/features/clean-repo-tabs.tsx b/source/features/clean-repo-tabs.tsx index e33fffda6ad7..06fc7e24f62c 100644 --- a/source/features/clean-repo-tabs.tsx +++ b/source/features/clean-repo-tabs.tsx @@ -1,17 +1,17 @@ import React from 'dom-chef'; -import {CachedFunction} from 'webext-storage-cache'; -import {countElements} from 'select-dom'; -import {$, $optional} from 'select-dom/strict.js'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; +import {countElements} from 'select-dom'; +import {$, $optional} from 'select-dom/strict.js'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; -import fetchDom from '../helpers/fetch-dom.js'; import api from '../github-helpers/api.js'; import getTabCount from '../github-helpers/get-tab-count.js'; -import looseParseInt from '../helpers/loose-parse-int.js'; -import abbreviateNumber from '../helpers/abbreviate-number.js'; import {buildRepoUrl, cacheByRepo, getRepo} from '../github-helpers/index.js'; +import abbreviateNumber from '../helpers/abbreviate-number.js'; +import fetchDom from '../helpers/fetch-dom.js'; +import looseParseInt from '../helpers/loose-parse-int.js'; import {unhideOverflowDropdown} from './more-dropdown-links.js'; async function canUserEditOrganization(): Promise { diff --git a/source/features/clear-pr-merge-commit-message.tsx b/source/features/clear-pr-merge-commit-message.tsx index 27d4b211e466..d1f001bf8f02 100644 --- a/source/features/clear-pr-merge-commit-message.tsx +++ b/source/features/clear-pr-merge-commit-message.tsx @@ -1,14 +1,14 @@ import React from 'dom-chef'; -import {countElements} from 'select-dom'; import * as pageDetect from 'github-url-detection'; +import {countElements} from 'select-dom'; import features from '../feature-manager.js'; -import {getBranches} from '../github-helpers/pr-branches.js'; import getDefaultBranch from '../github-helpers/get-default-branch.js'; -import cleanCommitMessage from '../helpers/clean-commit-message.js'; import {userHasPushAccess} from '../github-helpers/get-user-permission.js'; import {expectToken} from '../github-helpers/github-token.js'; +import {getBranches} from '../github-helpers/pr-branches.js'; import attachElement from '../helpers/attach-element.js'; +import cleanCommitMessage from '../helpers/clean-commit-message.js'; import observe from '../helpers/selector-observer.js'; const isPrAgainstDefaultBranch = async (): Promise => getBranches().base.branch === await getDefaultBranch(); diff --git a/source/features/click-outside-modal.tsx b/source/features/click-outside-modal.tsx index 7e3c69a48595..51637f6442e0 100644 --- a/source/features/click-outside-modal.tsx +++ b/source/features/click-outside-modal.tsx @@ -1,5 +1,5 @@ -import * as pageDetect from 'github-url-detection'; import delegate, {type DelegateEvent} from 'delegate-it'; +import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; diff --git a/source/features/close-as-unplanned.tsx b/source/features/close-as-unplanned.tsx index 6e89a83955aa..3d29222de169 100644 --- a/source/features/close-as-unplanned.tsx +++ b/source/features/close-as-unplanned.tsx @@ -3,8 +3,8 @@ import * as pageDetect from 'github-url-detection'; import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import {getFeatureId} from '../helpers/feature-helpers.js'; +import observe from '../helpers/selector-observer.js'; const id = getFeatureId(import.meta.url); diff --git a/source/features/close-out-of-view-modals.tsx b/source/features/close-out-of-view-modals.tsx index 6b8b3d9c24fb..941236cae89b 100644 --- a/source/features/close-out-of-view-modals.tsx +++ b/source/features/close-out-of-view-modals.tsx @@ -1,9 +1,9 @@ -import {$$} from 'select-dom'; import delegate, {type DelegateEvent} from 'delegate-it'; +import {$$} from 'select-dom'; -import onetime from '../helpers/onetime.js'; import features from '../feature-manager.js'; import {getFeatureId} from '../helpers/feature-helpers.js'; +import onetime from '../helpers/onetime.js'; const visible = new Set(); const observer = new IntersectionObserver(entries => { diff --git a/source/features/closing-remarks.tsx b/source/features/closing-remarks.tsx index ddce41318aeb..8a61dd8b4ba7 100644 --- a/source/features/closing-remarks.tsx +++ b/source/features/closing-remarks.tsx @@ -1,21 +1,21 @@ import React from 'dom-chef'; -import {CachedFunction} from 'webext-storage-cache'; import {$$} from 'select-dom'; import {$} from 'select-dom/strict.js'; +import {CachedFunction} from 'webext-storage-cache'; -import TagIcon from 'octicons-plain-react/Tag'; import * as pageDetect from 'github-url-detection'; +import TagIcon from 'octicons-plain-react/Tag'; import features from '../feature-manager.js'; -import fetchDom from '../helpers/fetch-dom.js'; import waitForPrMerge from '../github-events/on-pr-merge.js'; import createBanner, {type BannerProps} from '../github-helpers/banner.js'; +import {userHasPushAccess} from '../github-helpers/get-user-permission.js'; +import {buildRepoUrl, getRepo, isRefinedGitHubRepo} from '../github-helpers/index.js'; import TimelineItem from '../github-helpers/timeline-item.js'; import attachElement from '../helpers/attach-element.js'; -import {buildRepoUrl, getRepo, isRefinedGitHubRepo} from '../github-helpers/index.js'; -import {getReleases} from './releases-tab.js'; +import fetchDom from '../helpers/fetch-dom.js'; import observe from '../helpers/selector-observer.js'; -import {userHasPushAccess} from '../github-helpers/get-user-permission.js'; +import {getReleases} from './releases-tab.js'; function excludeNightliesAndJunk({textContent}: HTMLAnchorElement): boolean { // https://github.com/refined-github/refined-github/issues/7206 diff --git a/source/features/collapsible-content-button.tsx b/source/features/collapsible-content-button.tsx index 7da1bce92e1d..faaceb329e29 100644 --- a/source/features/collapsible-content-button.tsx +++ b/source/features/collapsible-content-button.tsx @@ -1,15 +1,15 @@ +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; -import FoldDownIcon from 'octicons-plain-react/FoldDown'; import * as pageDetect from 'github-url-detection'; -import {insertTextIntoField} from 'text-field-edit'; -import delegate, {type DelegateEvent} from 'delegate-it'; +import FoldDownIcon from 'octicons-plain-react/FoldDown'; import {$} from 'select-dom/strict.js'; +import {insertTextIntoField} from 'text-field-edit'; import features from '../feature-manager.js'; -import smartBlockWrap from '../helpers/smart-block-wrap.js'; -import observe from '../helpers/selector-observer.js'; import {triggerActionBarOverflow} from '../github-helpers/index.js'; import {actionBarSelectors} from '../github-helpers/selectors.js'; +import observe from '../helpers/selector-observer.js'; +import smartBlockWrap from '../helpers/smart-block-wrap.js'; function addContentToDetails({delegateTarget}: DelegateEvent): void { const container = delegateTarget.closest([ diff --git a/source/features/command-palette-navigation-shortcuts.tsx b/source/features/command-palette-navigation-shortcuts.tsx index d2dbf52e5202..1be728238b65 100644 --- a/source/features/command-palette-navigation-shortcuts.tsx +++ b/source/features/command-palette-navigation-shortcuts.tsx @@ -1,7 +1,7 @@ import delegate, {type DelegateEvent} from 'delegate-it'; -import {isMac} from '../github-helpers/index.js'; import features from '../feature-manager.js'; +import {isMac} from '../github-helpers/index.js'; import onetime from '../helpers/onetime.js'; function commandPaletteKeydown(event: DelegateEvent): void { diff --git a/source/features/comment-excess.tsx b/source/features/comment-excess.tsx index 7a110e78c5d6..f4a9cbd5cf3a 100644 --- a/source/features/comment-excess.tsx +++ b/source/features/comment-excess.tsx @@ -1,13 +1,13 @@ -import React from 'react'; -import * as pageDetect from 'github-url-detection'; import elementReady from 'element-ready'; +import * as pageDetect from 'github-url-detection'; +import React from 'react'; import {$, $optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; -import {assertNodeContent} from '../helpers/dom-utils.js'; -import {paginationButtonSelector} from '../github-helpers/selectors.js'; import {isMac, scrollIntoViewIfNeeded} from '../github-helpers/index.js'; +import {paginationButtonSelector} from '../github-helpers/selectors.js'; +import {assertNodeContent} from '../helpers/dom-utils.js'; +import observe from '../helpers/selector-observer.js'; const hiddenCommentsForm = '#js-progressive-timeline-item-container'; diff --git a/source/features/comments-time-machine-links.tsx b/source/features/comments-time-machine-links.tsx index 1c3a333c4f53..5e0f6c151b1a 100644 --- a/source/features/comments-time-machine-links.tsx +++ b/source/features/comments-time-machine-links.tsx @@ -1,21 +1,21 @@ +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; -import delegate, {type DelegateEvent} from 'delegate-it'; import HistoryIcon from 'octicons-plain-react/History'; +import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import GitHubFileUrl from '../github-helpers/github-file-url.js'; -import addNotice from '../github-widgets/notice-bar.js'; import {linkifiedUrlClass} from '../github-helpers/dom-formatters.js'; +import getDefaultBranch from '../github-helpers/get-default-branch.js'; +import GitHubFileUrl from '../github-helpers/github-file-url.js'; +import {expectToken} from '../github-helpers/github-token.js'; import {buildRepoUrl, isPermalink} from '../github-helpers/index.js'; -import {saveOriginalHref} from './sort-conversations-by-update-time.js'; +import addNotice from '../github-widgets/notice-bar.js'; import observe from '../helpers/selector-observer.js'; import GetCommitAtDate from './comments-time-machine-links.gql'; -import {expectToken} from '../github-helpers/github-token.js'; -import getDefaultBranch from '../github-helpers/get-default-branch.js'; +import {saveOriginalHref} from './sort-conversations-by-update-time.js'; const commentSelector = [ '.loaded .react-issue-body', // Issue description diff --git a/source/features/confirm-release.tsx b/source/features/confirm-release.tsx index fd2298c756fa..d8bff3ea2315 100644 --- a/source/features/confirm-release.tsx +++ b/source/features/confirm-release.tsx @@ -1,5 +1,5 @@ -import * as pageDetect from 'github-url-detection'; import delegate, {type DelegateEvent} from 'delegate-it'; +import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; diff --git a/source/features/conflict-marker.tsx b/source/features/conflict-marker.tsx index 6be78cfdcd8a..3cc3c020e923 100644 --- a/source/features/conflict-marker.tsx +++ b/source/features/conflict-marker.tsx @@ -1,15 +1,15 @@ import './conflict-marker.css'; +import batchedFunction from 'batched-function'; import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; import AlertIcon from 'octicons-plain-react/Alert'; -import batchedFunction from 'batched-function'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import observe from '../helpers/selector-observer.js'; -import {openPrsListLink} from '../github-helpers/selectors.js'; import {expectToken} from '../github-helpers/github-token.js'; +import {openPrsListLink} from '../github-helpers/selectors.js'; +import observe from '../helpers/selector-observer.js'; async function addIcon(links: HTMLAnchorElement[]): Promise { const prConfigs = links.map(link => { diff --git a/source/features/conventional-commits.tsx b/source/features/conventional-commits.tsx index cb3a41a489e9..32c9cdca22fe 100644 --- a/source/features/conventional-commits.tsx +++ b/source/features/conventional-commits.tsx @@ -6,14 +6,14 @@ This feature is documented at https://github.com/refined-github/refined-github/w import './conventional-commits.css'; -import React from 'react'; import * as pageDetect from 'github-url-detection'; +import React from 'react'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import {commitTitleInLists} from '../github-helpers/selectors.js'; import {conventionalCommitRegex, parseConventionalCommit} from '../helpers/conventional-commits.js'; import {removeTextInTextNode} from '../helpers/dom-utils.js'; +import observe from '../helpers/selector-observer.js'; function renderLabelInCommitTitle(commitTitleElement: HTMLElement): void { const textNode = commitTitleElement.firstChild!; diff --git a/source/features/conversation-activity-filter.tsx b/source/features/conversation-activity-filter.tsx index a883b61f414c..6ebef5d83ddf 100644 --- a/source/features/conversation-activity-filter.tsx +++ b/source/features/conversation-activity-filter.tsx @@ -1,20 +1,20 @@ import './conversation-activity-filter.css'; +import delegate from 'delegate-it'; import React from 'dom-chef'; -import {$, $optional} from 'select-dom/strict.js'; -import {$$, elementExists} from 'select-dom'; +import domLoaded from 'dom-loaded'; import * as pageDetect from 'github-url-detection'; import CheckIcon from 'octicons-plain-react/Check'; -import EyeClosedIcon from 'octicons-plain-react/EyeClosed'; import EyeIcon from 'octicons-plain-react/Eye'; +import EyeClosedIcon from 'octicons-plain-react/EyeClosed'; import TriangleDownIcon from 'octicons-plain-react/TriangleDown'; -import domLoaded from 'dom-loaded'; -import delegate from 'delegate-it'; +import {$$, elementExists} from 'select-dom'; +import {$, $optional} from 'select-dom/strict.js'; -import delay from '../helpers/delay.js'; -import {wrap} from '../helpers/dom-utils.js'; import features from '../feature-manager.js'; import {registerHotkey} from '../github-helpers/hotkey.js'; +import delay from '../helpers/delay.js'; +import {wrap} from '../helpers/dom-utils.js'; import observe from '../helpers/selector-observer.js'; const states = { diff --git a/source/features/conversation-authors.tsx b/source/features/conversation-authors.tsx index b11f8868dd2d..aa8e14bb28d3 100644 --- a/source/features/conversation-authors.tsx +++ b/source/features/conversation-authors.tsx @@ -1,13 +1,13 @@ import './conversation-authors.css'; -import {CachedFunction} from 'webext-storage-cache'; import * as pageDetect from 'github-url-detection'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; +import {expectToken} from '../github-helpers/github-token.js'; import {cacheByRepo, getLoggedInUser} from '../github-helpers/index.js'; import observe from '../helpers/selector-observer.js'; -import {expectToken} from '../github-helpers/github-token.js'; import GetCollaborators from './conversation-authors.gql'; const collaborators = new CachedFunction('repo-collaborators', { diff --git a/source/features/conversation-links-on-repo-lists.tsx b/source/features/conversation-links-on-repo-lists.tsx index 701de08671dc..e322fef8d65b 100644 --- a/source/features/conversation-links-on-repo-lists.tsx +++ b/source/features/conversation-links-on-repo-lists.tsx @@ -1,12 +1,12 @@ import React from 'dom-chef'; -import {$, $optional} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; import GitPullRequestIcon from 'octicons-plain-react/GitPullRequest'; import IssueOpenedIcon from 'octicons-plain-react/IssueOpened'; +import {$, $optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import {assertNodeContent} from '../helpers/dom-utils.js'; +import observe from '../helpers/selector-observer.js'; function addConversationLinks(repositoryLink: HTMLAnchorElement): void { const repository = repositoryLink.closest('li')!; diff --git a/source/features/convert-release-to-draft.tsx b/source/features/convert-release-to-draft.tsx index c98599c0c5c0..916db1d2ace9 100644 --- a/source/features/convert-release-to-draft.tsx +++ b/source/features/convert-release-to-draft.tsx @@ -1,15 +1,15 @@ +import delegate from 'delegate-it'; import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; -import {elementExists} from 'select-dom'; import * as pageDetect from 'github-url-detection'; -import delegate from 'delegate-it'; +import {elementExists} from 'select-dom'; +import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; +import {expectToken} from '../github-helpers/github-token.js'; import {getRepo} from '../github-helpers/index.js'; -import observe from '../helpers/selector-observer.js'; import showToast from '../github-helpers/toast.js'; -import {expectToken} from '../github-helpers/github-token.js'; +import observe from '../helpers/selector-observer.js'; const getReleaseEditLinkSelector = (): 'a' => `a[href^="/${getRepo()!.nameWithOwner}/releases/edit"]` as 'a'; diff --git a/source/features/cross-deleted-pr-branches.tsx b/source/features/cross-deleted-pr-branches.tsx index 416a44197d90..617e6e7eeaf0 100644 --- a/source/features/cross-deleted-pr-branches.tsx +++ b/source/features/cross-deleted-pr-branches.tsx @@ -1,12 +1,12 @@ import './cross-deleted-pr-branches.css'; import React from 'dom-chef'; +import * as pageDetect from 'github-url-detection'; import {$$, lastElement} from 'select-dom'; import {$, $optional} from 'select-dom/strict.js'; -import * as pageDetect from 'github-url-detection'; -import {wrap} from '../helpers/dom-utils.js'; import features from '../feature-manager.js'; +import {wrap} from '../helpers/dom-utils.js'; function init(): void | false { const lastBranchAction = lastElement('.TimelineItem-body .user-select-contain.commit-ref'); diff --git a/source/features/deep-reblame.tsx b/source/features/deep-reblame.tsx index 5be99f46a222..cadf85c2a78c 100644 --- a/source/features/deep-reblame.tsx +++ b/source/features/deep-reblame.tsx @@ -1,22 +1,22 @@ import './deep-reblame.css'; -import mem from 'memoize'; +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; +import * as pageDetect from 'github-url-detection'; +import mem from 'memoize'; +import VersionsIcon from 'octicons-plain-react/Versions'; import {$$} from 'select-dom'; import {$, $optional} from 'select-dom/strict.js'; -import VersionsIcon from 'octicons-plain-react/Versions'; -import * as pageDetect from 'github-url-detection'; -import delegate, {type DelegateEvent} from 'delegate-it'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; import GitHubFileUrl from '../github-helpers/github-file-url.js'; +import {expectToken} from '../github-helpers/github-token.js'; +import {multilineAriaLabel} from '../github-helpers/index.js'; import showToast from '../github-helpers/toast.js'; import looseParseInt from '../helpers/loose-parse-int.js'; import observe from '../helpers/selector-observer.js'; import GetPullRequestBlameCommit from './deep-reblame.gql'; -import {multilineAriaLabel} from '../github-helpers/index.js'; -import {expectToken} from '../github-helpers/github-token.js'; const getPullRequestBlameCommit = mem(async (commit: string, prNumbers: number[], currentFilename: string): Promise => { const {repository} = await api.v4(GetPullRequestBlameCommit, { diff --git a/source/features/default-branch-button.tsx b/source/features/default-branch-button.tsx index 6fa55f3551e9..29ab08a8e36a 100644 --- a/source/features/default-branch-button.tsx +++ b/source/features/default-branch-button.tsx @@ -2,19 +2,19 @@ import './default-branch-button.css'; import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; +import memoize from 'memoize'; import ChevronLeftIcon from 'octicons-plain-react/ChevronLeft'; import {$optional} from 'select-dom/strict.js'; -import memoize from 'memoize'; import features from '../feature-manager.js'; +import getDefaultBranch from '../github-helpers/get-default-branch.js'; import GitHubFileUrl from '../github-helpers/github-file-url.js'; +import {expectToken} from '../github-helpers/github-token.js'; import {groupButtons} from '../github-helpers/group-buttons.js'; -import getDefaultBranch from '../github-helpers/get-default-branch.js'; -import observe from '../helpers/selector-observer.js'; -import {branchSelector} from '../github-helpers/selectors.js'; -import isDefaultBranch from '../github-helpers/is-default-branch.js'; import {fixFileHeaderOverlap, isRepoCommitListRoot} from '../github-helpers/index.js'; -import {expectToken} from '../github-helpers/github-token.js'; +import isDefaultBranch from '../github-helpers/is-default-branch.js'; +import {branchSelector} from '../github-helpers/selectors.js'; +import observe from '../helpers/selector-observer.js'; const getUrl = memoize(async (currentUrl: string): Promise => { const defaultUrl = new GitHubFileUrl(currentUrl); diff --git a/source/features/dim-bots.tsx b/source/features/dim-bots.tsx index 1f09f55a6799..bcdc5a3a1052 100644 --- a/source/features/dim-bots.tsx +++ b/source/features/dim-bots.tsx @@ -1,14 +1,14 @@ import './dim-bots.css'; -import {$$} from 'select-dom'; -import * as pageDetect from 'github-url-detection'; import delegate, {type DelegateEvent} from 'delegate-it'; +import * as pageDetect from 'github-url-detection'; +import {$$} from 'select-dom'; import features from '../feature-manager.js'; -import preserveScroll from '../helpers/preserve-scroll.js'; -import observe from '../helpers/selector-observer.js'; import {botLinksCommitSelectors, botLinksPrSelectors} from '../github-helpers/selectors.js'; import {getIdentifiers} from '../helpers/feature-helpers.js'; +import preserveScroll from '../helpers/preserve-scroll.js'; +import observe from '../helpers/selector-observer.js'; const botLinksCommitSelectorsExceptCopilot = botLinksCommitSelectors.map( selector => `${selector}:not([href*="copilot"])`, diff --git a/source/features/download-folder-button.tsx b/source/features/download-folder-button.tsx index 6b044290a42d..a564c07977bf 100644 --- a/source/features/download-folder-button.tsx +++ b/source/features/download-folder-button.tsx @@ -1,11 +1,11 @@ import React from 'dom-chef'; -import {$, $optional} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; import DownloadIcon from 'octicons-plain-react/Download'; +import {$, $optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import replaceElementTypeInPlace from '../helpers/recreate-element.js'; +import observe from '../helpers/selector-observer.js'; function add(menu: HTMLUListElement): void { const downloadUrl = new URL('https://download-directory.github.io/'); diff --git a/source/features/easy-toggle-commit-messages.tsx b/source/features/easy-toggle-commit-messages.tsx index dd57593a836d..56268cd17421 100644 --- a/source/features/easy-toggle-commit-messages.tsx +++ b/source/features/easy-toggle-commit-messages.tsx @@ -1,6 +1,6 @@ -import {$optional} from 'select-dom/strict.js'; -import * as pageDetect from 'github-url-detection'; import delegate, {type DelegateEvent} from 'delegate-it'; +import * as pageDetect from 'github-url-detection'; +import {$optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; diff --git a/source/features/easy-toggle-files.tsx b/source/features/easy-toggle-files.tsx index e07d9b1bf642..a8cfd2540b8d 100644 --- a/source/features/easy-toggle-files.tsx +++ b/source/features/easy-toggle-files.tsx @@ -1,9 +1,9 @@ -import {$} from 'select-dom/strict.js'; import delegate, {type DelegateEvent} from 'delegate-it'; import * as pageDetect from 'github-url-detection'; +import {$} from 'select-dom/strict.js'; -import {codeSearchHeader} from '../github-helpers/selectors.js'; import features from '../feature-manager.js'; +import {codeSearchHeader} from '../github-helpers/selectors.js'; function toggleFile(event: DelegateEvent): void { const elementClicked = event.target as HTMLElement; diff --git a/source/features/embed-gist-inline.tsx b/source/features/embed-gist-inline.tsx index 91bc13e74161..7d357805bd9b 100644 --- a/source/features/embed-gist-inline.tsx +++ b/source/features/embed-gist-inline.tsx @@ -5,8 +5,8 @@ import mem from 'memoize'; import {messageRuntime} from 'webext-msg'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import {standaloneGistLinkInMarkdown} from '../github-helpers/selectors.js'; +import observe from '../helpers/selector-observer.js'; type GistData = { div: string; diff --git a/source/features/esc-to-cancel.tsx b/source/features/esc-to-cancel.tsx index 49a20ba4a5a7..0365c0f6ab83 100644 --- a/source/features/esc-to-cancel.tsx +++ b/source/features/esc-to-cancel.tsx @@ -1,6 +1,6 @@ -import {$} from 'select-dom/strict.js'; import type {DelegateEvent} from 'delegate-it'; import * as pageDetect from 'github-url-detection'; +import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import {onConversationTitleFieldKeydown} from '../github-events/on-field-keydown.js'; diff --git a/source/features/esc-to-deselect-line.tsx b/source/features/esc-to-deselect-line.tsx index ea0009fc249e..67136d4b2639 100644 --- a/source/features/esc-to-deselect-line.tsx +++ b/source/features/esc-to-deselect-line.tsx @@ -1,5 +1,5 @@ -import {$optional} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import {isEditable} from '../helpers/dom-utils.js'; diff --git a/source/features/expand-all-hidden-comments.tsx b/source/features/expand-all-hidden-comments.tsx index 063904ad4482..4a5bab0b7b16 100644 --- a/source/features/expand-all-hidden-comments.tsx +++ b/source/features/expand-all-hidden-comments.tsx @@ -1,11 +1,11 @@ -import {$optional} from 'select-dom/strict.js'; -import oneEvent from 'one-event'; import delegate, {type DelegateEvent} from 'delegate-it'; import * as pageDetect from 'github-url-detection'; +import oneEvent from 'one-event'; +import {$optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; -import showToast from '../github-helpers/toast.js'; import {paginationButtonSelector} from '../github-helpers/selectors.js'; +import showToast from '../github-helpers/toast.js'; // eslint-disable-next-line @typescript-eslint/explicit-function-return-type async function expandHidden(paginationButton: HTMLButtonElement | undefined) { diff --git a/source/features/extend-conversation-status-filters.tsx b/source/features/extend-conversation-status-filters.tsx index 2365b99f90d8..94dbab427cb0 100644 --- a/source/features/extend-conversation-status-filters.tsx +++ b/source/features/extend-conversation-status-filters.tsx @@ -1,7 +1,7 @@ import React from 'dom-chef'; -import {$optional} from 'select-dom/strict.js'; -import CheckIcon from 'octicons-plain-react/Check'; import * as pageDetect from 'github-url-detection'; +import CheckIcon from 'octicons-plain-react/Check'; +import {$optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import SearchQuery from '../github-helpers/search-query.js'; diff --git a/source/features/extend-diff-expander.tsx b/source/features/extend-diff-expander.tsx index 773a1c4482f1..853cabbe4059 100644 --- a/source/features/extend-diff-expander.tsx +++ b/source/features/extend-diff-expander.tsx @@ -1,8 +1,8 @@ import './extend-diff-expander.css'; -import {$} from 'select-dom/strict.js'; import delegate, {type DelegateEvent} from 'delegate-it'; import * as pageDetect from 'github-url-detection'; +import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; diff --git a/source/features/file-age-color.tsx b/source/features/file-age-color.tsx index ac0f8c5183f0..849159c1c789 100644 --- a/source/features/file-age-color.tsx +++ b/source/features/file-age-color.tsx @@ -6,9 +6,9 @@ This feature is documented at https://github.com/refined-github/refined-github/w import * as pageDetect from 'github-url-detection'; -import observe from '../helpers/selector-observer.js'; import features from '../feature-manager.js'; import {createHeatIndexFunction} from '../helpers/math.js'; +import observe from '../helpers/selector-observer.js'; const calculateHeatIndex = createHeatIndexFunction([0, -2_000_000_000]); const month = 30 * 24 * 60 * 60 * 1000; diff --git a/source/features/fit-textareas.tsx b/source/features/fit-textareas.tsx index 0f29850fa833..22e609e7ab9b 100644 --- a/source/features/fit-textareas.tsx +++ b/source/features/fit-textareas.tsx @@ -1,9 +1,9 @@ import './fit-textareas.css'; -import {isSafari} from 'webext-detect'; import fitTextarea from 'fit-textarea'; -import {$} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$} from 'select-dom/strict.js'; +import {isSafari} from 'webext-detect'; import features from '../feature-manager.js'; import observe from '../helpers/selector-observer.js'; diff --git a/source/features/fix-no-pr-search.tsx b/source/features/fix-no-pr-search.tsx index dc6cc860d46f..f47d14897d8e 100644 --- a/source/features/fix-no-pr-search.tsx +++ b/source/features/fix-no-pr-search.tsx @@ -1,5 +1,5 @@ -import * as pageDetect from 'github-url-detection'; import delegate, {type DelegateEvent} from 'delegate-it'; +import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; import SearchQuery from '../github-helpers/search-query.js'; diff --git a/source/features/github-actions-indicators.tsx b/source/features/github-actions-indicators.tsx index d71e2d9c72d6..d84ad4142b01 100644 --- a/source/features/github-actions-indicators.tsx +++ b/source/features/github-actions-indicators.tsx @@ -1,17 +1,17 @@ -import {CachedFunction} from 'webext-storage-cache'; -import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; -import PlayIcon from 'octicons-plain-react/Play'; import {parseCron} from '@fregante/mi-cron'; +import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; +import PlayIcon from 'octicons-plain-react/Play'; +import {$} from 'select-dom/strict.js'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; +import {expectToken} from '../github-helpers/github-token.js'; import {cacheByRepo} from '../github-helpers/index.js'; +import removeHashFromUrlBar from '../helpers/history.js'; import observe from '../helpers/selector-observer.js'; import GetWorkflows from './github-actions-indicators.gql'; -import {expectToken} from '../github-helpers/github-token.js'; -import removeHashFromUrlBar from '../helpers/history.js'; type Workflow = { name: string; diff --git a/source/features/global-conversation-list-filters.tsx b/source/features/global-conversation-list-filters.tsx index 3574f0e19ebf..42fe54027548 100644 --- a/source/features/global-conversation-list-filters.tsx +++ b/source/features/global-conversation-list-filters.tsx @@ -1,8 +1,8 @@ import './global-conversation-list-filters.css'; import React from 'dom-chef'; -import {$$, elementExists} from 'select-dom'; import * as pageDetect from 'github-url-detection'; +import {$$, elementExists} from 'select-dom'; import features from '../feature-manager.js'; import SearchQuery from '../github-helpers/search-query.js'; diff --git a/source/features/hidden-review-comments-indicator.tsx b/source/features/hidden-review-comments-indicator.tsx index cc1b18eafdbf..6fd3ec5ff360 100644 --- a/source/features/hidden-review-comments-indicator.tsx +++ b/source/features/hidden-review-comments-indicator.tsx @@ -1,12 +1,12 @@ import './hidden-review-comments-indicator.css'; -import mem from 'memoize'; +import {onAbort} from 'abort-utils'; +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; -import {$$, countElements} from 'select-dom'; -import CommentIcon from 'octicons-plain-react/Comment'; import * as pageDetect from 'github-url-detection'; -import delegate, {type DelegateEvent} from 'delegate-it'; -import {onAbort} from 'abort-utils'; +import mem from 'memoize'; +import CommentIcon from 'octicons-plain-react/Comment'; +import {$$, countElements} from 'select-dom'; import features from '../feature-manager.js'; import preserveScroll from '../helpers/preserve-scroll.js'; diff --git a/source/features/hide-inactive-deployments.tsx b/source/features/hide-inactive-deployments.tsx index f06b9d07271c..b18d82de169d 100644 --- a/source/features/hide-inactive-deployments.tsx +++ b/source/features/hide-inactive-deployments.tsx @@ -1,5 +1,5 @@ -import {$$, elementExists} from 'select-dom'; import * as pageDetect from 'github-url-detection'; +import {$$, elementExists} from 'select-dom'; import features from '../feature-manager.js'; diff --git a/source/features/hide-low-quality-comments.tsx b/source/features/hide-low-quality-comments.tsx index 277be6397adc..6211ce38ac22 100644 --- a/source/features/hide-low-quality-comments.tsx +++ b/source/features/hide-low-quality-comments.tsx @@ -1,13 +1,13 @@ import './hide-low-quality-comments.css'; +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; -import {$, $optional} from 'select-dom/strict.js'; -import {$$, countElements, elementExists} from 'select-dom'; import * as pageDetect from 'github-url-detection'; -import delegate, {type DelegateEvent} from 'delegate-it'; +import {$$, countElements, elementExists} from 'select-dom'; +import {$, $optional} from 'select-dom/strict.js'; -import delay from '../helpers/delay.js'; import features from '../feature-manager.js'; +import delay from '../helpers/delay.js'; import isLowQualityComment from '../helpers/is-low-quality-comment.js'; export const singleParagraphCommentSelector = '.comment-body > p:only-child'; diff --git a/source/features/highest-rated-comment.tsx b/source/features/highest-rated-comment.tsx index 3b2c1c8b9093..bc0d0378b4fe 100644 --- a/source/features/highest-rated-comment.tsx +++ b/source/features/highest-rated-comment.tsx @@ -1,16 +1,16 @@ import './highest-rated-comment.css'; -import mem from 'memoize'; import React from 'dom-chef'; -import {$, $optional} from 'select-dom/strict.js'; -import {$$} from 'select-dom'; import * as pageDetect from 'github-url-detection'; +import mem from 'memoize'; import ArrowDownIcon from 'octicons-plain-react/ArrowDown'; import CheckCircleFillIcon from 'octicons-plain-react/CheckCircleFill'; +import {$$} from 'select-dom'; +import {$, $optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; -import looseParseInt from '../helpers/loose-parse-int.js'; import isLowQualityComment from '../helpers/is-low-quality-comment.js'; +import looseParseInt from '../helpers/loose-parse-int.js'; import {singleParagraphCommentSelector} from './hide-low-quality-comments.js'; // `.js-timeline-item` gets the nearest comment excluding the very first comment (OP post) diff --git a/source/features/highlight-non-default-base-branch.tsx b/source/features/highlight-non-default-base-branch.tsx index 8823b49b39f0..07eb27f30cde 100644 --- a/source/features/highlight-non-default-base-branch.tsx +++ b/source/features/highlight-non-default-base-branch.tsx @@ -1,14 +1,14 @@ +import batchedFunction from 'batched-function'; import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; import GitPullRequestIcon from 'octicons-plain-react/GitPullRequest'; -import batchedFunction from 'batched-function'; import {elementExists} from 'select-dom'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import observe from '../helpers/selector-observer.js'; import {expectToken} from '../github-helpers/github-token.js'; import abbreviateString from '../helpers/abbreviate-string.js'; +import observe from '../helpers/selector-observer.js'; type BaseBranch = { ref: string | undefined; diff --git a/source/features/improve-shortcut-help.tsx b/source/features/improve-shortcut-help.tsx index 4a304ee59c14..7cc7323a0cb1 100644 --- a/source/features/improve-shortcut-help.tsx +++ b/source/features/improve-shortcut-help.tsx @@ -1,14 +1,14 @@ import './improve-shortcut-help.css'; import React from 'dom-chef'; +import memoize from 'memoize'; import {elementExists} from 'select-dom'; import {$, $optional} from 'select-dom/strict.js'; -import memoize from 'memoize'; -import onetime from '../helpers/onetime.js'; import features from '../feature-manager.js'; import {isEditable} from '../helpers/dom-utils.js'; import {shortcutMap} from '../helpers/feature-helpers.js'; +import onetime from '../helpers/onetime.js'; import observe from '../helpers/selector-observer.js'; function splitKeys(keys: string): DocumentFragment[] { diff --git a/source/features/jump-to-change-requested-comment.tsx b/source/features/jump-to-change-requested-comment.tsx index 8877c1343207..3c1ffd95a6f1 100644 --- a/source/features/jump-to-change-requested-comment.tsx +++ b/source/features/jump-to-change-requested-comment.tsx @@ -1,9 +1,9 @@ import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$} from 'select-dom/strict.js'; -import {wrap} from '../helpers/dom-utils.js'; import features from '../feature-manager.js'; +import {wrap} from '../helpers/dom-utils.js'; import observe from '../helpers/selector-observer.js'; function linkify(textLine: HTMLElement): void { diff --git a/source/features/jump-to-conversation-close-event.tsx b/source/features/jump-to-conversation-close-event.tsx index 656727aaa0c3..ba1b0b459c7d 100644 --- a/source/features/jump-to-conversation-close-event.tsx +++ b/source/features/jump-to-conversation-close-event.tsx @@ -1,13 +1,13 @@ +import debounce from 'debounce-fn'; import React from 'dom-chef'; -import {$, $$, lastElement} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; -import debounce from 'debounce-fn'; +import {$, $$, lastElement} from 'select-dom/strict.js'; -import {wrap} from '../helpers/dom-utils.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import {conversationCloseEvent} from '../github-helpers/selectors.js'; +import {wrap} from '../helpers/dom-utils.js'; import {getIdentifiers} from '../helpers/feature-helpers.js'; +import observe from '../helpers/selector-observer.js'; import './jump-to-conversation-close-event.css'; export const statusBadgeSelector = [ diff --git a/source/features/keyboard-navigation.tsx b/source/features/keyboard-navigation.tsx index c7b45d3a50f6..e20a628218a0 100644 --- a/source/features/keyboard-navigation.tsx +++ b/source/features/keyboard-navigation.tsx @@ -1,10 +1,10 @@ -import {$optional} from 'select-dom/strict.js'; -import {$$, elementExists} from 'select-dom'; import * as pageDetect from 'github-url-detection'; +import {$$, elementExists} from 'select-dom'; +import {$optional} from 'select-dom/strict.js'; +import features from '../feature-manager.js'; import {isEditable} from '../helpers/dom-utils.js'; import {viewedToggleSelector} from './batch-mark-files-as-viewed.js'; -import features from '../feature-manager.js'; const isCommentGroupMinimized = (comment: HTMLElement): boolean => elementExists('.minimized-comment:not(.d-none)', comment) diff --git a/source/features/last-notification-page-button.tsx b/source/features/last-notification-page-button.tsx index 1c9bb5ae284e..0a4ed5b5676e 100644 --- a/source/features/last-notification-page-button.tsx +++ b/source/features/last-notification-page-button.tsx @@ -1,11 +1,11 @@ import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$} from 'select-dom/strict.js'; import {stringToBase64} from 'uint8array-extras'; import features from '../feature-manager.js'; -import looseParseInt from '../helpers/loose-parse-int.js'; import {assertNodeContent} from '../helpers/dom-utils.js'; +import looseParseInt from '../helpers/loose-parse-int.js'; import observe from '../helpers/selector-observer.js'; const itemsPerNotificationsPage = 25; diff --git a/source/features/link-to-changelog-file.tsx b/source/features/link-to-changelog-file.tsx index 751748b5712d..8b6757875136 100644 --- a/source/features/link-to-changelog-file.tsx +++ b/source/features/link-to-changelog-file.tsx @@ -1,7 +1,7 @@ import React from 'dom-chef'; -import {CachedFunction} from 'webext-storage-cache'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; diff --git a/source/features/link-to-compare-diff.tsx b/source/features/link-to-compare-diff.tsx index 64d16de60b67..88c80375e43b 100644 --- a/source/features/link-to-compare-diff.tsx +++ b/source/features/link-to-compare-diff.tsx @@ -1,12 +1,12 @@ import './link-to-compare-diff.css'; import React from 'dom-chef'; -import {elementExists} from 'select-dom'; import * as pageDetect from 'github-url-detection'; +import {elementExists} from 'select-dom'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import {wrapAll} from '../helpers/dom-utils.js'; +import observe from '../helpers/selector-observer.js'; function linkify(changedFilesSummary: HTMLElement): void { wrapAll( diff --git a/source/features/linkify-branch-references.tsx b/source/features/linkify-branch-references.tsx index 7875c5b87620..667d62061cfd 100644 --- a/source/features/linkify-branch-references.tsx +++ b/source/features/linkify-branch-references.tsx @@ -1,7 +1,7 @@ import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; -import {$, $optional} from 'select-dom/strict.js'; import {$$} from 'select-dom'; +import {$, $optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import GitHubFileUrl from '../github-helpers/github-file-url.js'; diff --git a/source/features/linkify-commit-sha.tsx b/source/features/linkify-commit-sha.tsx index 47d7cbce1e1b..326e31398ddd 100644 --- a/source/features/linkify-commit-sha.tsx +++ b/source/features/linkify-commit-sha.tsx @@ -1,9 +1,9 @@ import React from 'dom-chef'; -import {$optional} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$optional} from 'select-dom/strict.js'; -import {wrap} from '../helpers/dom-utils.js'; import features from '../feature-manager.js'; +import {wrap} from '../helpers/dom-utils.js'; function init(): void { const element = $optional('.sha.user-select-contain:not(a *)'); diff --git a/source/features/linkify-line-numbers.tsx b/source/features/linkify-line-numbers.tsx index 698bd1b14b4b..ced76fe01736 100644 --- a/source/features/linkify-line-numbers.tsx +++ b/source/features/linkify-line-numbers.tsx @@ -1,6 +1,6 @@ -import * as pageDetect from 'github-url-detection'; import delegate, {type DelegateEvent} from 'delegate-it'; import {isAlteredClick} from 'filter-altered-clicks'; +import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; diff --git a/source/features/linkify-symbolic-links.tsx b/source/features/linkify-symbolic-links.tsx index 5dc28937bf23..18c7320c0fe0 100644 --- a/source/features/linkify-symbolic-links.tsx +++ b/source/features/linkify-symbolic-links.tsx @@ -1,11 +1,11 @@ import React from 'dom-chef'; -import {$optional} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$optional} from 'select-dom/strict.js'; -import {wrap} from '../helpers/dom-utils.js'; +import features from '../feature-manager.js'; import {repositionAnchors} from '../github-helpers/dom-formatters.js'; +import {wrap} from '../helpers/dom-utils.js'; import observe from '../helpers/selector-observer.js'; -import features from '../feature-manager.js'; function linkify(line: HTMLElement): void { if ($optional('a[class*="CodeSizeDetails-module__PrimerLink"]')?.textContent === 'Symbolic Link') { diff --git a/source/features/linkify-text.tsx b/source/features/linkify-text.tsx index 57bddf655bf7..76a458760cb5 100644 --- a/source/features/linkify-text.tsx +++ b/source/features/linkify-text.tsx @@ -3,10 +3,10 @@ import * as pageDetect from 'github-url-detection'; import {elementExists} from 'select-dom'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; -import {getRepo} from '../github-helpers/index.js'; import {linkifyIssues} from '../github-helpers/dom-formatters.js'; +import {getRepo} from '../github-helpers/index.js'; import {logError} from '../helpers/errors.js'; +import observe from '../helpers/selector-observer.js'; function linkifyIssue(paragraph: HTMLParagraphElement): void { // Already linkified diff --git a/source/features/linkify-user-labels.tsx b/source/features/linkify-user-labels.tsx index 32776c267fc5..a3362c214609 100644 --- a/source/features/linkify-user-labels.tsx +++ b/source/features/linkify-user-labels.tsx @@ -1,13 +1,13 @@ import './linkify-user-labels.css'; import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$} from 'select-dom/strict.js'; -import {wrap} from '../helpers/dom-utils.js'; import features from '../feature-manager.js'; -import {buildRepoUrl} from '../github-helpers/index.js'; import getCommentAuthor from '../github-helpers/get-comment-author.js'; +import {buildRepoUrl} from '../github-helpers/index.js'; +import {wrap} from '../helpers/dom-utils.js'; import observe from '../helpers/selector-observer.js'; function getAuthor(label: HTMLElement): string { diff --git a/source/features/linkify-user-location.tsx b/source/features/linkify-user-location.tsx index 85a6fadba4fc..698bfd5dc31b 100644 --- a/source/features/linkify-user-location.tsx +++ b/source/features/linkify-user-location.tsx @@ -1,8 +1,8 @@ import React from 'dom-chef'; -import onetime from '../helpers/onetime.js'; import features from '../feature-manager.js'; import {wrap} from '../helpers/dom-utils.js'; +import onetime from '../helpers/onetime.js'; import observe from '../helpers/selector-observer.js'; function addLocation({nextElementSibling, nextSibling}: SVGElement): Element { diff --git a/source/features/list-prs-for-branch.tsx b/source/features/list-prs-for-branch.tsx index f6cf2d7e42c1..dcbd03442565 100644 --- a/source/features/list-prs-for-branch.tsx +++ b/source/features/list-prs-for-branch.tsx @@ -2,12 +2,12 @@ import React from 'dom-chef'; import features from '../feature-manager.js'; import getCurrentGitRef from '../github-helpers/get-current-git-ref.js'; -import isDefaultBranch from '../github-helpers/is-default-branch.js'; -import {pullRequestsAssociatedWithBranch, stateIcon} from './show-associated-branch-prs-on-fork.js'; +import {expectToken} from '../github-helpers/github-token.js'; import {addAfterBranchSelector, isPermalink, isRepoCommitListRoot} from '../github-helpers/index.js'; -import observe from '../helpers/selector-observer.js'; +import isDefaultBranch from '../github-helpers/is-default-branch.js'; import {branchSelectorParent} from '../github-helpers/selectors.js'; -import {expectToken} from '../github-helpers/github-token.js'; +import observe from '../helpers/selector-observer.js'; +import {pullRequestsAssociatedWithBranch, stateIcon} from './show-associated-branch-prs-on-fork.js'; // Taken from https://github.com/fregante/github-issue-link-status/blob/98792f2837352bacbf80664f3edbcec8e579ed17/source/github-issue-link-status.js#L10 const stateColorMap = { diff --git a/source/features/list-prs-for-file.tsx b/source/features/list-prs-for-file.tsx index 4eba178f7ce6..1568a2c1fa85 100644 --- a/source/features/list-prs-for-file.tsx +++ b/source/features/list-prs-for-file.tsx @@ -1,18 +1,18 @@ import React from 'dom-chef'; -import {CachedFunction} from 'webext-storage-cache'; -import {isFirefox} from 'webext-detect'; import * as pageDetect from 'github-url-detection'; import AlertIcon from 'octicons-plain-react/Alert'; import GitPullRequestIcon from 'octicons-plain-react/GitPullRequest'; +import {isFirefox} from 'webext-detect'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; import getDefaultBranch from '../github-helpers/get-default-branch.js'; -import {buildRepoUrl, cacheByRepo} from '../github-helpers/index.js'; import GitHubFileUrl from '../github-helpers/github-file-url.js'; +import {expectToken} from '../github-helpers/github-token.js'; +import {buildRepoUrl, cacheByRepo} from '../github-helpers/index.js'; import observe from '../helpers/selector-observer.js'; import listPrsForFileQuery from './list-prs-for-file.gql'; -import {expectToken} from '../github-helpers/github-token.js'; function getPrUrl(prNumber: number): string { // https://caniuse.com/url-scroll-to-text-fragment diff --git a/source/features/locked-issue.tsx b/source/features/locked-issue.tsx index c70976a64080..74a76e2b626f 100644 --- a/source/features/locked-issue.tsx +++ b/source/features/locked-issue.tsx @@ -1,11 +1,11 @@ -import React from 'react'; -import LockIcon from 'octicons-plain-react/Lock'; import * as pageDetect from 'github-url-detection'; +import LockIcon from 'octicons-plain-react/Lock'; +import React from 'react'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import isConversationLocked from '../github-helpers/is-conversation-locked.js'; import {getIdentifiers} from '../helpers/feature-helpers.js'; +import observe from '../helpers/selector-observer.js'; import {featureClass as jumpToCloseEventClass} from './jump-to-conversation-close-event.js'; export const {class: featureClass, selector: featureSelector} = getIdentifiers(import.meta.url); diff --git a/source/features/mark-merge-commits-in-list.tsx b/source/features/mark-merge-commits-in-list.tsx index e17788bde5f0..b49672db5a2b 100644 --- a/source/features/mark-merge-commits-in-list.tsx +++ b/source/features/mark-merge-commits-in-list.tsx @@ -1,18 +1,18 @@ import './mark-merge-commits-in-list.css'; +import batchedFunction from 'batched-function'; import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; -import {objectEntries} from 'ts-extras'; import GitMergeIcon from 'octicons-plain-react/GitMerge'; -import batchedFunction from 'batched-function'; +import {$} from 'select-dom/strict.js'; +import {objectEntries} from 'ts-extras'; -import observe from '../helpers/selector-observer.js'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import {commitHashLinkInLists, commitTitleInLists} from '../github-helpers/selectors.js'; -import {assertCommitHash} from '../github-helpers/index.js'; import {expectToken} from '../github-helpers/github-token.js'; +import {assertCommitHash} from '../github-helpers/index.js'; +import {commitHashLinkInLists, commitTitleInLists} from '../github-helpers/selectors.js'; +import observe from '../helpers/selector-observer.js'; const filterMergeCommits = async (commits: string[]): Promise => { const {repository} = await api.v4(` diff --git a/source/features/mark-private-orgs.tsx b/source/features/mark-private-orgs.tsx index 4c2ba0253ce1..2e97e0c5b4b1 100644 --- a/source/features/mark-private-orgs.tsx +++ b/source/features/mark-private-orgs.tsx @@ -1,9 +1,9 @@ import './mark-private-orgs.css'; import React from 'dom-chef'; -import {CachedFunction} from 'webext-storage-cache'; -import EyeClosedIcon from 'octicons-plain-react/EyeClosed'; import * as pageDetect from 'github-url-detection'; +import EyeClosedIcon from 'octicons-plain-react/EyeClosed'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; diff --git a/source/features/more-dropdown-links.tsx b/source/features/more-dropdown-links.tsx index a8c55373f8f3..cb3746c52ead 100644 --- a/source/features/more-dropdown-links.tsx +++ b/source/features/more-dropdown-links.tsx @@ -1,21 +1,21 @@ import './more-dropdown-links.css'; import React from 'dom-chef'; -import {elementExists} from 'select-dom'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; import GitBranchIcon from 'octicons-plain-react/GitBranch'; -import GitCompareIcon from 'octicons-plain-react/GitCompare'; import GitCommitIcon from 'octicons-plain-react/GitCommit'; +import GitCompareIcon from 'octicons-plain-react/GitCompare'; import PackageDependenciesIcon from 'octicons-plain-react/PackageDependencies'; +import {elementExists} from 'select-dom'; import features from '../feature-manager.js'; -import getDefaultBranch from '../github-helpers/get-default-branch.js'; import createDropdownItem from '../github-helpers/create-dropdown-item.js'; -import {buildRepoUrl} from '../github-helpers/index.js'; import getCurrentGitRef from '../github-helpers/get-current-git-ref.js'; -import observe from '../helpers/selector-observer.js'; +import getDefaultBranch from '../github-helpers/get-default-branch.js'; import {expectToken} from '../github-helpers/github-token.js'; +import {buildRepoUrl} from '../github-helpers/index.js'; +import observe from '../helpers/selector-observer.js'; export async function unhideOverflowDropdown(): Promise { // Wait for the tab bar to be loaded diff --git a/source/features/more-file-links.tsx b/source/features/more-file-links.tsx index 6e6c9a3275b8..260740d91f61 100644 --- a/source/features/more-file-links.tsx +++ b/source/features/more-file-links.tsx @@ -1,10 +1,10 @@ +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; -import delegate, {type DelegateEvent} from 'delegate-it'; import FileCodeIcon from 'octicons-plain-react/FileCode'; -import VersionsIcon from 'octicons-plain-react/Versions'; import HistoryIcon from 'octicons-plain-react/History'; +import VersionsIcon from 'octicons-plain-react/Versions'; +import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import GitHubFileUrl from '../github-helpers/github-file-url.js'; diff --git a/source/features/netiquette.tsx b/source/features/netiquette.tsx index 95b2cfc18aa4..87f7c014c6ed 100644 --- a/source/features/netiquette.tsx +++ b/source/features/netiquette.tsx @@ -1,16 +1,17 @@ +import toMilliseconds from '@sindresorhus/to-milliseconds'; import React from 'dom-chef'; -import FlameIcon from 'octicons-plain-react/Flame'; import * as pageDetect from 'github-url-detection'; -import toMilliseconds from '@sindresorhus/to-milliseconds'; -import {$optional} from 'select-dom/strict.js'; +import FlameIcon from 'octicons-plain-react/Flame'; +import GitPullRequestDraftIcon from 'octicons-plain-react/GitPullRequestDraft'; +import InfoIcon from 'octicons-plain-react/Info'; import {countElements, elementExists} from 'select-dom'; +import {$optional} from 'select-dom/strict.js'; import twas from 'twas'; -import InfoIcon from 'octicons-plain-react/Info'; -import GitPullRequestDraftIcon from 'octicons-plain-react/GitPullRequestDraft'; -import createBanner from '../github-helpers/banner.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; +import api from '../github-helpers/api.js'; +import createBanner from '../github-helpers/banner.js'; +import {userIsModerator} from '../github-helpers/get-user-permission.js'; import { areDiscussionsEnabled, areIssuesEnabled, @@ -20,9 +21,8 @@ import { isOwnConversation, } from '../github-helpers/index.js'; import {newCommentField} from '../github-helpers/selectors.js'; -import {userIsModerator} from '../github-helpers/get-user-permission.js'; import looseParseInt from '../helpers/loose-parse-int.js'; -import api from '../github-helpers/api.js'; +import observe from '../helpers/selector-observer.js'; export async function getCloseDate(): Promise { if (pageDetect.isOpenConversation()) { diff --git a/source/features/new-milestone-button.tsx b/source/features/new-milestone-button.tsx index b0c01bec6c2e..17b28ef6a205 100644 --- a/source/features/new-milestone-button.tsx +++ b/source/features/new-milestone-button.tsx @@ -2,8 +2,8 @@ import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import {buildRepoUrl} from '../github-helpers/index.js'; +import observe from '../helpers/selector-observer.js'; function addButton(editButton: Element): void { editButton.before( diff --git a/source/features/new-or-deleted-file.tsx b/source/features/new-or-deleted-file.tsx index 55a85ac2dabd..3efd0b233196 100644 --- a/source/features/new-or-deleted-file.tsx +++ b/source/features/new-or-deleted-file.tsx @@ -1,6 +1,6 @@ import React from 'dom-chef'; -import {$, $optional} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$, $optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import observe from '../helpers/selector-observer.js'; diff --git a/source/features/new-repo-disable-projects-and-wikis.tsx b/source/features/new-repo-disable-projects-and-wikis.tsx index 85daf427c94e..4bf957c76896 100644 --- a/source/features/new-repo-disable-projects-and-wikis.tsx +++ b/source/features/new-repo-disable-projects-and-wikis.tsx @@ -1,15 +1,15 @@ -import React from 'dom-chef'; -import {$, $optional} from 'select-dom/strict.js'; import delegate from 'delegate-it'; +import React from 'dom-chef'; import domLoaded from 'dom-loaded'; import * as pageDetect from 'github-url-detection'; import {elementExists} from 'select-dom'; +import {$, $optional} from 'select-dom/strict.js'; -import onetime from '../helpers/onetime.js'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import observe from '../helpers/selector-observer.js'; import {expectToken} from '../github-helpers/github-token.js'; +import onetime from '../helpers/onetime.js'; +import observe from '../helpers/selector-observer.js'; const documentation = 'https://github.com/refined-github/refined-github/wiki/Extended-feature-descriptions#new-repo-disable-projects-and-wikis'; diff --git a/source/features/no-duplicate-list-update-time.tsx b/source/features/no-duplicate-list-update-time.tsx index c98ea01a1bbb..e66d81b1326b 100644 --- a/source/features/no-duplicate-list-update-time.tsx +++ b/source/features/no-duplicate-list-update-time.tsx @@ -1,5 +1,5 @@ -import {$$} from 'select-dom'; import * as pageDetect from 'github-url-detection'; +import {$$} from 'select-dom'; import features from '../feature-manager.js'; import observe from '../helpers/selector-observer.js'; diff --git a/source/features/no-modals.tsx b/source/features/no-modals.tsx index 503e9a7c43f9..a82478b309ac 100644 --- a/source/features/no-modals.tsx +++ b/source/features/no-modals.tsx @@ -1,5 +1,5 @@ -import * as pageDetect from 'github-url-detection'; import delegate, {type DelegateEvent} from 'delegate-it'; +import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; diff --git a/source/features/one-click-diff-options.tsx b/source/features/one-click-diff-options.tsx index 7bee10f17bd2..8bdf8102dbc4 100644 --- a/source/features/one-click-diff-options.tsx +++ b/source/features/one-click-diff-options.tsx @@ -1,15 +1,15 @@ import React from 'dom-chef'; -import {elementExists} from 'select-dom'; -import {$, $optional} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; import BookIcon from 'octicons-plain-react/Book'; import CheckIcon from 'octicons-plain-react/Check'; import DiffIcon from 'octicons-plain-react/Diff'; import DiffModifiedIcon from 'octicons-plain-react/DiffModified'; +import {elementExists} from 'select-dom'; +import {$, $optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import {removeTextNodeContaining} from '../helpers/dom-utils.js'; +import observe from '../helpers/selector-observer.js'; function isHidingWhitespace(): boolean { // The selector is the native button diff --git a/source/features/one-click-pr-or-gist.tsx b/source/features/one-click-pr-or-gist.tsx index 5178506573dd..7ae8c7e16d61 100644 --- a/source/features/one-click-pr-or-gist.tsx +++ b/source/features/one-click-pr-or-gist.tsx @@ -1,9 +1,9 @@ import './one-click-pr-or-gist.css'; import React from 'dom-chef'; +import * as pageDetect from 'github-url-detection'; import {$$, elementExists} from 'select-dom'; import {$, $optional} from 'select-dom/strict.js'; -import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; diff --git a/source/features/one-click-review-submission.tsx b/source/features/one-click-review-submission.tsx index a7a38f3abafe..2b534b73e307 100644 --- a/source/features/one-click-review-submission.tsx +++ b/source/features/one-click-review-submission.tsx @@ -1,13 +1,13 @@ -import React from 'dom-chef'; import delegate, {type DelegateEvent} from 'delegate-it'; +import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; import CheckIcon from 'octicons-plain-react/Check'; import FileDiffIcon from 'octicons-plain-react/FileDiff'; import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import {assertNodeContent} from '../helpers/dom-utils.js'; +import observe from '../helpers/selector-observer.js'; function replaceCheckboxes(originalSubmitButton: HTMLButtonElement): void { const form = originalSubmitButton.form!; diff --git a/source/features/open-all-conversations.tsx b/source/features/open-all-conversations.tsx index f32b9be5eb82..86d9f6c26dc1 100644 --- a/source/features/open-all-conversations.tsx +++ b/source/features/open-all-conversations.tsx @@ -1,8 +1,8 @@ -import React from 'dom-chef'; -import {$$} from 'select-dom/strict.js'; import delegate from 'delegate-it'; +import React from 'dom-chef'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; +import {$$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import openTabs from '../helpers/open-tabs.js'; diff --git a/source/features/open-all-notifications.tsx b/source/features/open-all-notifications.tsx index 53eb1259376e..6d6e9e837a7e 100644 --- a/source/features/open-all-notifications.tsx +++ b/source/features/open-all-notifications.tsx @@ -1,18 +1,18 @@ import './open-all-notifications.css'; +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; -import {$$, elementExists} from 'select-dom'; import * as pageDetect from 'github-url-detection'; import LinkExternalIcon from 'octicons-plain-react/LinkExternal'; -import delegate, {type DelegateEvent} from 'delegate-it'; +import {$$, elementExists} from 'select-dom'; import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; -import openTabs from '../helpers/open-tabs.js'; -import {appendBefore} from '../helpers/dom-utils.js'; -import observe from '../helpers/selector-observer.js'; import {multilineAriaLabel} from '../github-helpers/index.js'; +import {appendBefore} from '../helpers/dom-utils.js'; import {getIdentifiers} from '../helpers/feature-helpers.js'; +import openTabs from '../helpers/open-tabs.js'; +import observe from '../helpers/selector-observer.js'; // Selector works on: // https://github.com/notifications (Grouped by date) diff --git a/source/features/open-issue-to-latest-comment.tsx b/source/features/open-issue-to-latest-comment.tsx index 093026b06f4d..d59820ec0c87 100644 --- a/source/features/open-issue-to-latest-comment.tsx +++ b/source/features/open-issue-to-latest-comment.tsx @@ -1,5 +1,5 @@ -import {$$} from 'select-dom'; import * as pageDetect from 'github-url-detection'; +import {$$} from 'select-dom'; import features from '../feature-manager.js'; import {openIssueToLastComment} from '../github-helpers/selectors.js'; diff --git a/source/features/parse-backticks.tsx b/source/features/parse-backticks.tsx index c87b2fb805f4..ed4232d18ba0 100644 --- a/source/features/parse-backticks.tsx +++ b/source/features/parse-backticks.tsx @@ -1,9 +1,9 @@ import './parse-backticks.css'; -import onetime from '../helpers/onetime.js'; -import observe from '../helpers/selector-observer.js'; import features from '../feature-manager.js'; import {parseBackticks} from '../github-helpers/dom-formatters.js'; +import onetime from '../helpers/onetime.js'; +import observe from '../helpers/selector-observer.js'; const selectors = [ // `isRepoHome` repository description diff --git a/source/features/pinned-issues-update-time.tsx b/source/features/pinned-issues-update-time.tsx index 42dce21eb722..a3bec679a929 100644 --- a/source/features/pinned-issues-update-time.tsx +++ b/source/features/pinned-issues-update-time.tsx @@ -1,14 +1,14 @@ -import React from 'dom-chef'; -import {CachedFunction} from 'webext-storage-cache'; import batchedFunction from 'batched-function'; +import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; +import {expectToken} from '../github-helpers/github-token.js'; import {getRepo} from '../github-helpers/index.js'; import looseParseInt from '../helpers/loose-parse-int.js'; import observe from '../helpers/selector-observer.js'; -import {expectToken} from '../github-helpers/github-token.js'; type IssueInfo = { updatedAt: string; diff --git a/source/features/pr-base-commit.tsx b/source/features/pr-base-commit.tsx index b197e2dd7dd3..ccb681bce385 100644 --- a/source/features/pr-base-commit.tsx +++ b/source/features/pr-base-commit.tsx @@ -4,15 +4,15 @@ import * as pageDetect from 'github-url-detection'; import {elementExists} from 'select-dom'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; -import {getBranches} from '../github-helpers/pr-branches.js'; -import getPrInfo, {type PullRequestInfo} from '../github-helpers/get-pr-info.js'; -import pluralize from '../helpers/pluralize.js'; -import {buildRepoUrl} from '../github-helpers/index.js'; import {linkifyCommit} from '../github-helpers/dom-formatters.js'; -import {isTextNodeContaining} from '../helpers/dom-utils.js'; +import getPrInfo, {type PullRequestInfo} from '../github-helpers/get-pr-info.js'; import {expectToken} from '../github-helpers/github-token.js'; +import {buildRepoUrl} from '../github-helpers/index.js'; +import {getBranches} from '../github-helpers/pr-branches.js'; import {deletedHeadRepository, prMergeabilityBoxCaption} from '../github-helpers/selectors.js'; +import {isTextNodeContaining} from '../helpers/dom-utils.js'; +import pluralize from '../helpers/pluralize.js'; +import observe from '../helpers/selector-observer.js'; function getBaseCommitNotice(prInfo: PullRequestInfo): JSX.Element { const {base} = getBranches(); diff --git a/source/features/pr-branch-auto-delete.tsx b/source/features/pr-branch-auto-delete.tsx index f518021c2602..dd61dcb33a59 100644 --- a/source/features/pr-branch-auto-delete.tsx +++ b/source/features/pr-branch-auto-delete.tsx @@ -1,15 +1,15 @@ import React from 'dom-chef'; -import InfoIcon from 'octicons-plain-react/Info'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; +import InfoIcon from 'octicons-plain-react/Info'; -import api from '../github-helpers/api.js'; import features from '../feature-manager.js'; import waitForPrMerge from '../github-events/on-pr-merge.js'; +import api from '../github-helpers/api.js'; +import {userCanLikelyMergePr} from '../github-helpers/index.js'; import {getBranches} from '../github-helpers/pr-branches.js'; import matchesAnyPattern from '../helpers/matches-any-patterns.js'; import GetPrsToBaseBranchAndDeleteOnMerge from './pr-branch-auto-delete.gql'; -import {userCanLikelyMergePr} from '../github-helpers/index.js'; // DO NOT ask for additions or customizations. This is just a list of "obvious" permanent branches. // Protect your permanent branches instead: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches diff --git a/source/features/pr-commit-lines-changed.tsx b/source/features/pr-commit-lines-changed.tsx index 70848d91ef15..137d79d62d2d 100644 --- a/source/features/pr-commit-lines-changed.tsx +++ b/source/features/pr-commit-lines-changed.tsx @@ -1,7 +1,7 @@ import React from 'dom-chef'; -import {CachedFunction} from 'webext-storage-cache'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; diff --git a/source/features/pr-filters.tsx b/source/features/pr-filters.tsx index 3cdb1d9cb815..cef54981ea31 100644 --- a/source/features/pr-filters.tsx +++ b/source/features/pr-filters.tsx @@ -1,16 +1,16 @@ import React from 'dom-chef'; -import {CachedFunction} from 'webext-storage-cache'; -import {$} from 'select-dom/strict.js'; -import CheckIcon from 'octicons-plain-react/Check'; import * as pageDetect from 'github-url-detection'; +import CheckIcon from 'octicons-plain-react/Check'; +import {$} from 'select-dom/strict.js'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import observe from '../helpers/selector-observer.js'; -import {cacheByRepo} from '../github-helpers/index.js'; -import HasChecks from './pr-filters.gql'; import {expectToken} from '../github-helpers/github-token.js'; +import {cacheByRepo} from '../github-helpers/index.js'; import SearchQuery from '../github-helpers/search-query.js'; +import observe from '../helpers/selector-observer.js'; +import HasChecks from './pr-filters.gql'; const reviewsFilterSelector = '#reviews-select-menu'; diff --git a/source/features/pr-first-commit-title.tsx b/source/features/pr-first-commit-title.tsx index 36a03e4c522f..8cd8cf7ac9fa 100644 --- a/source/features/pr-first-commit-title.tsx +++ b/source/features/pr-first-commit-title.tsx @@ -1,12 +1,12 @@ +import * as pageDetect from 'github-url-detection'; import {elementExists} from 'select-dom'; import {$, $optional} from 'select-dom/strict.js'; -import * as pageDetect from 'github-url-detection'; import {insertTextIntoField, setFieldText} from 'text-field-edit'; import features from '../feature-manager.js'; +import parseRenderedText from '../github-helpers/parse-rendered-text.js'; import looseParseInt from '../helpers/loose-parse-int.js'; import observe from '../helpers/selector-observer.js'; -import parseRenderedText from '../github-helpers/parse-rendered-text.js'; function getFirstCommit(firstCommitTitle: HTMLElement): {title: string; body: string | undefined} { const body = $optional('.Details-content--hidden pre', firstCommitTitle.parentElement!) diff --git a/source/features/pr-jump-to-first-non-viewed-file.tsx b/source/features/pr-jump-to-first-non-viewed-file.tsx index d1d4210c14fb..2ebd49a02990 100644 --- a/source/features/pr-jump-to-first-non-viewed-file.tsx +++ b/source/features/pr-jump-to-first-non-viewed-file.tsx @@ -1,7 +1,7 @@ -import {$optional} from 'select-dom/strict.js'; -import elementReady from 'element-ready'; import delegate from 'delegate-it'; +import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; +import {$optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; diff --git a/source/features/prevent-comment-loss.tsx b/source/features/prevent-comment-loss.tsx index 729269743ded..052826690229 100644 --- a/source/features/prevent-comment-loss.tsx +++ b/source/features/prevent-comment-loss.tsx @@ -1,6 +1,6 @@ -import * as pageDetect from 'github-url-detection'; import delegate, {type DelegateEvent} from 'delegate-it'; import filterAlteredClicks from 'filter-altered-clicks'; +import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; diff --git a/source/features/prevent-duplicate-pr-submission.tsx b/source/features/prevent-duplicate-pr-submission.tsx index b6ebc6a9d4e3..ceab30fed4ff 100644 --- a/source/features/prevent-duplicate-pr-submission.tsx +++ b/source/features/prevent-duplicate-pr-submission.tsx @@ -1,5 +1,5 @@ -import * as pageDetect from 'github-url-detection'; import delegate, {type DelegateEvent} from 'delegate-it'; +import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; diff --git a/source/features/preview-hidden-comments.tsx b/source/features/preview-hidden-comments.tsx index b328e99903c2..00d3fa2daf02 100644 --- a/source/features/preview-hidden-comments.tsx +++ b/source/features/preview-hidden-comments.tsx @@ -1,8 +1,8 @@ import './preview-hidden-comments.css'; import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import {upperCaseFirst} from '../github-helpers/index.js'; diff --git a/source/features/previous-next-commit-buttons.tsx b/source/features/previous-next-commit-buttons.tsx index 79f30d2aeb63..4fc6e126752b 100644 --- a/source/features/previous-next-commit-buttons.tsx +++ b/source/features/previous-next-commit-buttons.tsx @@ -1,6 +1,6 @@ import React from 'dom-chef'; -import {$, $optional} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$, $optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; diff --git a/source/features/previous-version.tsx b/source/features/previous-version.tsx index 76674f65e959..8aaf416f8518 100644 --- a/source/features/previous-version.tsx +++ b/source/features/previous-version.tsx @@ -1,16 +1,16 @@ import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; import VersionsIcon from 'octicons-plain-react/Versions'; -import {$} from 'select-dom/strict.js'; import {elementExists} from 'select-dom'; +import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; +import onReactPageUpdate from '../github-events/on-react-page-update.js'; import api from '../github-helpers/api.js'; import GitHubFileUrl from '../github-helpers/github-file-url.js'; -import previousVersionQuery from './previous-version.gql'; -import onReactPageUpdate from '../github-events/on-react-page-update.js'; import {expectToken} from '../github-helpers/github-token.js'; +import observe from '../helpers/selector-observer.js'; +import previousVersionQuery from './previous-version.gql'; async function getPreviousCommitForFile(pathname: string): Promise { const {user, repository, branch, filePath} = new GitHubFileUrl(pathname); diff --git a/source/features/profile-gists-link.tsx b/source/features/profile-gists-link.tsx index 6989a182a38b..2a6d0a219507 100644 --- a/source/features/profile-gists-link.tsx +++ b/source/features/profile-gists-link.tsx @@ -1,18 +1,18 @@ import React from 'dom-chef'; -import {CachedFunction} from 'webext-storage-cache'; -import {$} from 'select-dom/strict.js'; -import {elementExists} from 'select-dom'; import * as pageDetect from 'github-url-detection'; import CodeSquareIcon from 'octicons-plain-react/CodeSquare'; +import {elementExists} from 'select-dom'; +import {$} from 'select-dom/strict.js'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import {getCleanPathname, triggerRepoNavOverflow} from '../github-helpers/index.js'; import createDropdownItem from '../github-helpers/create-dropdown-item.js'; +import {expectToken} from '../github-helpers/github-token.js'; +import {getCleanPathname, triggerRepoNavOverflow} from '../github-helpers/index.js'; +import {repoUnderlineNavDropdownUl} from '../github-helpers/selectors.js'; import observe from '../helpers/selector-observer.js'; import GetGistCount from './profile-gists-link.gql'; -import {repoUnderlineNavDropdownUl} from '../github-helpers/selectors.js'; -import {expectToken} from '../github-helpers/github-token.js'; const gistCount = new CachedFunction('gist-count', { async updater(username: string): Promise { diff --git a/source/features/profile-hotkey.tsx b/source/features/profile-hotkey.tsx index 09615e2c62a9..15ff5b483d3f 100644 --- a/source/features/profile-hotkey.tsx +++ b/source/features/profile-hotkey.tsx @@ -1,9 +1,9 @@ import {isEnterprise} from 'github-url-detection'; -import onetime from '../helpers/onetime.js'; import features from '../feature-manager.js'; -import {getLoggedInUser} from '../github-helpers/index.js'; import {registerHotkey} from '../github-helpers/hotkey.js'; +import {getLoggedInUser} from '../github-helpers/index.js'; +import onetime from '../helpers/onetime.js'; function initOnce(): void { // This patterns also works on gist.github.com diff --git a/source/features/pull-request-hotkeys.tsx b/source/features/pull-request-hotkeys.tsx index 1c68e851881e..f4d1975259d3 100644 --- a/source/features/pull-request-hotkeys.tsx +++ b/source/features/pull-request-hotkeys.tsx @@ -1,6 +1,6 @@ -import {$$} from 'select-dom/strict.js'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; +import {$$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import {addHotkey} from '../github-helpers/hotkey.js'; diff --git a/source/features/quick-comment-edit.tsx b/source/features/quick-comment-edit.tsx index adea5804647e..893dfda67c37 100644 --- a/source/features/quick-comment-edit.tsx +++ b/source/features/quick-comment-edit.tsx @@ -1,13 +1,13 @@ import React from 'dom-chef'; -import {elementExists} from 'select-dom'; -import PencilIcon from 'octicons-plain-react/Pencil'; import * as pageDetect from 'github-url-detection'; import memoize from 'memoize'; +import PencilIcon from 'octicons-plain-react/Pencil'; +import {elementExists} from 'select-dom'; -import observe from '../helpers/selector-observer.js'; import features from '../feature-manager.js'; -import {isArchivedRepoAsync} from '../github-helpers/index.js'; import {userIsModerator} from '../github-helpers/get-user-permission.js'; +import {isArchivedRepoAsync} from '../github-helpers/index.js'; +import observe from '../helpers/selector-observer.js'; // The signal is only used to memoize calls on the current page. A new page load will use a new signal. const isIssueIneditable = memoize( diff --git a/source/features/quick-file-edit.tsx b/source/features/quick-file-edit.tsx index 1ed02c7da109..1715c676cee8 100644 --- a/source/features/quick-file-edit.tsx +++ b/source/features/quick-file-edit.tsx @@ -1,15 +1,15 @@ import './quick-file-edit.css'; import React from 'dom-chef'; -import PencilIcon from 'octicons-plain-react/Pencil'; import * as pageDetect from 'github-url-detection'; +import PencilIcon from 'octicons-plain-react/Pencil'; -import {wrap} from '../helpers/dom-utils.js'; import features from '../feature-manager.js'; import GitHubFileUrl from '../github-helpers/github-file-url.js'; import {isArchivedRepoAsync, isPermalink} from '../github-helpers/index.js'; -import observe from '../helpers/selector-observer.js'; import {directoryListingFileIcon} from '../github-helpers/selectors.js'; +import {wrap} from '../helpers/dom-utils.js'; +import observe from '../helpers/selector-observer.js'; async function linkifyIcon(fileIcon: Element): Promise { const fileLink = fileIcon diff --git a/source/features/quick-label-removal.tsx b/source/features/quick-label-removal.tsx index 71049a79995a..dd2c8b11c1fc 100644 --- a/source/features/quick-label-removal.tsx +++ b/source/features/quick-label-removal.tsx @@ -1,19 +1,19 @@ import './quick-label-removal.css'; +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; +import * as pageDetect from 'github-url-detection'; +import XIcon from 'octicons-plain-react/X'; import {elementExists} from 'select-dom'; import {$} from 'select-dom/strict.js'; -import XIcon from 'octicons-plain-react/X'; import {assertError} from 'ts-extras'; -import * as pageDetect from 'github-url-detection'; -import delegate, {type DelegateEvent} from 'delegate-it'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import showToast from '../github-helpers/toast.js'; +import {expectToken} from '../github-helpers/github-token.js'; import {getConversationNumber} from '../github-helpers/index.js'; +import showToast from '../github-helpers/toast.js'; import observe from '../helpers/selector-observer.js'; -import {expectToken} from '../github-helpers/github-token.js'; // Don't cache: https://github.com/refined-github/refined-github/issues/7283 function canEditLabels(): boolean { diff --git a/source/features/quick-mention.tsx b/source/features/quick-mention.tsx index d3d8b98f3eaf..abb8899e8575 100644 --- a/source/features/quick-mention.tsx +++ b/source/features/quick-mention.tsx @@ -1,16 +1,16 @@ import './quick-mention.css'; +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; -import {elementExists} from 'select-dom'; -import ReplyIcon from 'octicons-plain-react/Reply'; import * as pageDetect from 'github-url-detection'; +import ReplyIcon from 'octicons-plain-react/Reply'; +import {elementExists} from 'select-dom'; +import {$} from 'select-dom/strict.js'; import {insertTextIntoField} from 'text-field-edit'; -import delegate, {type DelegateEvent} from 'delegate-it'; -import {wrap} from '../helpers/dom-utils.js'; import features from '../feature-manager.js'; import {getLoggedInUser, isArchivedRepoAsync} from '../github-helpers/index.js'; +import {wrap} from '../helpers/dom-utils.js'; import observe from '../helpers/selector-observer.js'; const fieldSelector = [ diff --git a/source/features/quick-repo-deletion.tsx b/source/features/quick-repo-deletion.tsx index cf35c47b4652..2a27d01cb9eb 100644 --- a/source/features/quick-repo-deletion.tsx +++ b/source/features/quick-repo-deletion.tsx @@ -1,19 +1,19 @@ +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; import elementReady from 'element-ready'; -import {$, $optional} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; -import {setFieldText} from 'text-field-edit'; import TrashIcon from 'octicons-plain-react/Trash'; -import delegate, {type DelegateEvent} from 'delegate-it'; +import {$, $optional} from 'select-dom/strict.js'; +import {setFieldText} from 'text-field-edit'; import features from '../feature-manager.js'; -import {buildRepoUrl, getForkedRepo, getRepo} from '../github-helpers/index.js'; -import observe from '../helpers/selector-observer.js'; +import api from '../github-helpers/api.js'; import {userIsAdmin} from '../github-helpers/get-user-permission.js'; import {expectTokenScope} from '../github-helpers/github-token.js'; -import addNotice from '../github-widgets/notice-bar.js'; -import api from '../github-helpers/api.js'; +import {buildRepoUrl, getForkedRepo, getRepo} from '../github-helpers/index.js'; import showToast from '../github-helpers/toast.js'; +import addNotice from '../github-widgets/notice-bar.js'; +import observe from '../helpers/selector-observer.js'; const tooltip = 'Instant deletion: shift-alt-click'; const buttonHashSelector = '#dialog-show-repo-delete-menu-dialog'; diff --git a/source/features/quick-review-comment-deletion.tsx b/source/features/quick-review-comment-deletion.tsx index 81fd1524833d..44288f8eb25e 100644 --- a/source/features/quick-review-comment-deletion.tsx +++ b/source/features/quick-review-comment-deletion.tsx @@ -1,14 +1,14 @@ +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; -import TrashIcon from 'octicons-plain-react/Trash'; import * as pageDetect from 'github-url-detection'; -import delegate, {type DelegateEvent} from 'delegate-it'; +import TrashIcon from 'octicons-plain-react/Trash'; +import {$} from 'select-dom/strict.js'; import {isChrome} from 'webext-detect'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import loadDetailsMenu from '../github-helpers/load-details-menu.js'; import showToast from '../github-helpers/toast.js'; +import observe from '../helpers/selector-observer.js'; function onButtonClick({delegateTarget: button}: DelegateEvent): void { try { diff --git a/source/features/quick-review.tsx b/source/features/quick-review.tsx index 35b1cd0fd6ea..b3d8b78b61b4 100644 --- a/source/features/quick-review.tsx +++ b/source/features/quick-review.tsx @@ -1,21 +1,21 @@ +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; -import delegate, {type DelegateEvent} from 'delegate-it'; +import {$} from 'select-dom/strict.js'; -import delay from '../helpers/delay.js'; -import api from '../github-helpers/api.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; -import showToast from '../github-helpers/toast.js'; +import api from '../github-helpers/api.js'; import { getConversationNumber, getLoggedInUser, scrollIntoViewIfNeeded, triggerConversationUpdate, } from '../github-helpers/index.js'; +import showToast from '../github-helpers/toast.js'; +import delay from '../helpers/delay.js'; import {randomArrayItem} from '../helpers/math.js'; +import observe from '../helpers/selector-observer.js'; import {getToken} from '../options-storage.js'; const emojis = ['🚀', '🐿️', '⚡️', '🤌', '🥳', '🥰', '🤩', '🥸', '😎', '🤯', '🚢', '🛫', '🏳️', '🏁']; diff --git a/source/features/reactions-avatars.tsx b/source/features/reactions-avatars.tsx index 7d300b925f6d..cea8dfef4955 100644 --- a/source/features/reactions-avatars.tsx +++ b/source/features/reactions-avatars.tsx @@ -1,16 +1,16 @@ import './reactions-avatars.css'; import React from 'dom-chef'; -import {$$} from 'select-dom'; import {flatZip} from 'flat-zip'; import * as pageDetect from 'github-url-detection'; +import {$$} from 'select-dom'; import {onAbort} from 'abort-utils'; -import observe from '../helpers/selector-observer.js'; import features from '../feature-manager.js'; -import {getLoggedInUser} from '../github-helpers/index.js'; import getUserAvatar from '../github-helpers/get-user-avatar.js'; +import {getLoggedInUser} from '../github-helpers/index.js'; +import observe from '../helpers/selector-observer.js'; const arbitraryAvatarLimit = 36; const approximateHeaderLength = 3; // Each button header takes about as much as 3 avatars diff --git a/source/features/release-download-count.tsx b/source/features/release-download-count.tsx index 2082043331f3..db17ea2138a3 100644 --- a/source/features/release-download-count.tsx +++ b/source/features/release-download-count.tsx @@ -7,19 +7,19 @@ This feature is documented at https://github.com/refined-github/refined-github/w import './release-download-count.css'; import React from 'dom-chef'; -import {$$} from 'select-dom'; -import {$, $optional} from 'select-dom/strict.js'; -import DownloadIcon from 'octicons-plain-react/Download'; import * as pageDetect from 'github-url-detection'; import {abbreviateNumber} from 'js-abbreviation-number'; +import DownloadIcon from 'octicons-plain-react/Download'; +import {$$} from 'select-dom'; +import {$, $optional} from 'select-dom/strict.js'; -import getReleaseDownloadCount from './release-download-count.gql'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import observe from '../helpers/selector-observer.js'; -import {createHeatIndexFunction} from '../helpers/math.js'; import {expectToken} from '../github-helpers/github-token.js'; import {assertNodeContent, getClasses} from '../helpers/dom-utils.js'; +import {createHeatIndexFunction} from '../helpers/math.js'; +import observe from '../helpers/selector-observer.js'; +import getReleaseDownloadCount from './release-download-count.gql'; type Asset = { name: string; diff --git a/source/features/releases-dropdown.tsx b/source/features/releases-dropdown.tsx index 378c069462ee..0a7d78a8475b 100644 --- a/source/features/releases-dropdown.tsx +++ b/source/features/releases-dropdown.tsx @@ -1,14 +1,14 @@ +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; -import delegate, {type DelegateEvent} from 'delegate-it'; import {CachedFunction} from 'webext-storage-cache'; -import api from '../github-helpers/api.js'; import features from '../feature-manager.js'; +import api from '../github-helpers/api.js'; +import {expectToken} from '../github-helpers/github-token.js'; import {buildRepoUrl, cacheByRepo} from '../github-helpers/index.js'; import observe from '../helpers/selector-observer.js'; import GetReleases from './releases-dropdown.gql'; -import {expectToken} from '../github-helpers/github-token.js'; const getReleases = new CachedFunction('releases', { async updater(): Promise { diff --git a/source/features/reload-failed-proxied-images.tsx b/source/features/reload-failed-proxied-images.tsx index e43bbb9be4f6..47db435a3278 100644 --- a/source/features/reload-failed-proxied-images.tsx +++ b/source/features/reload-failed-proxied-images.tsx @@ -1,8 +1,8 @@ import delegate, {type DelegateEvent} from 'delegate-it'; +import features from '../feature-manager.js'; import delay from '../helpers/delay.js'; import onetime from '../helpers/onetime.js'; -import features from '../feature-manager.js'; async function handleErroredImage({delegateTarget}: DelegateEvent): Promise { console.log('Refined GitHub: image failed loading, will retry', delegateTarget.src); diff --git a/source/features/repo-age.tsx b/source/features/repo-age.tsx index fd485b5a501d..f94ce9063bc5 100644 --- a/source/features/repo-age.tsx +++ b/source/features/repo-age.tsx @@ -1,16 +1,16 @@ -import twas from 'twas'; -import {CachedFunction} from 'webext-storage-cache'; import React from 'dom-chef'; -import RepoIcon from 'octicons-plain-react/Repo'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; +import RepoIcon from 'octicons-plain-react/Repo'; +import twas from 'twas'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; import {buildRepoUrl, cacheByRepo} from '../github-helpers/index.js'; -import GetRepoAge from './repo-age.gql'; -import GetFirstCommit from './repo-age-first-commit.gql'; import {randomArrayItem} from '../helpers/math.js'; +import GetFirstCommit from './repo-age-first-commit.gql'; +import GetRepoAge from './repo-age.gql'; type CommitTarget = { oid: string; diff --git a/source/features/repo-avatars.tsx b/source/features/repo-avatars.tsx index 9b20752c634b..533b99a40056 100644 --- a/source/features/repo-avatars.tsx +++ b/source/features/repo-avatars.tsx @@ -2,10 +2,10 @@ import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; -import {getRepo} from '../github-helpers/index.js'; import getUserAvatar from '../github-helpers/get-user-avatar.js'; -import observe from '../helpers/selector-observer.js'; +import {getRepo} from '../github-helpers/index.js'; import {isSmallDevice} from '../helpers/dom-utils.js'; +import observe from '../helpers/selector-observer.js'; async function add(ownerLabel: HTMLElement): Promise { // TODO: Drop after June 2026 diff --git a/source/features/repo-header-info.tsx b/source/features/repo-header-info.tsx index 271e140d5fed..08edd03c12a0 100644 --- a/source/features/repo-header-info.tsx +++ b/source/features/repo-header-info.tsx @@ -1,20 +1,20 @@ +import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; import LockIcon from 'octicons-plain-react/Lock'; import RepoForkedIcon from 'octicons-plain-react/RepoForked'; import StarIcon from 'octicons-plain-react/Star'; import StarFillIcon from 'octicons-plain-react/StarFill'; -import React from 'dom-chef'; import {elementExists} from 'select-dom'; import {CachedFunction} from 'webext-storage-cache'; -import observe from '../helpers/selector-observer.js'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import GetRepositoryInfo from './repo-header-info.gql'; +import {expectToken} from '../github-helpers/github-token.js'; import {buildRepoUrl, cacheByRepo} from '../github-helpers/index.js'; import abbreviateNumber from '../helpers/abbreviate-number.js'; -import {expectToken} from '../github-helpers/github-token.js'; import {isSmallDevice} from '../helpers/dom-utils.js'; +import observe from '../helpers/selector-observer.js'; +import GetRepositoryInfo from './repo-header-info.gql'; type RepositoryInfo = { isFork: boolean; diff --git a/source/features/repo-wide-file-finder.tsx b/source/features/repo-wide-file-finder.tsx index b535e6150757..7fb511b0b2cf 100644 --- a/source/features/repo-wide-file-finder.tsx +++ b/source/features/repo-wide-file-finder.tsx @@ -1,12 +1,12 @@ -import {elementExists} from 'select-dom'; import * as pageDetect from 'github-url-detection'; +import {elementExists} from 'select-dom'; import features from '../feature-manager.js'; -import getDefaultBranch from '../github-helpers/get-default-branch.js'; -import {buildRepoUrl} from '../github-helpers/index.js'; import getCurrentGitRef from '../github-helpers/get-current-git-ref.js'; -import {registerHotkey} from '../github-helpers/hotkey.js'; +import getDefaultBranch from '../github-helpers/get-default-branch.js'; import {expectToken} from '../github-helpers/github-token.js'; +import {registerHotkey} from '../github-helpers/hotkey.js'; +import {buildRepoUrl} from '../github-helpers/index.js'; async function init(signal: AbortSignal): Promise { await expectToken(); diff --git a/source/features/rerun-workflow.tsx b/source/features/rerun-workflow.tsx index a97d3fe3c62d..51315ec42b3e 100644 --- a/source/features/rerun-workflow.tsx +++ b/source/features/rerun-workflow.tsx @@ -1,5 +1,5 @@ -import {$, $$, $optional} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$, $$, $optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import {registerHotkey} from '../github-helpers/hotkey.js'; diff --git a/source/features/restore-file.tsx b/source/features/restore-file.tsx index 2de5baaebb85..d6a676611275 100644 --- a/source/features/restore-file.tsx +++ b/source/features/restore-file.tsx @@ -1,16 +1,16 @@ -import React from 'dom-chef'; -import {$, $optional} from 'select-dom/strict.js'; import delegate, {type DelegateEvent} from 'delegate-it'; +import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; import UndoIcon from 'octicons-plain-react/Undo'; +import {$, $optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import showToast from '../github-helpers/toast.js'; -import {getBranches} from '../github-helpers/pr-branches.js'; import getPrInfo from '../github-helpers/get-pr-info.js'; -import observe from '../helpers/selector-observer.js'; import {expectToken} from '../github-helpers/github-token.js'; +import {getBranches} from '../github-helpers/pr-branches.js'; +import showToast from '../github-helpers/toast.js'; +import observe from '../helpers/selector-observer.js'; // Track the currently focused file container for removal after discard let focusedFileContainer: HTMLElement | undefined; diff --git a/source/features/rgh-deduplicator.tsx b/source/features/rgh-deduplicator.tsx index d291ec5fa539..1b9b74d4565e 100644 --- a/source/features/rgh-deduplicator.tsx +++ b/source/features/rgh-deduplicator.tsx @@ -1,8 +1,8 @@ import React from 'dom-chef'; import {$optional} from 'select-dom/strict.js'; -import {_} from '../helpers/hotfix.js'; import features from '../feature-manager.js'; +import {_} from '../helpers/hotfix.js'; /* When navigating back and forth in history, GitHub will preserve the DOM changes; diff --git a/source/features/rgh-dim-commits.tsx b/source/features/rgh-dim-commits.tsx index cdc9f4ec1e67..b9bfe489030b 100644 --- a/source/features/rgh-dim-commits.tsx +++ b/source/features/rgh-dim-commits.tsx @@ -1,9 +1,9 @@ import * as pageDetect from 'github-url-detection'; -import {isRefinedGitHubRepo} from '../github-helpers/index.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; +import {isRefinedGitHubRepo} from '../github-helpers/index.js'; import {commitTitleInLists} from '../github-helpers/selectors.js'; +import observe from '../helpers/selector-observer.js'; // Source: https://github.com/fregante/release-with-changelog/blob/779fd5e658f82e5b11b1c0a352a6838d3bd8f67f/generate-release-notes.js#L6 const excludePreset = /^bump |^meta|^document|^lint|^refactor|readme|dependencies|^v?\d+\.\d+\.\d+/i; diff --git a/source/features/rgh-feature-descriptions.tsx b/source/features/rgh-feature-descriptions.tsx index b6f171641d3b..91571e770451 100644 --- a/source/features/rgh-feature-descriptions.tsx +++ b/source/features/rgh-feature-descriptions.tsx @@ -5,15 +5,15 @@ import AlertIcon from 'octicons-plain-react/Alert'; import CopyIcon from 'octicons-plain-react/Copy'; import InfoIcon from 'octicons-plain-react/Info'; -import features from '../feature-manager.js'; -import optionsStorage, {isFeatureDisabled} from '../options-storage.js'; import {featuresMeta, getNewFeatureName, getOldFeatureNames} from '../feature-data.js'; -import observe from '../helpers/selector-observer.js'; -import {brokenFeatures} from '../helpers/hotfix.js'; -import {createRghIssueLink} from '../helpers/rgh-links.js'; -import openOptions from '../helpers/open-options.js'; +import features from '../feature-manager.js'; import createBanner from '../github-helpers/banner.js'; import {isFeaturePrivate} from '../helpers/feature-utils.js'; +import {brokenFeatures} from '../helpers/hotfix.js'; +import openOptions from '../helpers/open-options.js'; +import {createRghIssueLink} from '../helpers/rgh-links.js'; +import observe from '../helpers/selector-observer.js'; +import optionsStorage, {isFeatureDisabled} from '../options-storage.js'; function addDescription(infoBanner: HTMLElement, id: string, meta: FeatureMeta | undefined): void { const isCss = location.pathname.endsWith('.css'); diff --git a/source/features/rgh-improve-new-issue-form.tsx b/source/features/rgh-improve-new-issue-form.tsx index fa219421eee0..83afa68e34b2 100644 --- a/source/features/rgh-improve-new-issue-form.tsx +++ b/source/features/rgh-improve-new-issue-form.tsx @@ -1,18 +1,18 @@ -import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; import delegate, {type DelegateEvent} from 'delegate-it'; +import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; +import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; -import {OptionsLink} from '../helpers/open-options.js'; -import clearCacheHandler from '../helpers/clear-cache-handler.js'; import {baseApiFetch} from '../github-helpers/github-token.js'; -import {getToken} from '../options-storage.js'; import {isRefinedGitHubRepo} from '../github-helpers/index.js'; +import clearCacheHandler from '../helpers/clear-cache-handler.js'; import {getElementByAriaLabelledBy} from '../helpers/dom-utils.js'; +import {getExtensionReleaseDate, toDaysAgo, wasReleasedLongAgo} from '../helpers/extension-release-age.js'; +import {OptionsLink} from '../helpers/open-options.js'; import observe from '../helpers/selector-observer.js'; import setReactInputValue from '../helpers/set-react-input-value.js'; -import {getExtensionReleaseDate, toDaysAgo, wasReleasedLongAgo} from '../helpers/extension-release-age.js'; +import {getToken} from '../options-storage.js'; const isSetTheTokenSelector = 'input[type="checkbox"][required]'; const liesGif = 'https://github.com/user-attachments/assets/f417264f-f230-4156-b020-16e4390562bd'; diff --git a/source/features/rgh-linkify-features.tsx b/source/features/rgh-linkify-features.tsx index b9399b7b0c11..3c10859ffa35 100644 --- a/source/features/rgh-linkify-features.tsx +++ b/source/features/rgh-linkify-features.tsx @@ -1,13 +1,13 @@ import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; -import {wrap} from '../helpers/dom-utils.js'; -import features from '../feature-manager.js'; -import {getFeatureUrl} from '../helpers/rgh-links.js'; import {getNewFeatureName} from '../feature-data.js'; +import features from '../feature-manager.js'; import {isAnyRefinedGitHubRepo} from '../github-helpers/index.js'; -import observe from '../helpers/selector-observer.js'; import {commitTitleInLists} from '../github-helpers/selectors.js'; +import {wrap} from '../helpers/dom-utils.js'; +import {getFeatureUrl} from '../helpers/rgh-links.js'; +import observe from '../helpers/selector-observer.js'; function linkifyFeature(possibleFeature: HTMLElement): void { const originalText = possibleFeature.textContent; diff --git a/source/features/rgh-linkify-yolo.tsx b/source/features/rgh-linkify-yolo.tsx index b7a8309d6c6a..aeb838a4b402 100644 --- a/source/features/rgh-linkify-yolo.tsx +++ b/source/features/rgh-linkify-yolo.tsx @@ -3,8 +3,8 @@ import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; import {isRefinedGitHubYoloRepo} from '../github-helpers/index.js'; -import observe from '../helpers/selector-observer.js'; import {createRghIssueLink, getFeatureUrl} from '../helpers/rgh-links.js'; +import observe from '../helpers/selector-observer.js'; function linkifyIssue(issueCell: HTMLElement): void { // Linkify with hovercards diff --git a/source/features/rgh-netiquette.tsx b/source/features/rgh-netiquette.tsx index a574101ee760..dfed3b204de8 100644 --- a/source/features/rgh-netiquette.tsx +++ b/source/features/rgh-netiquette.tsx @@ -1,13 +1,13 @@ import React from 'dom-chef'; -import InfoIcon from 'octicons-plain-react/Info'; import * as pageDetect from 'github-url-detection'; +import InfoIcon from 'octicons-plain-react/Info'; -import createBanner from '../github-helpers/banner.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; +import createBanner from '../github-helpers/banner.js'; import {isAnyRefinedGitHubRepo} from '../github-helpers/index.js'; -import {getCloseDate, getResolvedText, wasLongAgo} from './netiquette.js'; import TimelineItem from '../github-helpers/timeline-item.js'; +import observe from '../helpers/selector-observer.js'; +import {getCloseDate, getResolvedText, wasLongAgo} from './netiquette.js'; async function addConversationBanner(newCommentBox: HTMLElement): Promise { // Check inside the observer because React views load after dom-ready diff --git a/source/features/rgh-options-link.tsx b/source/features/rgh-options-link.tsx index 6c81c9601e14..107feb83c84c 100644 --- a/source/features/rgh-options-link.tsx +++ b/source/features/rgh-options-link.tsx @@ -3,9 +3,9 @@ import delegate from 'delegate-it'; import features from '../feature-manager.js'; +import {isRefinedGitHubRepo} from '../github-helpers/index.js'; import openOptions from '../helpers/open-options.js'; import observe from '../helpers/selector-observer.js'; -import {isRefinedGitHubRepo} from '../github-helpers/index.js'; const placeholdersSelector = 'a[name="user-content-options-page-link"]'; diff --git a/source/features/rgh-pr-template.tsx b/source/features/rgh-pr-template.tsx index 79d659c526ab..7fe1a7e22387 100644 --- a/source/features/rgh-pr-template.tsx +++ b/source/features/rgh-pr-template.tsx @@ -1,8 +1,8 @@ import React from 'dom-chef'; -import {replaceFieldText} from 'text-field-edit'; import * as pageDetect from 'github-url-detection'; import {linkifyUrlsToDom} from 'linkify-urls'; import shortenRepoUrl from 'shorten-repo-url'; +import {replaceFieldText} from 'text-field-edit'; import features from '../feature-manager.js'; import {isRefinedGitHubRepo} from '../github-helpers/index.js'; diff --git a/source/features/rgh-token-user.tsx b/source/features/rgh-token-user.tsx index bda3d49f851e..dae030075237 100644 --- a/source/features/rgh-token-user.tsx +++ b/source/features/rgh-token-user.tsx @@ -1,14 +1,14 @@ -import React from 'react'; import AlertIcon from 'octicons-plain-react/Alert'; +import React from 'react'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; -import {getLoggedInUser} from '../github-helpers/index.js'; -import {getToken} from '../options-storage.js'; -import {tokenUser} from '../github-helpers/github-token.js'; import {api3} from '../github-helpers/api.js'; +import {tokenUser} from '../github-helpers/github-token.js'; +import {getLoggedInUser} from '../github-helpers/index.js'; import onetime from '../helpers/onetime.js'; import {OptionsLink} from '../helpers/open-options.js'; +import observe from '../helpers/selector-observer.js'; +import {getToken} from '../options-storage.js'; async function verify(header: HTMLButtonElement): Promise { const token = await getToken(); diff --git a/source/features/same-branch-author-commits.tsx b/source/features/same-branch-author-commits.tsx index c0ef96880847..90902bd6cc24 100644 --- a/source/features/same-branch-author-commits.tsx +++ b/source/features/same-branch-author-commits.tsx @@ -1,5 +1,5 @@ -import {$$} from 'select-dom'; import * as pageDetect from 'github-url-detection'; +import {$$} from 'select-dom'; import features from '../feature-manager.js'; diff --git a/source/features/select-all-notifications-shortcut.tsx b/source/features/select-all-notifications-shortcut.tsx index ae94cd97c01a..3910d6a6df6a 100644 --- a/source/features/select-all-notifications-shortcut.tsx +++ b/source/features/select-all-notifications-shortcut.tsx @@ -1,5 +1,5 @@ -import {$} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import {registerHotkey} from '../github-helpers/hotkey.js'; diff --git a/source/features/select-notifications.tsx b/source/features/select-notifications.tsx index b80d1ff084ce..c03e2557e623 100644 --- a/source/features/select-notifications.tsx +++ b/source/features/select-notifications.tsx @@ -1,26 +1,26 @@ import './select-notifications.css'; -import React from 'dom-chef'; -import {elementExists} from 'select-dom'; -import {$, $$} from 'select-dom/strict.js'; import delegate from 'delegate-it'; +import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; -import CheckCircleIcon from 'octicons-plain-react/CheckCircle'; import CheckIcon from 'octicons-plain-react/Check'; -import DotFillIcon from 'octicons-plain-react/DotFill'; +import CheckCircleIcon from 'octicons-plain-react/CheckCircle'; import DotIcon from 'octicons-plain-react/Dot'; +import DotFillIcon from 'octicons-plain-react/DotFill'; import GitMergeIcon from 'octicons-plain-react/GitMerge'; -import GitPullRequestDraftIcon from 'octicons-plain-react/GitPullRequestDraft'; import GitPullRequestIcon from 'octicons-plain-react/GitPullRequest'; +import GitPullRequestDraftIcon from 'octicons-plain-react/GitPullRequestDraft'; import HubotIcon from 'octicons-plain-react/Hubot'; import IssueOpenedIcon from 'octicons-plain-react/IssueOpened'; import SquirrelIcon from 'octicons-plain-react/Squirrel'; import XCircleIcon from 'octicons-plain-react/XCircle'; +import {elementExists} from 'select-dom'; +import {$, $$} from 'select-dom/strict.js'; -import onetime from '../helpers/onetime.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import {botLinksNotificationSelectors} from '../github-helpers/selectors.js'; +import onetime from '../helpers/onetime.js'; +import observe from '../helpers/selector-observer.js'; const prIcons = ':is(.octicon-git-pull-request, .octicon-git-pull-request-closed, .octicon-git-pull-request-draft, .octicon-git-merge)'; const issueIcons = ':is(.octicon-issue-opened, .octicon-issue-closed, .octicon-skip)'; diff --git a/source/features/selection-in-new-tab.tsx b/source/features/selection-in-new-tab.tsx index 9ef6933904d8..59fb542a2ed7 100644 --- a/source/features/selection-in-new-tab.tsx +++ b/source/features/selection-in-new-tab.tsx @@ -1,9 +1,9 @@ import {$optional} from 'select-dom/strict.js'; import {messageRuntime} from 'webext-msg'; -import onetime from '../helpers/onetime.js'; import features from '../feature-manager.js'; import {registerHotkey} from '../github-helpers/hotkey.js'; +import onetime from '../helpers/onetime.js'; function openInNewTab(): void { const selected = $optional([ diff --git a/source/features/shorten-links.tsx b/source/features/shorten-links.tsx index 913db00434de..a8e8a9e86557 100644 --- a/source/features/shorten-links.tsx +++ b/source/features/shorten-links.tsx @@ -1,6 +1,6 @@ -import onetime from '../helpers/onetime.js'; import features from '../feature-manager.js'; import {linkifiedUrlClass, shortenLink} from '../github-helpers/dom-formatters.js'; +import onetime from '../helpers/onetime.js'; import observe from '../helpers/selector-observer.js'; /* This feature is currently so broad that it's not de-inited via signal, it's just run once for all pageloads #5889 */ diff --git a/source/features/show-associated-branch-prs-on-fork.tsx b/source/features/show-associated-branch-prs-on-fork.tsx index 69950e33408f..53c47070c5ee 100644 --- a/source/features/show-associated-branch-prs-on-fork.tsx +++ b/source/features/show-associated-branch-prs-on-fork.tsx @@ -1,21 +1,21 @@ import './show-associated-branch-prs-on-fork.css'; import React from 'dom-chef'; -import {CachedFunction} from 'webext-storage-cache'; import * as pageDetect from 'github-url-detection'; +import memoize from 'memoize'; import GitMergeIcon from 'octicons-plain-react/GitMerge'; import GitPullRequestIcon from 'octicons-plain-react/GitPullRequest'; import GitPullRequestClosedIcon from 'octicons-plain-react/GitPullRequestClosed'; import GitPullRequestDraftIcon from 'octicons-plain-react/GitPullRequestDraft'; import RepoForkedIcon from 'octicons-plain-react/RepoForked'; -import memoize from 'memoize'; +import {CachedFunction} from 'webext-storage-cache'; -import observe from '../helpers/selector-observer.js'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; +import {expectToken} from '../github-helpers/github-token.js'; import {cacheByRepo} from '../github-helpers/index.js'; +import observe from '../helpers/selector-observer.js'; import AssociatedPullRequests from './show-associated-branch-prs-on-fork.gql'; -import {expectToken} from '../github-helpers/github-token.js'; type PullRequest = { timelineItems: { diff --git a/source/features/show-names.tsx b/source/features/show-names.tsx index 72aab5d93b1c..cc14433bf77c 100644 --- a/source/features/show-names.tsx +++ b/source/features/show-names.tsx @@ -1,16 +1,16 @@ +import batchedFunction from 'batched-function'; import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; -import batchedFunction from 'batched-function'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; +import {expectToken} from '../github-helpers/github-token.js'; import {getLoggedInUser, isUsernameAlreadyFullName} from '../github-helpers/index.js'; -import observe from '../helpers/selector-observer.js'; -import {removeTextNodeContaining} from '../helpers/dom-utils.js'; import {usernameLinksSelector} from '../github-helpers/selectors.js'; -import {expectToken} from '../github-helpers/github-token.js'; -import attachElement from '../helpers/attach-element.js'; import abortableClassName from '../helpers/abortable-classname.js'; +import attachElement from '../helpers/attach-element.js'; +import {removeTextNodeContaining} from '../helpers/dom-utils.js'; +import observe from '../helpers/selector-observer.js'; async function dropExtraCopy(link: HTMLAnchorElement): Promise { // Drop 'commented' label to shorten the copy diff --git a/source/features/show-open-prs-of-forks.tsx b/source/features/show-open-prs-of-forks.tsx index d11aa6cf191f..fd7ab5d6435c 100644 --- a/source/features/show-open-prs-of-forks.tsx +++ b/source/features/show-open-prs-of-forks.tsx @@ -1,13 +1,13 @@ import React from 'dom-chef'; -import {CachedFunction} from 'webext-storage-cache'; -import {$} from 'select-dom/strict.js'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; +import {$} from 'select-dom/strict.js'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import pluralize from '../helpers/pluralize.js'; import {getForkedRepo, getLoggedInUser, getRepo} from '../github-helpers/index.js'; +import pluralize from '../helpers/pluralize.js'; import GetPRs from './show-open-prs-of-forks.gql'; function getLinkCopy(count: number): string { diff --git a/source/features/show-whitespace.tsx b/source/features/show-whitespace.tsx index fba2e59e7944..2d5b57dc3eab 100644 --- a/source/features/show-whitespace.tsx +++ b/source/features/show-whitespace.tsx @@ -1,12 +1,12 @@ import './show-whitespace.css'; -import * as pageDetect from 'github-url-detection'; import {onAbort} from 'abort-utils'; +import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; import {codeElementsSelector} from '../github-helpers/dom-formatters.js'; -import showWhiteSpacesOnLine from '../helpers/show-whitespace-on-line.js'; import observe from '../helpers/selector-observer.js'; +import showWhiteSpacesOnLine from '../helpers/show-whitespace-on-line.js'; const viewportObserver = new IntersectionObserver(changes => { for (const {target: line, isIntersecting} of changes) { diff --git a/source/features/sidebar-focus-file.tsx b/source/features/sidebar-focus-file.tsx index 9c854e0d150a..4ecda1341332 100644 --- a/source/features/sidebar-focus-file.tsx +++ b/source/features/sidebar-focus-file.tsx @@ -1,9 +1,9 @@ import * as pageDetect from 'github-url-detection'; -import delay from '../helpers/delay.js'; import features from '../feature-manager.js'; import GitHubFileUrl from '../github-helpers/github-file-url.js'; import {scrollIntoViewIfNeeded} from '../github-helpers/index.js'; +import delay from '../helpers/delay.js'; async function init(): Promise { const {filePath} = new GitHubFileUrl(location.href); diff --git a/source/features/small-user-avatars.tsx b/source/features/small-user-avatars.tsx index 09c0fb883402..b85ef4289dc6 100644 --- a/source/features/small-user-avatars.tsx +++ b/source/features/small-user-avatars.tsx @@ -1,9 +1,9 @@ import React from 'dom-chef'; -import onetime from '../helpers/onetime.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import getUserAvatarURL from '../github-helpers/get-user-avatar.js'; +import onetime from '../helpers/onetime.js'; +import observe from '../helpers/selector-observer.js'; import './small-user-avatars.css'; function addAvatar(link: HTMLElement): void { diff --git a/source/features/sort-conversations-by-update-time.tsx b/source/features/sort-conversations-by-update-time.tsx index b004f60daa90..d649dc6fd7ec 100644 --- a/source/features/sort-conversations-by-update-time.tsx +++ b/source/features/sort-conversations-by-update-time.tsx @@ -1,12 +1,12 @@ -import {$optional} from 'select-dom/strict.js'; -import * as pageDetect from 'github-url-detection'; import elementReady from 'element-ready'; +import * as pageDetect from 'github-url-detection'; import oneEvent from 'one-event'; +import {$optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import SearchQuery from '../github-helpers/search-query.js'; -import observe from '../helpers/selector-observer.js'; import {linksToConversationLists} from '../github-helpers/selectors.js'; +import observe from '../helpers/selector-observer.js'; /** Keep the original URL on the element so that `shorten-links` can use it reliably #5890 */ export function saveOriginalHref(link: HTMLAnchorElement): void { diff --git a/source/features/status-subscription.tsx b/source/features/status-subscription.tsx index 9fff4144552f..3164d93aca07 100644 --- a/source/features/status-subscription.tsx +++ b/source/features/status-subscription.tsx @@ -2,14 +2,14 @@ import './status-subscription.css'; import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; -import {$optional} from 'select-dom/strict.js'; import BellIcon from 'octicons-plain-react/Bell'; import BellSlashIcon from 'octicons-plain-react/BellSlash'; import IssueReopenedIcon from 'octicons-plain-react/IssueReopened'; +import {$optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import {getConversationNumber, getRepo, multilineAriaLabel} from '../github-helpers/index.js'; +import observe from '../helpers/selector-observer.js'; type SubscriptionStatus = 'none' | 'all' | 'status'; diff --git a/source/features/sticky-sidebar.tsx b/source/features/sticky-sidebar.tsx index 89cd8742a7dc..ce42c34e4912 100644 --- a/source/features/sticky-sidebar.tsx +++ b/source/features/sticky-sidebar.tsx @@ -1,12 +1,12 @@ import './sticky-sidebar.css'; +import {onAbort} from 'abort-utils'; import debounce from 'debounce-fn'; import * as pageDetect from 'github-url-detection'; -import {onAbort} from 'abort-utils'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import calculateCssCalcString from '../helpers/calculate-css-calc-string.js'; +import observe from '../helpers/selector-observer.js'; const minimumViewportWidthForSidebar = 768; // Less than this, the layout is single-column diff --git a/source/features/suggest-commit-title-limit.tsx b/source/features/suggest-commit-title-limit.tsx index 05e75e6fbe8a..14d7ba89e92f 100644 --- a/source/features/suggest-commit-title-limit.tsx +++ b/source/features/suggest-commit-title-limit.tsx @@ -5,12 +5,12 @@ import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; import onCommitTitleUpdate from '../github-events/on-commit-title-update.js'; +import waitForPrMerge from '../github-events/on-pr-merge.js'; import getNextConversationNumber from '../github-helpers/get-next-conversation-number.js'; import {getConversationNumber} from '../github-helpers/index.js'; -import {formatPrCommitTitle} from './sync-pr-commit-title.js'; -import waitForPrMerge from '../github-events/on-pr-merge.js'; import abortableClassName from '../helpers/abortable-classname.js'; import observe from '../helpers/selector-observer.js'; +import {formatPrCommitTitle} from './sync-pr-commit-title.js'; // https://github.com/refined-github/refined-github/issues/2178#issuecomment-505940703 const limit = 72; diff --git a/source/features/swap-branches-on-compare.tsx b/source/features/swap-branches-on-compare.tsx index c3fc15474121..5a2c13ff3776 100644 --- a/source/features/swap-branches-on-compare.tsx +++ b/source/features/swap-branches-on-compare.tsx @@ -1,6 +1,6 @@ import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import {buildRepoUrl, getRepo} from '../github-helpers/index.js'; diff --git a/source/features/sync-pr-commit-title.tsx b/source/features/sync-pr-commit-title.tsx index 1bafdebe0b6f..077f23c2fb1b 100644 --- a/source/features/sync-pr-commit-title.tsx +++ b/source/features/sync-pr-commit-title.tsx @@ -1,17 +1,17 @@ -import React from 'dom-chef'; -import {$, $optional} from 'select-dom/strict.js'; import delegate from 'delegate-it'; +import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; +import {$, $optional} from 'select-dom/strict.js'; -import api from '../github-helpers/api.js'; import features from '../feature-manager.js'; -import {getConversationNumber, userCanLikelyMergePr} from '../github-helpers/index.js'; import onCommitTitleUpdate from '../github-events/on-commit-title-update.js'; -import observe from '../helpers/selector-observer.js'; +import api from '../github-helpers/api.js'; +import {getConversationNumber, userCanLikelyMergePr} from '../github-helpers/index.js'; +import parseRenderedText from '../github-helpers/parse-rendered-text.js'; +import {confirmMergeButton} from '../github-helpers/selectors.js'; import cleanPrCommitTitle from '../helpers/pr-commit-cleaner.js'; +import observe from '../helpers/selector-observer.js'; import setReactInputValue from '../helpers/set-react-input-value.js'; -import {confirmMergeButton} from '../github-helpers/selectors.js'; -import parseRenderedText from '../github-helpers/parse-rendered-text.js'; const commitTitleFieldSelector = '[data-testid="mergebox-partial"] input[type="text"]'; diff --git a/source/features/tab-to-indent.tsx b/source/features/tab-to-indent.tsx index da5d508ff919..d9c9211cde41 100644 --- a/source/features/tab-to-indent.tsx +++ b/source/features/tab-to-indent.tsx @@ -1,5 +1,5 @@ -import {eventHandler} from 'indent-textarea'; import * as pageDetect from 'github-url-detection'; +import {eventHandler} from 'indent-textarea'; import features from '../feature-manager.js'; import {onCommentFieldKeydown} from '../github-events/on-field-keydown.js'; diff --git a/source/features/table-input.tsx b/source/features/table-input.tsx index 70a1ab8acc99..53aa5f730d0a 100644 --- a/source/features/table-input.tsx +++ b/source/features/table-input.tsx @@ -1,16 +1,16 @@ import './table-input.css'; +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; -import TableIcon from 'octicons-plain-react/Table'; import * as pageDetect from 'github-url-detection'; -import {insertTextIntoField} from 'text-field-edit'; -import delegate, {type DelegateEvent} from 'delegate-it'; +import TableIcon from 'octicons-plain-react/Table'; import {$} from 'select-dom/strict.js'; +import {insertTextIntoField} from 'text-field-edit'; import features from '../feature-manager.js'; -import smartBlockWrap from '../helpers/smart-block-wrap.js'; -import observe from '../helpers/selector-observer.js'; import {actionBarSelectors} from '../github-helpers/selectors.js'; +import observe from '../helpers/selector-observer.js'; +import smartBlockWrap from '../helpers/smart-block-wrap.js'; function addTable({delegateTarget: square}: DelegateEvent): void { const container = square.closest('fieldset') // Issue diff --git a/source/features/tag-changes-link.tsx b/source/features/tag-changes-link.tsx index 6e0f94c6c5f4..a7d9eea6b17a 100644 --- a/source/features/tag-changes-link.tsx +++ b/source/features/tag-changes-link.tsx @@ -1,16 +1,16 @@ import './tag-changes-link.css'; import React from 'dom-chef'; -import {$$, elementExists} from 'select-dom'; -import {$, $optional} from 'select-dom/strict.js'; import domLoaded from 'dom-loaded'; -import DiffIcon from 'octicons-plain-react/Diff'; import * as pageDetect from 'github-url-detection'; +import DiffIcon from 'octicons-plain-react/Diff'; +import {$$, elementExists} from 'select-dom'; +import {$, $optional} from 'select-dom/strict.js'; import tinyVersionCompare from 'tiny-version-compare'; import features from '../feature-manager.js'; -import fetchDom from '../helpers/fetch-dom.js'; import {buildRepoUrl, getRepo, parseTag} from '../github-helpers/index.js'; +import fetchDom from '../helpers/fetch-dom.js'; type TagDetails = { element: HTMLElement; diff --git a/source/features/tags-on-commits-list.tsx b/source/features/tags-on-commits-list.tsx index 65b789db05de..9acb2706f18b 100644 --- a/source/features/tags-on-commits-list.tsx +++ b/source/features/tags-on-commits-list.tsx @@ -1,17 +1,17 @@ import React from 'dom-chef'; -import cache from 'webext-storage-cache/legacy.js'; import {$, $$, $$optional} from 'select-dom/strict.js'; +import cache from 'webext-storage-cache/legacy.js'; -import TagIcon from 'octicons-plain-react/Tag'; import * as pageDetect from 'github-url-detection'; +import TagIcon from 'octicons-plain-react/Tag'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import {getCommitHash} from './mark-merge-commits-in-list.js'; -import {buildRepoUrl, getRepo} from '../github-helpers/index.js'; -import GetTagsOnCommit from './tags-on-commits-list.gql'; import {expectToken} from '../github-helpers/github-token.js'; +import {buildRepoUrl, getRepo} from '../github-helpers/index.js'; import delay from '../helpers/delay.js'; +import {getCommitHash} from './mark-merge-commits-in-list.js'; +import GetTagsOnCommit from './tags-on-commits-list.gql'; type CommitTags = Record; diff --git a/source/features/unclip-checks.tsx b/source/features/unclip-checks.tsx index e3b65d552ae0..233de918f9b5 100644 --- a/source/features/unclip-checks.tsx +++ b/source/features/unclip-checks.tsx @@ -1,6 +1,6 @@ import './unclip-checks.css'; -import * as pageDetect from 'github-url-detection'; import delegate, {type DelegateEvent} from 'delegate-it'; +import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; diff --git a/source/features/unfinished-comments.tsx b/source/features/unfinished-comments.tsx index d25ad1559084..bd5993a8f33e 100644 --- a/source/features/unfinished-comments.tsx +++ b/source/features/unfinished-comments.tsx @@ -1,6 +1,6 @@ -import {$$} from 'select-dom'; import delegate from 'delegate-it'; import * as pageDetect from 'github-url-detection'; +import {$$} from 'select-dom'; import features from '../feature-manager.js'; diff --git a/source/features/unread-anywhere.tsx b/source/features/unread-anywhere.tsx index 590a049f8147..9ccf4b69c34a 100644 --- a/source/features/unread-anywhere.tsx +++ b/source/features/unread-anywhere.tsx @@ -1,18 +1,18 @@ -import {$$optional, $optional} from 'select-dom/strict.js'; -import {messageRuntime} from 'webext-msg'; import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; import ArrowUpRightIcon from 'octicons-plain-react/ArrowUpRight'; +import {$$optional, $optional} from 'select-dom/strict.js'; +import {messageRuntime} from 'webext-msg'; import features from '../feature-manager.js'; import {registerHotkey} from '../github-helpers/hotkey.js'; -import onetime from '../helpers/onetime.js'; import showToast from '../github-helpers/toast.js'; +import {getClasses, isSmallDevice} from '../helpers/dom-utils.js'; import {fetchDomUncached} from '../helpers/fetch-dom.js'; +import onetime from '../helpers/onetime.js'; import pluralize from '../helpers/pluralize.js'; -import {removeLinkToPrFilesTab} from './pr-notification-link.js'; import observe from '../helpers/selector-observer.js'; -import {getClasses, isSmallDevice} from '../helpers/dom-utils.js'; +import {removeLinkToPrFilesTab} from './pr-notification-link.js'; const limit = 5; diff --git a/source/features/unwrap-unnecessary-dropdowns.tsx b/source/features/unwrap-unnecessary-dropdowns.tsx index 067bfabb1c55..b9b524b90ce8 100644 --- a/source/features/unwrap-unnecessary-dropdowns.tsx +++ b/source/features/unwrap-unnecessary-dropdowns.tsx @@ -1,5 +1,5 @@ -import {$, $$optional} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$, $$optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import observe from '../helpers/selector-observer.js'; diff --git a/source/features/update-pr-from-base-branch.tsx b/source/features/update-pr-from-base-branch.tsx index 6ef8fda66e71..ca7d4eeda576 100644 --- a/source/features/update-pr-from-base-branch.tsx +++ b/source/features/update-pr-from-base-branch.tsx @@ -1,20 +1,20 @@ +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; +import * as pageDetect from 'github-url-detection'; import {elementExists} from 'select-dom'; import {$, $optional} from 'select-dom/strict.js'; -import * as pageDetect from 'github-url-detection'; -import delegate, {type DelegateEvent} from 'delegate-it'; import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; import api from '../github-helpers/api.js'; -import {getBranches} from '../github-helpers/pr-branches.js'; import getPrInfo from '../github-helpers/get-pr-info.js'; -import showToast from '../github-helpers/toast.js'; -import {getRepo} from '../github-helpers/index.js'; -import updatePullRequestBranch from './update-pr-from-base-branch.gql'; import {expectToken} from '../github-helpers/github-token.js'; +import {getRepo} from '../github-helpers/index.js'; +import {getBranches} from '../github-helpers/pr-branches.js'; import {deletedHeadRepository, prMergeabilityBoxHeader} from '../github-helpers/selectors.js'; +import showToast from '../github-helpers/toast.js'; +import observe from '../helpers/selector-observer.js'; +import updatePullRequestBranch from './update-pr-from-base-branch.gql'; // TODO: Use CachedMap after https://github.com/fregante/webext-storage-cache/issues/51 const nativeRepos = new CachedFunction('native-update-button', { diff --git a/source/features/useful-not-found-page.tsx b/source/features/useful-not-found-page.tsx index 799e3ebfd476..a97d7c3c0849 100644 --- a/source/features/useful-not-found-page.tsx +++ b/source/features/useful-not-found-page.tsx @@ -1,17 +1,17 @@ import React from 'dom-chef'; -import {$} from 'select-dom/strict.js'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; +import {$} from 'select-dom/strict.js'; -import onetime from '../helpers/onetime.js'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import GitHubFileUrl from '../github-helpers/github-file-url.js'; import getDefaultBranch from '../github-helpers/get-default-branch.js'; +import GitHubFileUrl from '../github-helpers/github-file-url.js'; +import {expectToken} from '../github-helpers/github-token.js'; import {getCleanPathname, isUrlReachable} from '../github-helpers/index.js'; +import onetime from '../helpers/onetime.js'; import observe from '../helpers/selector-observer.js'; import GetLatestCommitToFile from './useful-not-found-page.gql'; -import {expectToken} from '../github-helpers/github-token.js'; type File = { previous_filename?: string; diff --git a/source/features/vertical-front-matter.tsx b/source/features/vertical-front-matter.tsx index 2c8e9984f2fd..7524aa0e11f5 100644 --- a/source/features/vertical-front-matter.tsx +++ b/source/features/vertical-front-matter.tsx @@ -1,8 +1,8 @@ import './vertical-front-matter.css'; import React from 'dom-chef'; -import {$$} from 'select-dom'; import * as pageDetect from 'github-url-detection'; +import {$$} from 'select-dom'; import features from '../feature-manager.js'; import observe from '../helpers/selector-observer.js'; diff --git a/source/features/view-last-pr-deployment.tsx b/source/features/view-last-pr-deployment.tsx index 0d1ee7518f2d..37eba61f6e78 100644 --- a/source/features/view-last-pr-deployment.tsx +++ b/source/features/view-last-pr-deployment.tsx @@ -1,7 +1,7 @@ import React from 'dom-chef'; -import {lastElement} from 'select-dom'; import * as pageDetect from 'github-url-detection'; import RocketIcon from 'octicons-plain-react/Rocket'; +import {lastElement} from 'select-dom'; import features from '../feature-manager.js'; import observe from '../helpers/selector-observer.js'; diff --git a/source/features/visit-tag.tsx b/source/features/visit-tag.tsx index 72afe56054c8..6b6116c4e8f8 100644 --- a/source/features/visit-tag.tsx +++ b/source/features/visit-tag.tsx @@ -1,14 +1,14 @@ -import React from 'react'; -import {elementExists} from 'select-dom'; +import * as pageDetect from 'github-url-detection'; import ArrowUpRightIcon from 'octicons-plain-react/ArrowUpRight'; import CodeIcon from 'octicons-plain-react/Code'; -import * as pageDetect from 'github-url-detection'; +import React from 'react'; +import {elementExists} from 'select-dom'; -import {branchSelector} from '../github-helpers/selectors.js'; import features from '../feature-manager.js'; -import observe from '../helpers/selector-observer.js'; -import {wrapAll} from '../helpers/dom-utils.js'; import {buildRepoUrl} from '../github-helpers/index.js'; +import {branchSelector} from '../github-helpers/selectors.js'; +import {wrapAll} from '../helpers/dom-utils.js'; +import observe from '../helpers/selector-observer.js'; async function addLink(branchSelector: HTMLButtonElement): Promise { if (elementExists([ diff --git a/source/features/warn-pr-from-master.tsx b/source/features/warn-pr-from-master.tsx index a62cf42c60d7..f91003d3bdf4 100644 --- a/source/features/warn-pr-from-master.tsx +++ b/source/features/warn-pr-from-master.tsx @@ -1,10 +1,10 @@ import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; -import observe from '../helpers/selector-observer.js'; import features from '../feature-manager.js'; -import parseCompareUrl from '../github-helpers/parse-compare-url.js'; import {defaultBranchOfRepo} from '../github-helpers/get-default-branch.js'; +import parseCompareUrl from '../github-helpers/parse-compare-url.js'; +import observe from '../helpers/selector-observer.js'; async function addWarning(anchor: HTMLElement): Promise { anchor.before( diff --git a/source/features/warning-for-disallow-edits.tsx b/source/features/warning-for-disallow-edits.tsx index 35156ed636bb..cbe95ab7b4a1 100644 --- a/source/features/warning-for-disallow-edits.tsx +++ b/source/features/warning-for-disallow-edits.tsx @@ -1,8 +1,8 @@ import './warning-for-disallow-edits.css'; import React from 'dom-chef'; -import {$optional} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$optional} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import attachElement from '../helpers/attach-element.js'; diff --git a/source/github-events/on-field-keydown.tsx b/source/github-events/on-field-keydown.tsx index 8ebe2fd4e733..c38400ee879f 100644 --- a/source/github-events/on-field-keydown.tsx +++ b/source/github-events/on-field-keydown.tsx @@ -1,5 +1,5 @@ -import {elementExists} from 'select-dom'; import delegate, {type DelegateEventHandler} from 'delegate-it'; +import {elementExists} from 'select-dom'; type DelegateFieldEvent = DelegateEventHandler; diff --git a/source/github-events/on-pr-merge.ts b/source/github-events/on-pr-merge.ts index ea5a710e8562..f94b8c2a144b 100644 --- a/source/github-events/on-pr-merge.ts +++ b/source/github-events/on-pr-merge.ts @@ -1,7 +1,7 @@ import {oneEvent} from 'delegate-it'; -import observe from '../helpers/selector-observer.js'; import {confirmMergeButton} from '../github-helpers/selectors.js'; +import observe from '../helpers/selector-observer.js'; // This event ensures that the feature appears exclusively to the person that merged the PR and not anyone who was on the page at the time of the merge export default async function waitForPrMerge(signal: AbortSignal): Promise { diff --git a/source/github-helpers/dom-formatters.tsx b/source/github-helpers/dom-formatters.tsx index ec2dffd7f6b7..04a867bdf941 100644 --- a/source/github-helpers/dom-formatters.tsx +++ b/source/github-helpers/dom-formatters.tsx @@ -1,14 +1,14 @@ import React from 'dom-chef'; +import {linkifyIssuesToDom, type Options as LinkifyIssuesOptions} from 'linkify-issues'; +import {linkifyUrlsToDom} from 'linkify-urls'; import {elementExists} from 'select-dom'; import {$$} from 'select-dom/strict.js'; -import zipTextNodes from 'zip-text-nodes'; import {applyToLink} from 'shorten-repo-url'; -import {linkifyUrlsToDom} from 'linkify-urls'; -import {linkifyIssuesToDom, type Options as LinkifyIssuesOptions} from 'linkify-issues'; +import zipTextNodes from 'zip-text-nodes'; import getTextNodes from '../helpers/get-text-nodes.js'; -import parseBackticksCore from './parse-backticks.js'; import {buildRepoUrl} from './index.js'; +import parseBackticksCore from './parse-backticks.js'; // Shared class necessary to avoid also shortening the links export const linkifiedUrlClass = 'rgh-linkified-code'; diff --git a/source/github-helpers/get-default-branch.ts b/source/github-helpers/get-default-branch.ts index 20e2a9732dd4..8098772e81bb 100644 --- a/source/github-helpers/get-default-branch.ts +++ b/source/github-helpers/get-default-branch.ts @@ -1,11 +1,11 @@ -import {CachedFunction} from 'webext-storage-cache'; import elementReady from 'element-ready'; import type {NameWithOwner} from 'github-url-detection'; +import {CachedFunction} from 'webext-storage-cache'; import api from './api.js'; +import GetDefaultBranch from './get-default-branch.gql'; import {extractCurrentBranchFromBranchPicker, getRepo} from './index.js'; import {branchSelector} from './selectors.js'; -import GetDefaultBranch from './get-default-branch.gql'; const isCurrentRepo = (nameWithOwner: NameWithOwner): boolean => Boolean(getRepo()?.nameWithOwner === nameWithOwner); diff --git a/source/github-helpers/get-tab-count.ts b/source/github-helpers/get-tab-count.ts index 9ec5615f5958..a2f4313da570 100644 --- a/source/github-helpers/get-tab-count.ts +++ b/source/github-helpers/get-tab-count.ts @@ -1,5 +1,5 @@ -import {$optional} from 'select-dom/strict.js'; import oneMutation from 'one-mutation'; +import {$optional} from 'select-dom/strict.js'; export default async function getTabCount(tab: Element): Promise { const counter = $optional('.Counter, .num', tab); diff --git a/source/github-helpers/get-user-avatar.ts b/source/github-helpers/get-user-avatar.ts index 2f1dbf839384..3fedda38d201 100644 --- a/source/github-helpers/get-user-avatar.ts +++ b/source/github-helpers/get-user-avatar.ts @@ -1,5 +1,5 @@ -import {$optional} from 'select-dom/strict.js'; import * as pageDetect from 'github-url-detection'; +import {$optional} from 'select-dom/strict.js'; export default function getUserAvatar(username: string, size: number): string | void { let cleanName = username.replace('[bot]', ''); diff --git a/source/github-helpers/get-user-permission.ts b/source/github-helpers/get-user-permission.ts index 759f896e9444..a4ea06b20d9e 100644 --- a/source/github-helpers/get-user-permission.ts +++ b/source/github-helpers/get-user-permission.ts @@ -1,9 +1,9 @@ -import {CachedFunction} from 'webext-storage-cache'; import {elementExists} from 'select-dom'; +import {CachedFunction} from 'webext-storage-cache'; import {hasToken} from '../options-storage.js'; -import {getRepo} from './index.js'; import api from './api.js'; +import {getRepo} from './index.js'; /* From https://docs.github.com/en/graphql/reference/enums#repositorypermission diff --git a/source/github-helpers/github-token.ts b/source/github-helpers/github-token.ts index a78597ba25de..eb01acc63aa4 100644 --- a/source/github-helpers/github-token.ts +++ b/source/github-helpers/github-token.ts @@ -1,9 +1,9 @@ -import {CachedFunction} from 'webext-storage-cache'; import * as pageDetect from 'github-url-detection'; +import {CachedFunction} from 'webext-storage-cache'; // Avoid importing api.js here, there's too much logic/caching we don't need -import {getToken} from '../options-storage.js'; import hashString from '../helpers/hash-string.js'; +import {getToken} from '../options-storage.js'; type BaseApiFetchOptions = { apiBase: string; diff --git a/source/github-helpers/is-conversation-locked.ts b/source/github-helpers/is-conversation-locked.ts index f686a14dd887..965713cf4efa 100644 --- a/source/github-helpers/is-conversation-locked.ts +++ b/source/github-helpers/is-conversation-locked.ts @@ -1,10 +1,10 @@ import elementReady from 'element-ready'; +import api from '../github-helpers/api.js'; +import {getConversationNumber} from '../github-helpers/index.js'; import {isInitialLoad} from '../helpers/feature-helpers.js'; import {hasToken} from '../options-storage.js'; -import api from '../github-helpers/api.js'; import GetIssueLockStatus from './is-conversation-locked.gql'; -import {getConversationNumber} from '../github-helpers/index.js'; async function isConversationLockedViaApi(): Promise { if (!await hasToken()) { diff --git a/source/github-helpers/load-details-menu.ts b/source/github-helpers/load-details-menu.ts index f57ce74061a3..f8738a963c86 100644 --- a/source/github-helpers/load-details-menu.ts +++ b/source/github-helpers/load-details-menu.ts @@ -1,5 +1,5 @@ -import {$optional} from 'select-dom/strict.js'; import oneEvent from 'one-event'; +import {$optional} from 'select-dom/strict.js'; export default async function loadDetailsMenu(detailsMenu: HTMLElement): Promise { const fragment = $optional('.js-comment-header-actions-deferred-include-fragment', detailsMenu); diff --git a/source/github-helpers/toast.tsx b/source/github-helpers/toast.tsx index ffe54fcf428a..f8d0baf052b4 100644 --- a/source/github-helpers/toast.tsx +++ b/source/github-helpers/toast.tsx @@ -1,8 +1,8 @@ import React from 'dom-chef'; -import {assertError} from 'ts-extras'; import CheckIcon from 'octicons-plain-react/Check'; import StopIcon from 'octicons-plain-react/Stop'; import oneEvent from 'one-event'; +import {assertError} from 'ts-extras'; import delay from '../helpers/delay.js'; import {frame} from '../helpers/dom-utils.js'; diff --git a/source/github-widgets/notice-bar.tsx b/source/github-widgets/notice-bar.tsx index 09e348b78d19..57244ce9dee7 100644 --- a/source/github-widgets/notice-bar.tsx +++ b/source/github-widgets/notice-bar.tsx @@ -1,6 +1,6 @@ import React from 'dom-chef'; -import XIcon from 'octicons-plain-react/X'; import elementReady from 'element-ready'; +import XIcon from 'octicons-plain-react/X'; type Options = { action?: Element | false; diff --git a/source/helpers/bisect.tsx b/source/helpers/bisect.tsx index 260650174a6b..32ba6ddfd807 100644 --- a/source/helpers/bisect.tsx +++ b/source/helpers/bisect.tsx @@ -1,12 +1,12 @@ import React from 'dom-chef'; -import {CachedValue} from 'webext-storage-cache'; +import elementReady from 'element-ready'; import {$$} from 'select-dom'; import {$optional} from 'select-dom/strict.js'; -import elementReady from 'element-ready'; +import {CachedValue} from 'webext-storage-cache'; +import {importedFeatures} from '../feature-data.js'; import pluralize from './pluralize.js'; import {getFeatureUrl} from './rgh-links.js'; -import {importedFeatures} from '../feature-data.js'; export const state = new CachedValue('bisect', {maxAge: {minutes: 15}}); diff --git a/source/helpers/click-all.ts b/source/helpers/click-all.ts index a17c55fc33a5..dec9b1cb73f2 100644 --- a/source/helpers/click-all.ts +++ b/source/helpers/click-all.ts @@ -1,6 +1,6 @@ +import type {DelegateEvent} from 'delegate-it'; import mem from 'memoize'; import {$$} from 'select-dom'; -import type {DelegateEvent} from 'delegate-it'; import preserveScroll from './preserve-scroll.js'; diff --git a/source/helpers/fetch-dom.ts b/source/helpers/fetch-dom.ts index e94fbededdb4..e5a1bfd27639 100644 --- a/source/helpers/fetch-dom.ts +++ b/source/helpers/fetch-dom.ts @@ -1,5 +1,5 @@ -import mem from 'memoize'; import domify from 'doma'; +import mem from 'memoize'; import type {ParseSelector} from 'typed-query-selector/parser.js'; import {log} from './feature-helpers.js'; diff --git a/source/helpers/hotfix.tsx b/source/helpers/hotfix.tsx index 0c8772f31c0d..ba00c76c3ec3 100644 --- a/source/helpers/hotfix.tsx +++ b/source/helpers/hotfix.tsx @@ -1,8 +1,8 @@ +import {any as concatenateTemplateLiteralTag} from 'code-tag'; import React from 'dom-chef'; -import {CachedFunction} from 'webext-storage-cache'; import {isEnterprise} from 'github-url-detection'; import compareVersions from 'tiny-version-compare'; -import {any as concatenateTemplateLiteralTag} from 'code-tag'; +import {CachedFunction} from 'webext-storage-cache'; import type {RghOptions} from '../options-storage.js'; import isDevelopmentVersion from './is-development-version.js'; diff --git a/source/helpers/selector-observer.tsx b/source/helpers/selector-observer.tsx index 727d10f82155..78c20db38b16 100644 --- a/source/helpers/selector-observer.tsx +++ b/source/helpers/selector-observer.tsx @@ -1,8 +1,8 @@ -import React from 'dom-chef'; +import {signalFromPromise} from 'abort-utils'; import {css} from 'code-tag'; -import type {ParseSelector} from 'typed-query-selector/parser.js'; +import React from 'dom-chef'; import domLoaded from 'dom-loaded'; -import {signalFromPromise} from 'abort-utils'; +import type {ParseSelector} from 'typed-query-selector/parser.js'; import delay from '../helpers/delay.js'; import onetime from '../helpers/onetime.js'; diff --git a/source/helpers/show-whitespace-on-line.test.ts b/source/helpers/show-whitespace-on-line.test.ts index 6aa5a6be927f..8173cc1073db 100644 --- a/source/helpers/show-whitespace-on-line.test.ts +++ b/source/helpers/show-whitespace-on-line.test.ts @@ -1,5 +1,5 @@ -import {assert, test} from 'vitest'; import hl from 'highlight.js'; +import {assert, test} from 'vitest'; import showWhiteSpacesOnLine from './show-whitespace-on-line.js'; diff --git a/source/options.tsx b/source/options.tsx index 6fe345ea5eb6..20539e75c7ef 100644 --- a/source/options.tsx +++ b/source/options.tsx @@ -1,24 +1,24 @@ import 'webext-base-css/webext-base.css'; import './options.css'; -import {$, $optional} from 'select-dom/strict.js'; -import {$$, elementExists} from 'select-dom'; +import delegate, {type DelegateEvent} from 'delegate-it'; import fitTextarea from 'fit-textarea'; import {enableTabToIndent} from 'indent-textarea'; -import delegate, {type DelegateEvent} from 'delegate-it'; +import {$$, elementExists} from 'select-dom'; +import {$, $optional} from 'select-dom/strict.js'; import {isChrome, isFirefox} from 'webext-detect'; import type {SyncedForm} from 'webext-options-sync-per-domain'; import 'webext-bugs/target-blank'; +import {importedFeatures} from './feature-data.js'; +import {state as bisectState} from './helpers/bisect.js'; import clearCacheHandler from './helpers/clear-cache-handler.js'; +import {doesBrowserActionOpenOptions} from './helpers/feature-utils.js'; import {brokenFeatures, styleHotfixes} from './helpers/hotfix.js'; -import {importedFeatures} from './feature-data.js'; -import {perDomainOptions} from './options-storage.js'; import isDevelopmentVersion from './helpers/is-development-version.js'; -import {doesBrowserActionOpenOptions} from './helpers/feature-utils.js'; -import {state as bisectState} from './helpers/bisect.js'; +import {perDomainOptions} from './options-storage.js'; import initFeatureList, {updateListDom} from './options/feature-list.js'; -import initTokenValidation from './options/token-validation.js'; import initToggleAllButtons from './options/toggle-all.js'; +import initTokenValidation from './options/token-validation.js'; const supportsFieldSizing = CSS.supports('field-sizing', 'content'); diff --git a/source/options/reload-without.ts b/source/options/reload-without.ts index 4b4bb0c05f75..69659eead57e 100644 --- a/source/options/reload-without.ts +++ b/source/options/reload-without.ts @@ -1,6 +1,6 @@ -import {StorageItem} from 'webext-storage'; import webextAlert from 'webext-alert'; import {isScriptableUrl} from 'webext-content-scripts'; +import {StorageItem} from 'webext-storage'; import {createContextMenu} from 'webext-tools'; // Always Firefox… https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/storage/StorageArea/setAccessLevel From 802cddf546d2ba669859300d4e634a0e5e7cfdec Mon Sep 17 00:00:00 2001 From: Simon Yewchuk Date: Sun, 19 Apr 2026 11:53:56 -0600 Subject: [PATCH 20/79] `global-conversation-list-filters` - Correctly limit to PRs (#9214) --- source/features/global-conversation-list-filters.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/features/global-conversation-list-filters.tsx b/source/features/global-conversation-list-filters.tsx index 42fe54027548..55477ce9651d 100644 --- a/source/features/global-conversation-list-filters.tsx +++ b/source/features/global-conversation-list-filters.tsx @@ -10,7 +10,7 @@ import observe from '../helpers/selector-observer.js'; function createLink(label: string, title: string, query: string): HTMLElement { const url = new URL('/pulls', location.origin); - url.searchParams.set('q', `is:open archived:false ${query}`); + url.searchParams.set('q', `is:pr is:open archived:false ${query}`); const link = {label}; const isCurrentPage = SearchQuery.from(location).includes(query); From c76f6a06417369d0374662552ad6c7418d57e05e Mon Sep 17 00:00:00 2001 From: fregante Date: Mon, 20 Apr 2026 17:10:49 +0700 Subject: [PATCH 21/79] `unread-anywhere` - Restore button (#9225) --- build/__snapshots__/features-meta.json | 1 + source/features/unread-anywhere.css | 5 ++++ source/features/unread-anywhere.tsx | 41 ++++++++++++++++++-------- 3 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 source/features/unread-anywhere.css diff --git a/build/__snapshots__/features-meta.json b/build/__snapshots__/features-meta.json index 6c0f65e2b7b3..a9e734bb6fee 100644 --- a/build/__snapshots__/features-meta.json +++ b/build/__snapshots__/features-meta.json @@ -936,6 +936,7 @@ { "id": "unread-anywhere", "description": "Adds a button to the global header to open your unread notifications from any page.", + "css": true, "screenshot": "https://github.com/user-attachments/assets/978ac1fe-db98-40f9-9b56-7d289849aa2f" }, { diff --git a/source/features/unread-anywhere.css b/source/features/unread-anywhere.css new file mode 100644 index 000000000000..b5e2c89cbf7b --- /dev/null +++ b/source/features/unread-anywhere.css @@ -0,0 +1,5 @@ +/* Done in CSS because React removes classes when updating the unread status */ +.rgh-unread-anywhere-wrapper a { + border-top-right-radius: 0 !important; + border-bottom-right-radius: 0 !important; +} diff --git a/source/features/unread-anywhere.tsx b/source/features/unread-anywhere.tsx index 9ccf4b69c34a..92a24242ab65 100644 --- a/source/features/unread-anywhere.tsx +++ b/source/features/unread-anywhere.tsx @@ -1,13 +1,15 @@ +import './unread-anywhere.css'; + import React from 'dom-chef'; import * as pageDetect from 'github-url-detection'; import ArrowUpRightIcon from 'octicons-plain-react/ArrowUpRight'; -import {$$optional, $optional} from 'select-dom/strict.js'; +import {$, $$optional} from 'select-dom/strict.js'; import {messageRuntime} from 'webext-msg'; import features from '../feature-manager.js'; import {registerHotkey} from '../github-helpers/hotkey.js'; import showToast from '../github-helpers/toast.js'; -import {getClasses, isSmallDevice} from '../helpers/dom-utils.js'; +import {getClasses, isSmallDevice, wrap} from '../helpers/dom-utils.js'; import {fetchDomUncached} from '../helpers/fetch-dom.js'; import onetime from '../helpers/onetime.js'; import pluralize from '../helpers/pluralize.js'; @@ -16,6 +18,16 @@ import {removeLinkToPrFilesTab} from './pr-notification-link.js'; const limit = 5; +const buttonWithNotificationsSelector = 'a[class*="notificationIndicator"]'; + +function removeNotificationIndicator(element: HTMLElement): void { + for (const className of element.classList) { + if (className.includes('notificationIndicator')) { + element.classList.remove(className); + } + } +} + async function openUnreadNotifications(event?: React.MouseEvent): Promise { if (event?.target instanceof HTMLButtonElement) { // Hide the tooltip @@ -46,8 +58,8 @@ async function openUnreadNotifications(event?: React.MouseEvent): Promise updateToast(`Opened the last ${limit} unread notifications`); } else { updateToast(pluralize(urls.length, '$$ notification') + ' opened'); - // Update the UI too. Optional because the UI is often out of date - $optional('.AppHeader-button--hasIndicator')?.classList.remove('AppHeader-button--hasIndicator'); + // Update the UI too + removeNotificationIndicator($(buttonWithNotificationsSelector)); } }, { message: 'Loading notifications…', @@ -59,18 +71,14 @@ async function openUnreadNotifications(event?: React.MouseEvent): Promise }); } -function addButton(nativeLink: HTMLAnchorElement): void { +async function addButton(nativeLink: HTMLAnchorElement): Promise { const classes = getClasses(nativeLink); - classes.delete('AppHeader-button--hasIndicator'); - // Reverse order so that the new button is painted below the "unread indicator" - nativeLink.parentElement!.classList.add('d-flex', 'flex-row-reverse'); - nativeLink.classList.add('AppHeader-buttonLeft'); const button = ( ); + + // Reverse order so that the new button is painted below the "unread indicator" + // Also has an rgh- class so that it can be targeted via CSS and deduplicated + wrap(nativeLink,
    ); + nativeLink.before(button); + button.setAttribute('data-variant', 'invisible'); // Enables hover style button.classList.add( ...classes, - 'AppHeader-buttonRight', 'tooltipped', 'tooltipped-sw', + 'rounded-left-0', + 'border-left-0', ); + + removeNotificationIndicator(button); } // No signal, created once per load function initOnce(): void { registerHotkey('g u', openUnreadNotifications); document.documentElement.classList.add('rgh-unread-anywhere'); - observe('a#AppHeader-notifications-button.AppHeader-button--hasIndicator', addButton); + observe(buttonWithNotificationsSelector + ':not(.rgh-unread-anywhere-wrapper *)', addButton); } void features.add(import.meta.url, { From 938bc983da8f3f8e1caadce18fa47d67c5d7a22a Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 10:20:52 +0000 Subject: [PATCH 22/79] Meta: sort imports (#9227) --- source/feature-renames.test.ts | 2 +- source/features/user-profile-follower-badge.tsx | 4 ++-- source/github-helpers/api.tsx | 8 ++++---- source/github-helpers/get-user-permission.ts | 1 - source/github-helpers/github-file-url.test.ts | 2 +- source/github-helpers/index.ts | 8 ++++---- source/github-helpers/parse-backticks.test.ts | 2 +- source/github-helpers/pr-branches.test.ts | 2 +- source/github-helpers/prevent-link-loss.ts | 2 +- source/github-helpers/search-query.test.ts | 2 +- source/helpers/calculate-css-calc-string.test.ts | 2 +- source/helpers/caller-id.test.ts | 2 +- source/helpers/clean-commit-message.test.ts | 2 +- source/helpers/conventional-commits.test.ts | 2 +- source/helpers/event-listener-loop.test.ts | 2 +- source/helpers/feature-utils.test.ts | 2 +- source/helpers/get-items-between.test.ts | 2 +- source/helpers/is-low-quality-comment.test.ts | 2 +- source/helpers/loose-parse-int.test.ts | 2 +- source/helpers/pluralize.test.ts | 2 +- source/helpers/pr-commit-cleaner.test.ts | 2 +- source/options/feature-list.tsx | 6 +++--- 22 files changed, 30 insertions(+), 31 deletions(-) diff --git a/source/feature-renames.test.ts b/source/feature-renames.test.ts index ab529286a858..a366a7a9f73a 100644 --- a/source/feature-renames.test.ts +++ b/source/feature-renames.test.ts @@ -1,7 +1,7 @@ import {execSync} from 'node:child_process'; import fs from 'node:fs/promises'; import path from 'node:path'; -import {test, expect} from 'vitest'; +import {expect, test} from 'vitest'; import featureRenames from './feature-renames.json'; diff --git a/source/features/user-profile-follower-badge.tsx b/source/features/user-profile-follower-badge.tsx index f0891a1b05df..8c788dd04d4e 100644 --- a/source/features/user-profile-follower-badge.tsx +++ b/source/features/user-profile-follower-badge.tsx @@ -1,11 +1,11 @@ import React from 'dom-chef'; -import {CachedFunction} from 'webext-storage-cache'; import elementReady from 'element-ready'; import * as pageDetect from 'github-url-detection'; +import {CachedFunction} from 'webext-storage-cache'; import features from '../feature-manager.js'; import api from '../github-helpers/api.js'; -import {getLoggedInUser, getCleanPathname} from '../github-helpers/index.js'; +import {getCleanPathname, getLoggedInUser} from '../github-helpers/index.js'; import attachElement from '../helpers/attach-element.js'; const doesUserFollow = new CachedFunction('user-follows', { diff --git a/source/github-helpers/api.tsx b/source/github-helpers/api.tsx index 463cbec6d851..c9a69bddcb8d 100644 --- a/source/github-helpers/api.tsx +++ b/source/github-helpers/api.tsx @@ -26,16 +26,16 @@ so the call will not throw an error but it will return as usual. */ import React from 'dom-chef'; -import mem from 'memoize'; import * as pageDetect from 'github-url-detection'; -import type {JsonObject, AsyncReturnType} from 'type-fest'; +import mem from 'memoize'; +import type {AsyncReturnType, JsonObject} from 'type-fest'; import {uint8ArrayToBase64} from 'uint8array-extras'; +import {log} from '../helpers/feature-helpers.js'; import onetime from '../helpers/onetime.js'; -import {getRepo, getLoggedInUser} from './index.js'; import {getToken} from '../options-storage.js'; -import {log} from '../helpers/feature-helpers.js'; import {tokenUser} from './github-token.js'; +import {getLoggedInUser, getRepo} from './index.js'; type JsonError = { message: string; diff --git a/source/github-helpers/get-user-permission.ts b/source/github-helpers/get-user-permission.ts index a4ea06b20d9e..37a1f643862b 100644 --- a/source/github-helpers/get-user-permission.ts +++ b/source/github-helpers/get-user-permission.ts @@ -68,7 +68,6 @@ export async function userIsModerator(): Promise { '[title^="You are a member"]', '[title^="You are a maintainer"]', '[title^="You are a collaborator"]', - // Don't check for admin access here. If the user has admin access, the DOM check in `viewerPermission` will use the DOM and be cached anyway ]); diff --git a/source/github-helpers/github-file-url.test.ts b/source/github-helpers/github-file-url.test.ts index ab987c7c7bac..b45bef993924 100644 --- a/source/github-helpers/github-file-url.test.ts +++ b/source/github-helpers/github-file-url.test.ts @@ -1,4 +1,4 @@ -import {test, assert} from 'vitest'; +import {assert, test} from 'vitest'; import GitHubFileUrl from './github-file-url.js'; diff --git a/source/github-helpers/index.ts b/source/github-helpers/index.ts index 2e7c8bc77da3..767a801d3c37 100644 --- a/source/github-helpers/index.ts +++ b/source/github-helpers/index.ts @@ -1,10 +1,10 @@ -import {$optional, $} from 'select-dom/strict.js'; -import {elementExists} from 'select-dom'; import elementReady from 'element-ready'; -import compareVersions from 'tiny-version-compare'; -import type {RequireAtLeastOne} from 'type-fest'; import * as pageDetect from 'github-url-detection'; import mem from 'memoize'; +import {elementExists} from 'select-dom'; +import {$, $optional} from 'select-dom/strict.js'; +import compareVersions from 'tiny-version-compare'; +import type {RequireAtLeastOne} from 'type-fest'; import {branchSelector} from './selectors.js'; diff --git a/source/github-helpers/parse-backticks.test.ts b/source/github-helpers/parse-backticks.test.ts index 8c342cfd4752..5c37b5761223 100644 --- a/source/github-helpers/parse-backticks.test.ts +++ b/source/github-helpers/parse-backticks.test.ts @@ -1,4 +1,4 @@ -import {test, assert} from 'vitest'; +import {assert, test} from 'vitest'; import {getParsedBackticksParts} from './parse-backticks.js'; diff --git a/source/github-helpers/pr-branches.test.ts b/source/github-helpers/pr-branches.test.ts index de9cbfba91d7..f879df85beb2 100644 --- a/source/github-helpers/pr-branches.test.ts +++ b/source/github-helpers/pr-branches.test.ts @@ -1,4 +1,4 @@ -import {test, assert} from 'vitest'; +import {assert, test} from 'vitest'; import {parseReferenceRaw} from './pr-branches.js'; diff --git a/source/github-helpers/prevent-link-loss.ts b/source/github-helpers/prevent-link-loss.ts index 0b6228878ea9..d36d74afb5b3 100644 --- a/source/github-helpers/prevent-link-loss.ts +++ b/source/github-helpers/prevent-link-loss.ts @@ -1,6 +1,6 @@ import type {RepositoryInfo} from 'github-url-detection'; -import {getRepo, getConversationNumber} from './index.js'; +import {getConversationNumber, getRepo} from './index.js'; function getRepoReference(currentRepo: RepositoryInfo | undefined, repoNameWithOwner: string, delimiter = ''): string { return repoNameWithOwner === currentRepo!.nameWithOwner ? '' : repoNameWithOwner + delimiter; diff --git a/source/github-helpers/search-query.test.ts b/source/github-helpers/search-query.test.ts index 7b7586d8861c..75617dcafe14 100644 --- a/source/github-helpers/search-query.test.ts +++ b/source/github-helpers/search-query.test.ts @@ -1,4 +1,4 @@ -import {test, assert} from 'vitest'; +import {assert, test} from 'vitest'; import SearchQuery from './search-query.js'; diff --git a/source/helpers/calculate-css-calc-string.test.ts b/source/helpers/calculate-css-calc-string.test.ts index fb670a37c4c8..c5eb339df839 100644 --- a/source/helpers/calculate-css-calc-string.test.ts +++ b/source/helpers/calculate-css-calc-string.test.ts @@ -1,4 +1,4 @@ -import {test, assert} from 'vitest'; +import {assert, test} from 'vitest'; import calculateCssCalcString from './calculate-css-calc-string.js'; diff --git a/source/helpers/caller-id.test.ts b/source/helpers/caller-id.test.ts index 3cfa5ce53c81..9935fa53747a 100644 --- a/source/helpers/caller-id.test.ts +++ b/source/helpers/caller-id.test.ts @@ -1,4 +1,4 @@ -import {test, assert} from 'vitest'; +import {assert, test} from 'vitest'; import {getStackLine} from './caller-id.js'; diff --git a/source/helpers/clean-commit-message.test.ts b/source/helpers/clean-commit-message.test.ts index 680d82dd58ac..9d9a7f00fa7e 100644 --- a/source/helpers/clean-commit-message.test.ts +++ b/source/helpers/clean-commit-message.test.ts @@ -1,4 +1,4 @@ -import {test, assert} from 'vitest'; +import {assert, test} from 'vitest'; import cleanCommitMessage from './clean-commit-message.js'; diff --git a/source/helpers/conventional-commits.test.ts b/source/helpers/conventional-commits.test.ts index f375a53db49b..7332edd70fcb 100644 --- a/source/helpers/conventional-commits.test.ts +++ b/source/helpers/conventional-commits.test.ts @@ -1,4 +1,4 @@ -import {test, expect} from 'vitest'; +import {expect, test} from 'vitest'; import {parseConventionalCommit} from './conventional-commits.js'; diff --git a/source/helpers/event-listener-loop.test.ts b/source/helpers/event-listener-loop.test.ts index df7ca7775e0b..598fcc8f4f92 100644 --- a/source/helpers/event-listener-loop.test.ts +++ b/source/helpers/event-listener-loop.test.ts @@ -1,4 +1,4 @@ -import {describe, it, expect} from 'vitest'; +import {describe, expect, it} from 'vitest'; import createEventIterator from './event-listener-loop.js'; diff --git a/source/helpers/feature-utils.test.ts b/source/helpers/feature-utils.test.ts index 5e588a6554cb..2fb6599bc7b9 100644 --- a/source/helpers/feature-utils.test.ts +++ b/source/helpers/feature-utils.test.ts @@ -1,4 +1,4 @@ -import {test, assert} from 'vitest'; +import {assert, test} from 'vitest'; import {shouldFeatureRun} from './feature-utils.js'; diff --git a/source/helpers/get-items-between.test.ts b/source/helpers/get-items-between.test.ts index 9e9fe39f38b2..2a9ba5a908c8 100644 --- a/source/helpers/get-items-between.test.ts +++ b/source/helpers/get-items-between.test.ts @@ -1,4 +1,4 @@ -import {test, assert} from 'vitest'; +import {assert, test} from 'vitest'; import getItemsBetween from './get-items-between.js'; diff --git a/source/helpers/is-low-quality-comment.test.ts b/source/helpers/is-low-quality-comment.test.ts index 2c79cc49d946..f144b66e7630 100644 --- a/source/helpers/is-low-quality-comment.test.ts +++ b/source/helpers/is-low-quality-comment.test.ts @@ -1,4 +1,4 @@ -import {describe, test, assert} from 'vitest'; +import {assert, describe, test} from 'vitest'; import isLowQualityComment from './is-low-quality-comment.js'; diff --git a/source/helpers/loose-parse-int.test.ts b/source/helpers/loose-parse-int.test.ts index a6662566a893..d3e7b93ca866 100644 --- a/source/helpers/loose-parse-int.test.ts +++ b/source/helpers/loose-parse-int.test.ts @@ -1,4 +1,4 @@ -import {test, assert} from 'vitest'; +import {assert, test} from 'vitest'; import looseParseInt from './loose-parse-int.js'; diff --git a/source/helpers/pluralize.test.ts b/source/helpers/pluralize.test.ts index 071791895b70..d2a6ae085457 100644 --- a/source/helpers/pluralize.test.ts +++ b/source/helpers/pluralize.test.ts @@ -1,4 +1,4 @@ -import {test, assert} from 'vitest'; +import {assert, test} from 'vitest'; import pluralize from './pluralize.js'; diff --git a/source/helpers/pr-commit-cleaner.test.ts b/source/helpers/pr-commit-cleaner.test.ts index d7b36d53826d..8f0039195c15 100644 --- a/source/helpers/pr-commit-cleaner.test.ts +++ b/source/helpers/pr-commit-cleaner.test.ts @@ -1,4 +1,4 @@ -import {test, assert} from 'vitest'; +import {assert, test} from 'vitest'; import cleanPrCommitTitle from './pr-commit-cleaner.js'; diff --git a/source/options/feature-list.tsx b/source/options/feature-list.tsx index e225a612c3f7..19459c8f4fd0 100644 --- a/source/options/feature-list.tsx +++ b/source/options/feature-list.tsx @@ -1,12 +1,12 @@ +import delegate, {type DelegateEvent} from 'delegate-it'; import React from 'dom-chef'; import domify from 'doma'; -import delegate, {type DelegateEvent} from 'delegate-it'; -import {$} from 'select-dom/strict.js'; import {$$, countElements} from 'select-dom'; +import {$} from 'select-dom/strict.js'; +import {featuresMeta, importedFeatures} from '../feature-data.js'; import {getLocalHotfixes} from '../helpers/hotfix.js'; import {createRghIssueLink, getFeatureUrl} from '../helpers/rgh-links.js'; -import {importedFeatures, featuresMeta} from '../feature-data.js'; function moveDisabledFeaturesToTop(): void { const container = $('.js-features'); From b76852d58e30ceb233bfc2132dbddbcedf428531 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 23:27:23 +0700 Subject: [PATCH 23/79] `mobile-tabs-pr` - Restore feature (#9228) Co-authored-by: Federico --- source/features/mobile-tabs-pr.css | 58 ++++++++++++++++++++++++++++++ source/features/mobile-tabs.css | 50 -------------------------- source/refined-github.ts | 1 + 3 files changed, 59 insertions(+), 50 deletions(-) create mode 100644 source/features/mobile-tabs-pr.css diff --git a/source/features/mobile-tabs-pr.css b/source/features/mobile-tabs-pr.css new file mode 100644 index 000000000000..5d1f056b0100 --- /dev/null +++ b/source/features/mobile-tabs-pr.css @@ -0,0 +1,58 @@ +/* Info: https://github.com/refined-github/refined-github/issues/7725 */ +@media (width <= 767px) { + a[class*='PullRequestHeaderNavigation'] { + display: inline-flex; + flex-wrap: wrap; + white-space: nowrap; + place-content: center center; + align-items: center; + padding: 0.7em 0; + font-size: 13px; + gap: 0 5px; + + svg { + order: -2; + display: block !important; + margin: 0 !important; + } + + [data-variant='secondary'] { + order: -1; + margin: 0 !important; + } + + &:first-child { + width: 13ch; + } + + &[href$='/commits'], + &[href$='/checks'] { + width: 12ch; + } + + &[href$='/changes'] { + width: 15ch; + } + } +} + +@media (width <= 500px) { + a[class*='PullRequestHeaderNavigation'] { + font-size: 10px; + + [data-variant='secondary'] { + background: none; + padding: 0; + margin: 0; + min-width: 0; + } + } +} + +/* + +Test URLs: + +- https://github.com/refined-github/sandbox/pull/1 + +*/ diff --git a/source/features/mobile-tabs.css b/source/features/mobile-tabs.css index 86b6bddadbbd..214bc21e07cd 100644 --- a/source/features/mobile-tabs.css +++ b/source/features/mobile-tabs.css @@ -92,60 +92,10 @@ grid-template-areas: 'icon icon' 'title title'; - svg { justify-self: center; } } - - /* PR tab navigation */ - /* https://github.com/refined-github/refined-github/issues/7725 */ - #partial-discussion-header + .tabnav .tabnav-tab { - display: inline-flex; - flex-wrap: wrap; - width: min-content; - white-space: nowrap; - place-content: center center; - align-items: center; - min-width: 7em; - padding: 0.7em; - font-size: 13px; - - .octicon { - order: -2; - display: block !important; - } - - .Counter { - order: -1; - } - - @media (width <= 500px) { - font-size: 10px; - - .Counter { - background: none; - padding: 0; - margin: 0; - min-width: 0; - } - } - } - - @media (width <= 500px) { - #partial-discussion-header + .tabnav { - font-size: 10px; - - /* Avoid awkward clipped overflow */ - padding-right: 0 !important; - - .Counter { - background: none; - padding: 0; - margin: 0; - } - } - } } /* diff --git a/source/refined-github.ts b/source/refined-github.ts index 90f0faec22b4..7e2dc8784186 100644 --- a/source/refined-github.ts +++ b/source/refined-github.ts @@ -22,6 +22,7 @@ import './features/clean-checks-list.css'; import './features/sticky-csv-header.css'; import './features/mark-private-repos.css'; import './features/mobile-tabs.css'; +import './features/mobile-tabs-pr.css'; // DO NOT add CSS files here if they are part of a JavaScript feature. // Import the `.css` file from the `.tsx` instead. From 912439952b7708f7cb9ff3f159412a4dd1af5662 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Apr 2026 12:57:19 +0700 Subject: [PATCH 24/79] Meta: improve readability and documentation of is/not selectors (#9230) Co-authored-by: fregante --- .../features/batch-mark-files-as-viewed.tsx | 10 +++++---- .../features/comments-time-machine-links.tsx | 9 ++++---- source/features/fit-textareas.tsx | 22 +++++++++++-------- source/features/linkify-user-labels.tsx | 9 ++++---- source/features/quick-mention.tsx | 14 ++++++------ source/features/same-page-links.tsx | 16 +++++++------- source/features/show-whitespace.tsx | 3 ++- source/features/small-user-avatars.tsx | 20 ++++++++++------- .../features/toggle-everything-with-alt.tsx | 6 ++++- source/github-helpers/index.ts | 5 +++-- source/helpers/css-selectors.ts | 13 +++++++++++ 11 files changed, 79 insertions(+), 48 deletions(-) create mode 100644 source/helpers/css-selectors.ts diff --git a/source/features/batch-mark-files-as-viewed.tsx b/source/features/batch-mark-files-as-viewed.tsx index b80b036eea6c..ba12f8722157 100644 --- a/source/features/batch-mark-files-as-viewed.tsx +++ b/source/features/batch-mark-files-as-viewed.tsx @@ -7,6 +7,7 @@ import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import showToast from '../github-helpers/toast.js'; import clickAll from '../helpers/click-all.js'; +import {is} from '../helpers/css-selectors.js'; import getItemsBetween from '../helpers/get-items-between.js'; export const viewedToggleSelector = [ @@ -20,7 +21,10 @@ const fileSelector = [ '.js-file', ] as const; // New view, Old view -const checkedSelector = ':is(:has(.octicon-checkbox-fill), [checked])'; +const checkedSelector = is( + ':has(.octicon-checkbox-fill)', + '[checked]', +); let previousFile: HTMLElement | undefined; @@ -64,12 +68,10 @@ function batchToggle(event: DelegateEvent): void { } function markAsViewedSelector(file: HTMLElement): string { - const fileElement = fileSelector.join(','); - const viewedToggle = viewedToggleSelector.join(','); const checkedState = isChecked(file) ? `:not(${checkedSelector})` : checkedSelector; // The `hidden` attribute excludes filtered-out files // https://github.com/refined-github/refined-github/issues/7819 - return `:is(${fileElement}):not([hidden]) :is(${viewedToggle})${checkedState}`; + return is(fileSelector) + ':not([hidden]) ' + is(viewedToggleSelector) + checkedState; } const markAsViewed = clickAll(markAsViewedSelector); diff --git a/source/features/comments-time-machine-links.tsx b/source/features/comments-time-machine-links.tsx index 5e0f6c151b1a..2fdaeaa1b709 100644 --- a/source/features/comments-time-machine-links.tsx +++ b/source/features/comments-time-machine-links.tsx @@ -13,16 +13,17 @@ import GitHubFileUrl from '../github-helpers/github-file-url.js'; import {expectToken} from '../github-helpers/github-token.js'; import {buildRepoUrl, isPermalink} from '../github-helpers/index.js'; import addNotice from '../github-widgets/notice-bar.js'; +import {is} from '../helpers/css-selectors.js'; import observe from '../helpers/selector-observer.js'; import GetCommitAtDate from './comments-time-machine-links.gql'; import {saveOriginalHref} from './sort-conversations-by-update-time.js'; -const commentSelector = [ +const commentSelector = is( '.loaded .react-issue-body', // Issue description '.react-issue-comment', // Issue comment '[data-testid="review-thread"] > div', // Review thread comment '.js-comment', // PR description or comment -].join(','); +); async function updateUrltoDatedSha(url: GitHubFileUrl, date: string): Promise { const {repository} = await api.v4(GetCommitAtDate, {variables: {date, branch: url.branch}}); @@ -167,10 +168,10 @@ async function init(signal: AbortSignal): Promise { // [data-component="IconButton"] includes only React buttons // :not([id^="task-list-menu"]) excludes task list (Convert to issue/sub-issue, etc) menu buttons - delegate(`:is(${commentSelector}) button[data-component="IconButton"]:has(> .octicon-kebab-horizontal):not([id^="task-list-menu"])`, 'click', addDropdownLinkReact, {signal}); + delegate(`${commentSelector} button[data-component="IconButton"]:has(> .octicon-kebab-horizontal):not([id^="task-list-menu"])`, 'click', addDropdownLinkReact, {signal}); observe( - `:is(${commentSelector}) a[href^="${location.origin}"]:not(.${linkifiedUrlClass})`, + `${commentSelector} a[href^="${location.origin}"]:not(.${linkifiedUrlClass})`, addDateParameterToLink, {signal}, ); diff --git a/source/features/fit-textareas.tsx b/source/features/fit-textareas.tsx index 22e609e7ab9b..e80b0c65ecab 100644 --- a/source/features/fit-textareas.tsx +++ b/source/features/fit-textareas.tsx @@ -6,6 +6,7 @@ import {$} from 'select-dom/strict.js'; import {isSafari} from 'webext-detect'; import features from '../feature-manager.js'; +import {not} from '../helpers/css-selectors.js'; import observe from '../helpers/selector-observer.js'; const nativeFit = CSS.supports('field-sizing', 'content'); @@ -37,15 +38,18 @@ function watchTextarea(textarea: HTMLTextAreaElement, {signal}: SignalAsOptions) } function init(signal: AbortSignal): void { - // `anchored-position`: Exclude PR review box because it's in a `position:fixed` container; The scroll HAS to appear within the fixed element. - // `#pull_request_body_ghost`: Special textarea that GitHub just matches to the visible textarea - observe(` - textarea:not( - anchored-position #pull_request_review_body, - #pull_request_body_ghost, - #pull_request_body_ghost_ruler - ) - `, watchTextarea, {signal}); + observe( + 'textarea' + not( + // `anchored-position`: Exclude PR review box because it's in a `position:fixed` container; The scroll HAS to appear within the fixed element. + 'anchored-position #pull_request_review_body', + + // `#pull_request_body_ghost`: Special textarea that GitHub just matches to the visible textarea + '#pull_request_body_ghost', + '#pull_request_body_ghost_ruler', + ), + watchTextarea, + {signal}, + ); } void features.add(import.meta.url, { diff --git a/source/features/linkify-user-labels.tsx b/source/features/linkify-user-labels.tsx index a3362c214609..d66d7a7f4a4f 100644 --- a/source/features/linkify-user-labels.tsx +++ b/source/features/linkify-user-labels.tsx @@ -7,6 +7,7 @@ import {$} from 'select-dom/strict.js'; import features from '../feature-manager.js'; import getCommentAuthor from '../github-helpers/get-comment-author.js'; import {buildRepoUrl} from '../github-helpers/index.js'; +import {is} from '../helpers/css-selectors.js'; import {wrap} from '../helpers/dom-utils.js'; import observe from '../helpers/selector-observer.js'; @@ -36,17 +37,17 @@ function linkify(label: HTMLElement): void { wrap(label, ); } -const ariaLabelSelector = [ +const ariaLabelSelector = is( '[aria-label^="This user is a member"]', '[aria-label^="This user has previously committed"]', '[aria-label^="This user has been invited to collaborate"]', -].join(','); +); function init(signal: AbortSignal): void { observe([ - `span[data-testid="comment-author-association"]:is(${ariaLabelSelector})`, + 'span[data-testid="comment-author-association"]' + ariaLabelSelector, // PRs - `.tooltipped:is(${ariaLabelSelector})`, + '.tooltipped' + ariaLabelSelector, ], linkify, {signal}); } diff --git a/source/features/quick-mention.tsx b/source/features/quick-mention.tsx index abb8899e8575..6bab2ab00450 100644 --- a/source/features/quick-mention.tsx +++ b/source/features/quick-mention.tsx @@ -10,6 +10,7 @@ import {insertTextIntoField} from 'text-field-edit'; import features from '../feature-manager.js'; import {getLoggedInUser, isArchivedRepoAsync} from '../github-helpers/index.js'; +import {is} from '../helpers/css-selectors.js'; import {wrap} from '../helpers/dom-utils.js'; import observe from '../helpers/selector-observer.js'; @@ -21,13 +22,12 @@ const fieldSelector = [ // Old Issue View and PR View // `:first-child` avoids app badges #2630 // Avatars next to review events aren't wrapped in a
    #4844 -const prCommentSelector = ` - .js-quote-selection-container - :is( - div.TimelineItem-avatar > [data-hovercard-type="user"]:first-child, - a.TimelineItem-avatar - ):not([href="/${getLoggedInUser()!}"]) -`; +const prCommentSelector = '.js-quote-selection-container ' + + is( + 'div.TimelineItem-avatar > [data-hovercard-type="user"]:first-child', + 'a.TimelineItem-avatar', + ) + + `:not([href="/${getLoggedInUser()!}"])`; const issueCommentSelector = [ // React Issue View diff --git a/source/features/same-page-links.tsx b/source/features/same-page-links.tsx index 3046a54ce0d6..a888d8f4ee0b 100644 --- a/source/features/same-page-links.tsx +++ b/source/features/same-page-links.tsx @@ -8,14 +8,14 @@ function fix(button: HTMLAnchorElement): void { } function init(signal: AbortSignal): void { - observe(`a[target="_blank"]:is(${[ - '[class^="ClosedEvent-module__closerLink"]', // "Closing issue" link - '[class^="LinkedPullRequest-module__pullRequestLink"]', // Linked PR links in issue headers - '[class^="prc-ActionList-ActionListContent"][aria-keyshortcuts="#"]', // Linked PR links in issue header menu - 'ul[data-testid="issue-viewer-linked-pr-container"] *', // Linked PR and release links on issue sidebar - '[class^="ReferencedEventInner-module__commitHashLink"]', // Commit linkbacks on issue timeline - 'div[data-testid="list-row-linked-pull-requests"] > *', // Linked PRs on issue list - ].join(',')})`, fix, {signal}); + observe([ + 'a[target="_blank"][class^="ClosedEvent-module__closerLink"]', // "Closing issue" link + 'a[target="_blank"][class^="LinkedPullRequest-module__pullRequestLink"]', // Linked PR links in issue headers + 'a[target="_blank"][class^="prc-ActionList-ActionListContent"][aria-keyshortcuts="#"]', // Linked PR links in issue header menu + 'ul[data-testid="issue-viewer-linked-pr-container"] a[target="_blank"]', // Linked PR and release links on issue sidebar + 'a[target="_blank"][class^="ReferencedEventInner-module__commitHashLink"]', // Commit linkbacks on issue timeline + 'div[data-testid="list-row-linked-pull-requests"] > a[target="_blank"]', // Linked PRs on issue list + ], fix, {signal}); } void features.add(import.meta.url, { diff --git a/source/features/show-whitespace.tsx b/source/features/show-whitespace.tsx index 2d5b57dc3eab..9b749b5a55a7 100644 --- a/source/features/show-whitespace.tsx +++ b/source/features/show-whitespace.tsx @@ -5,6 +5,7 @@ import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; import {codeElementsSelector} from '../github-helpers/dom-formatters.js'; +import {is} from '../helpers/css-selectors.js'; import observe from '../helpers/selector-observer.js'; import showWhiteSpacesOnLine from '../helpers/show-whitespace-on-line.js'; @@ -23,7 +24,7 @@ function showWhitespaceWhenInViewport(line: HTMLElement): void { } function init(signal: AbortSignal): void { - observe(`:is(${codeElementsSelector.join(',')}):not(.blob-code-hunk)`, showWhitespaceWhenInViewport, {signal}); + observe(is(codeElementsSelector) + ':not(.blob-code-hunk)', showWhitespaceWhenInViewport, {signal}); onAbort(signal, viewportObserver); } diff --git a/source/features/small-user-avatars.tsx b/source/features/small-user-avatars.tsx index b85ef4289dc6..892e14bd35a5 100644 --- a/source/features/small-user-avatars.tsx +++ b/source/features/small-user-avatars.tsx @@ -2,6 +2,7 @@ import React from 'dom-chef'; import features from '../feature-manager.js'; import getUserAvatarURL from '../github-helpers/get-user-avatar.js'; +import {is, not} from '../helpers/css-selectors.js'; import onetime from '../helpers/onetime.js'; import observe from '../helpers/selector-observer.js'; import './small-user-avatars.css'; @@ -36,15 +37,18 @@ function initOnce(): void { observe([ '.js-issue-row [data-hovercard-type="user"]', // `isPRList` + old `isIssueList` '.notification-thread-subscription [data-hovercard-type="user"]', // https://github.com/notifications/subscriptions - `:is( - [data-testid="created-at"], - [data-testid="closed-at"] - ) a[data-hovercard-url*="/users"]`, // `isIssueList` + is( + '[data-testid="created-at"]', + '[data-testid="closed-at"]', + ) + ' a[data-hovercard-url*="/users"]', // `isIssueList` ], addAvatar); - observe(`.user-mention:not(${[ - '.opened-by > *', // Merge queue - '.commit-author', - ].join(',')})`, addMentionAvatar); + observe( + '.user-mention' + not( + '.opened-by > *', // Merge queue + '.commit-author', + ), + addMentionAvatar, + ); } void features.add(import.meta.url, { diff --git a/source/features/toggle-everything-with-alt.tsx b/source/features/toggle-everything-with-alt.tsx index 431addae0c57..f662cee16f17 100644 --- a/source/features/toggle-everything-with-alt.tsx +++ b/source/features/toggle-everything-with-alt.tsx @@ -3,6 +3,7 @@ import * as pageDetect from 'github-url-detection'; import features from '../feature-manager.js'; import clickAll from '../helpers/click-all.js'; +import {is} from '../helpers/css-selectors.js'; function minimizedCommentsSelector(clickedItem: HTMLElement): string { const open = (clickedItem.parentElement as HTMLDetailsElement).open ? '[open]' : ':not([open])'; @@ -21,7 +22,10 @@ const collapseSelector = '.js-file .js-collapse-diff'; const commitMessageSelector = 'button[data-testid="commit-row-show-description-button"]'; -const addSuggestionToBatchSelector = ':is(.js-apply-changes button[data-variant="primary"], .js-batched-suggested-changes-add)'; +const addSuggestionToBatchSelector = is( + '.js-apply-changes button[data-variant="primary"]', + '.js-batched-suggested-changes-add', +); function markdownCommentSelector(clickedItem: HTMLElement): string { const {id} = clickedItem.closest('.TimelineItem-body[id]')!; diff --git a/source/github-helpers/index.ts b/source/github-helpers/index.ts index 767a801d3c37..96d3e7044fe0 100644 --- a/source/github-helpers/index.ts +++ b/source/github-helpers/index.ts @@ -7,6 +7,7 @@ import compareVersions from 'tiny-version-compare'; import type {RequireAtLeastOne} from 'type-fest'; import {branchSelector} from './selectors.js'; +import {is} from '../helpers/css-selectors.js'; // Re-export for convenience export const {getRepositoryInfo: getRepo, getCleanPathname, getLoggedInUser} = pageDetect.utils; @@ -127,11 +128,11 @@ export async function isArchivedRepoAsync(): Promise { export const userCanLikelyMergePr = (): boolean => elementExists('.discussion-sidebar-item .octicon-lock'); -const navigationBarSelector = `:is(${[ +const navigationBarSelector = is( '.GlobalNav', // Remove after June 2026 '.js-repo-nav', -].join(',')})`; +); export function areIssuesEnabled(): boolean { const repo = getRepo()!; diff --git a/source/helpers/css-selectors.ts b/source/helpers/css-selectors.ts new file mode 100644 index 000000000000..4d231331af90 --- /dev/null +++ b/source/helpers/css-selectors.ts @@ -0,0 +1,13 @@ +export function is(selectors: readonly string[]): string; +export function is(firstSelector: string, ...otherSelectors: readonly string[]): string; +export function is(firstSelector: readonly string[] | string, ...otherSelectors: readonly string[]): string { + const selectors = Array.isArray(firstSelector) ? firstSelector : [firstSelector, ...otherSelectors]; + return `:is(${selectors.join(', ')})`; +} + +export function not(selectors: readonly string[]): string; +export function not(firstSelector: string, ...otherSelectors: readonly string[]): string; +export function not(firstSelector: readonly string[] | string, ...otherSelectors: readonly string[]): string { + const selectors = Array.isArray(firstSelector) ? firstSelector : [firstSelector, ...otherSelectors]; + return `:not(${selectors.join(', ')})`; +} From 969c06f9b981819f0ba943a98afe7f0148d9a5e3 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Apr 2026 02:29:32 +0700 Subject: [PATCH 25/79] Meta: format CSS files with dprint (#9221) Co-authored-by: fregante Co-authored-by: Grigory --- dprint.json | 16 ++ package-lock.json | 216 ++++++++++++++++++ package.json | 8 +- source/features/center-reactions-popup.css | 6 +- source/features/clean-checks-list.css | 4 +- .../features/clean-conversation-headers.css | 2 +- .../features/clean-conversation-sidebar.css | 4 +- source/features/clean-repo-sidebar.css | 13 +- source/features/clean-rich-text-editor.css | 1 - .../features/conversation-activity-filter.css | 4 +- source/features/dim-bots.css | 3 +- source/features/emphasize-draft-pr-label.css | 14 +- source/features/extend-diff-expander.css | 3 +- source/features/github-bugs.css | 18 +- source/features/hide-diff-signs.css | 6 +- source/features/highest-rated-comment.css | 3 +- source/features/monospace-textareas.css | 10 +- .../no-unnecessary-split-diff-view.css | 28 +-- source/features/open-all-notifications.css | 2 +- source/features/pr-approvals-count.css | 6 +- source/features/sticky-comment-header.css | 4 +- .../features/sticky-notifications-actions.css | 3 +- source/features/sticky-sidebar.css | 6 +- .../features/suggest-commit-title-limit.css | 12 +- source/features/table-input.css | 26 +-- source/features/tag-changes-link.css | 3 +- .../features/warning-for-disallow-edits.css | 8 +- source/refined-github.css | 6 +- 28 files changed, 339 insertions(+), 96 deletions(-) create mode 100644 dprint.json diff --git a/dprint.json b/dprint.json new file mode 100644 index 000000000000..a5c79cb25afe --- /dev/null +++ b/dprint.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://dprint.dev/schemas/v0.json", + "plugins": [ + "./node_modules/dprint-plugin-malva/plugin.wasm", + "./node_modules/dprint-plugin-graphql/plugin.wasm" + ], + "includes": ["source/**/*.css", "source/**/*.gql"], + "malva": { + "linebreakInPseudoParens": true, + "quotes": "alwaysSingle", + "useTabs": true + }, + "graphql": { + "useTabs": true + } +} diff --git a/package-lock.json b/package-lock.json index fac2255dfdfa..1f8f20b5e5e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -72,6 +72,9 @@ "browserslist": "^4.28.1", "daily-version": "^2.0.0", "dot-json": "^1.3.0", + "dprint": "^0.54.0", + "dprint-plugin-graphql": "^0.2.3", + "dprint-plugin-malva": "^0.15.3", "eslint": "^9.39.2", "eslint-formatter-unix": "^9.0.1", "eslint-import-resolver-typescript": "^4.4.4", @@ -297,6 +300,181 @@ "node": ">=14.21.3" } }, + "node_modules/@dprint/darwin-arm64": { + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@dprint/darwin-arm64/-/darwin-arm64-0.54.0.tgz", + "integrity": "sha512-yqRI4enH+BDp+4+ZsPVdZM5h873JK1lN7li9l9A5u4C4cvh1oEsiBWAzEPccRkJ2ctF8LgaizBSxO38sqEVYbw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@dprint/darwin-x64": { + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@dprint/darwin-x64/-/darwin-x64-0.54.0.tgz", + "integrity": "sha512-W9BARpgHypcQwatg5mnHaCpX6pLX5dBxxiv+tZKruhOmq8MKYOrAYDXlceMuHSowmWREfUF5yL4SRgXDGI6WQw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@dprint/linux-arm64-glibc": { + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-glibc/-/linux-arm64-glibc-0.54.0.tgz", + "integrity": "sha512-VhM7p70VFuNqxZMdiv1e+nMboPj/hMFlTIBWrRaX7+6VThs9mJr9+94wrUeXgfnfsyaEKSbRFa/dru1PINoSNw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-arm64-musl": { + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-musl/-/linux-arm64-musl-0.54.0.tgz", + "integrity": "sha512-QS1A74Lv60/L9oemHCzbHgOLbV2smSJG5IxS5fjf8ZWetyUt918WDzIHBilz/+uiB+OlW2UVTsm952UG0YOrLw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-loong64-glibc": { + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-loong64-glibc/-/linux-loong64-glibc-0.54.0.tgz", + "integrity": "sha512-8Myka2/0KbhuZnEKL6jagPXTgDKVpd/tfXDRa0oibUBgaqOSku6iRMzHGa/PhqHL+s14Gcp+/cIHz0zU3Tkgug==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-loong64-musl": { + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-loong64-musl/-/linux-loong64-musl-0.54.0.tgz", + "integrity": "sha512-/AN3xCuMhC4PK7Pbj7/4zBuhFGr4m0OHV/5uGTfzpkKX/3+AXoyKl7PbT2VlNMGXAK0kuRThfjtx23gIwlWk7Q==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-riscv64-glibc": { + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-riscv64-glibc/-/linux-riscv64-glibc-0.54.0.tgz", + "integrity": "sha512-Aw2vXzzwFDpPbXh6ajsSabVCkCc66C3hCyMKprR/IxYvFtjYX80nh1ox0c7iaw6c4HacHMRLGw7FUSXvomPaEQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-x64-glibc": { + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-glibc/-/linux-x64-glibc-0.54.0.tgz", + "integrity": "sha512-zZqj3wQELOX8n6QfT2uuWoMf64Wv0lMXNyam3btm+PKkg0P6a54TPL09Bs9XsViOdxgTcamsiQ7HlErt/LEjIA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-x64-musl": { + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-musl/-/linux-x64-musl-0.54.0.tgz", + "integrity": "sha512-it6Qdt06dyW2adbAXpOCb7/KQLxlm4i1UphUAWqWsZk4t3EYetyAza9J0g3Vu9itIWSEIo9MnccgANckQJ6+qw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/win32-arm64": { + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@dprint/win32-arm64/-/win32-arm64-0.54.0.tgz", + "integrity": "sha512-F5kjV/6I9YtNOTDWHUpTqM2HHHS510BPL7z4NJuU0nDnaVeks7GwNEltGr56CcsG8XQYhkiAsqZytPu6AhA2hQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@dprint/win32-x64": { + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/@dprint/win32-x64/-/win32-x64-0.54.0.tgz", + "integrity": "sha512-AAr2ye/DtgYXDplRoPS+5U++x7T6W4a3I9FvTFWFxziFmUptvAg5G2c4FcXoAduSruhYZJvjDZrLseR2c3IwXg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@emnapi/core": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.8.1.tgz", @@ -4013,6 +4191,44 @@ "dot-json": "bin/dot-json.js" } }, + "node_modules/dprint": { + "version": "0.54.0", + "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.54.0.tgz", + "integrity": "sha512-sIy25poR2gRP/tWPTgP0MPeJoJcpv0xzYDcsboapvthbEt1Qw3Al252CA0xFyIh2cYEGGKyBJtKokryv4ERlJw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "dprint": "bin.cjs" + }, + "optionalDependencies": { + "@dprint/darwin-arm64": "0.54.0", + "@dprint/darwin-x64": "0.54.0", + "@dprint/linux-arm64-glibc": "0.54.0", + "@dprint/linux-arm64-musl": "0.54.0", + "@dprint/linux-loong64-glibc": "0.54.0", + "@dprint/linux-loong64-musl": "0.54.0", + "@dprint/linux-riscv64-glibc": "0.54.0", + "@dprint/linux-x64-glibc": "0.54.0", + "@dprint/linux-x64-musl": "0.54.0", + "@dprint/win32-arm64": "0.54.0", + "@dprint/win32-x64": "0.54.0" + } + }, + "node_modules/dprint-plugin-graphql": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/dprint-plugin-graphql/-/dprint-plugin-graphql-0.2.3.tgz", + "integrity": "sha512-ZF5CW1H06ptfQxez5oyCTkyaoMUUTF09iudR2sNNBsyaVOqk6/4Ij/UkuiCW9u5U1pSeUgvle/U6HthIXNa24Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/dprint-plugin-malva": { + "version": "0.15.3", + "resolved": "https://registry.npmjs.org/dprint-plugin-malva/-/dprint-plugin-malva-0.15.3.tgz", + "integrity": "sha512-rDBVztvpSa5Y2wqlYPvAP8kCEZdab2RovEWXPO+pE2gu3F8jJg/IjV0cKVSO7blIzP8iKmlD9u/TDnsZUHPoFg==", + "dev": true, + "license": "MIT" + }, "node_modules/electron-to-chromium": { "version": "1.5.278", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.278.tgz", diff --git a/package.json b/package.json index 1077e1581d8e..c40e6b9d1433 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,12 @@ "build:typescript": "tsc --noEmit", "build:bundle": "rollup -c", "fix": "run-p \"lint:biome -- --write\" \"lint:js -- --fix\" format \"vitest -- --update\" --continue-on-error", - "format": "prettier . --write && biome format --fix", + "format": "prettier . --write && dprint fmt", "lint": "run-p lint:* --continue-on-error", "lint:js": "eslint .", - "lint:biome": "biome check", + "lint:biome": "biome lint", "lint:prettier": "prettier . --check", + "lint:dprint": "dprint check", "new": "bash build/new-feature.sh", "pack:safari": "xcodebuild -project 'safari/Refined GitHub.xcodeproj' -scheme 'Refined GitHub' -destination 'platform=macOS'", "prepare:safari": "bash build/prepare-safari-release.sh", @@ -104,6 +105,9 @@ "browserslist": "^4.28.1", "daily-version": "^2.0.0", "dot-json": "^1.3.0", + "dprint": "^0.54.0", + "dprint-plugin-graphql": "^0.2.3", + "dprint-plugin-malva": "^0.15.3", "eslint": "^9.39.2", "eslint-formatter-unix": "^9.0.1", "eslint-import-resolver-typescript": "^4.4.4", diff --git a/source/features/center-reactions-popup.css b/source/features/center-reactions-popup.css index d23ac395b05f..45e093d05275 100644 --- a/source/features/center-reactions-popup.css +++ b/source/features/center-reactions-popup.css @@ -1,7 +1,8 @@ /* Restore two-line layout */ :root .dropdown-menu-reactions { display: grid !important; - grid-template-rows: 1fr 1fr; /* Keep two lines whether there are 6 or 8 reactions */ + /* Keep two lines whether there are 6 or 8 reactions */ + grid-template-rows: 1fr 1fr; grid-auto-flow: column; /* Move the popups */ @@ -28,7 +29,8 @@ :root div[data-visibility-visible]:has([class*='ReactionsMenuItem-module']) { & > ul { display: grid !important; - grid-template-rows: 1fr 1fr; /* Keep two lines whether there are 6 or 8 reactions */ + /* Keep two lines whether there are 6 or 8 reactions */ + grid-template-rows: 1fr 1fr; grid-auto-flow: column; } diff --git a/source/features/clean-checks-list.css b/source/features/clean-checks-list.css index 111637bedd44..8c3939467bdd 100644 --- a/source/features/clean-checks-list.css +++ b/source/features/clean-checks-list.css @@ -24,8 +24,8 @@ /* Dim successful/skipped/neutral checks */ .merge-status-list:has(.octicon-x, .text-italic):not(:hover) -/* Only if any checks are failing or in progress */ -.merge-status-item:has(.octicon-check, .octicon-skip, .octicon-square-fill) { + /* Only if any checks are failing or in progress */ + .merge-status-item:has(.octicon-check, .octicon-skip, .octicon-square-fill) { opacity: 50%; } diff --git a/source/features/clean-conversation-headers.css b/source/features/clean-conversation-headers.css index d290f2aa573d..a419625eaa7d 100644 --- a/source/features/clean-conversation-headers.css +++ b/source/features/clean-conversation-headers.css @@ -49,7 +49,7 @@ [class^='PullRequestBranchName'], /* TODO: Remove after July 2026 */ - .commit-ref, + .commit-ref, [class^='BranchName'] { font-size: 12px !important; } diff --git a/source/features/clean-conversation-sidebar.css b/source/features/clean-conversation-sidebar.css index cac0d0a7f972..3901e2b586d9 100644 --- a/source/features/clean-conversation-sidebar.css +++ b/source/features/clean-conversation-sidebar.css @@ -6,8 +6,8 @@ html:not([rgh-OFF-clean-conversation-sidebar]) { } span:is([class*='emptyText'], [class*='developmentHelpText']):not( - :has(> button) - ) { + :has(> button) + ) { display: none; } } diff --git a/source/features/clean-repo-sidebar.css b/source/features/clean-repo-sidebar.css index 1f43b0c26ce8..537bcbe5cfa9 100644 --- a/source/features/clean-repo-sidebar.css +++ b/source/features/clean-repo-sidebar.css @@ -27,12 +27,13 @@ } /* - * Hide "+ 65 releases" link - * Hide "Learn more about GitHub Sponsors" link - * Hide "+ 123 contributors" link - * Don't hide "Create new release" link #8442 - */ - .Layout-sidebar .BorderGrid-cell + * Hide "+ 65 releases" link + * Hide "Learn more about GitHub Sponsors" link + * Hide "+ 123 contributors" link + * Don't hide "Create new release" link #8442 + */ + .Layout-sidebar + .BorderGrid-cell > .mt-3:not(:has(> a[href$='releases/new'])) { display: none; } diff --git a/source/features/clean-rich-text-editor.css b/source/features/clean-rich-text-editor.css index 99b98a9d2f76..43a6dedcf345 100644 --- a/source/features/clean-rich-text-editor.css +++ b/source/features/clean-rich-text-editor.css @@ -2,7 +2,6 @@ /* Kinda excludes "soft keyboards" devices https://github.com/w3c/csswg-drafts/issues/3871 */ @media (hover: hover) and (pointer: fine) { html:not([rgh-OFF-clean-rich-text-editor]) - /* biome-ignore format: bug */ button:is( /* Classic fields */ [data-md-button='mention'], diff --git a/source/features/conversation-activity-filter.css b/source/features/conversation-activity-filter.css index bf41f6db4569..40ce77d3dd38 100644 --- a/source/features/conversation-activity-filter.css +++ b/source/features/conversation-activity-filter.css @@ -46,8 +46,8 @@ } &:is( - [data-rgh-conversation-activity-filter='hideEventsAndCollapsedComments'] * - ) { + [data-rgh-conversation-activity-filter='hideEventsAndCollapsedComments'] * + ) { .octicon-eye { display: none; } diff --git a/source/features/dim-bots.css b/source/features/dim-bots.css index a388778fc2e4..c41b9589052e 100644 --- a/source/features/dim-bots.css +++ b/source/features/dim-bots.css @@ -7,8 +7,7 @@ /* Commit titles, dim */ &:not(.rgh-tagged, :hover) > *, /* PR row, dim */ - &:not(.rgh-tagged, :hover) - .Box-row--drag-hide { + &:not(.rgh-tagged, :hover) .Box-row--drag-hide { opacity: 50%; /* Match `mark-merge-commits-in-list` */ } diff --git a/source/features/emphasize-draft-pr-label.css b/source/features/emphasize-draft-pr-label.css index ea5a0b97aadf..2b344179cfc6 100644 --- a/source/features/emphasize-draft-pr-label.css +++ b/source/features/emphasize-draft-pr-label.css @@ -3,24 +3,24 @@ @media (min-resolution: 2x) { html:not([rgh-OFF-emphasize-draft-pr-label]) { /* Dashboard PR lists */ - div[class*='DashboardListView-module__ItemLeadingVisual'] svg[aria-label='Status: Draft (not ready).'], + div[class*='DashboardListView-module__ItemLeadingVisual'] + svg[aria-label='Status: Draft (not ready).'], .js-issue-row - /* biome-ignore format: bug */ :is( /* Repo PR lists */ - [aria-label='Open draft pull request'], + [aria-label='Open draft pull request'], /* Global PR lists */ - [aria-label='Draft Pull Request'] + [aria-label='Draft Pull Request'] ) svg, /* React issue list */ - [aria-label*='Status: Draft (not ready)'] + [aria-label*='Status: Draft (not ready)'] [data-testid='list-row-state-icon'] svg, /* Notification select by */ - .rgh-select-notifications .octicon-git-pull-request-draft, + .rgh-select-notifications .octicon-git-pull-request-draft, /* Notification list */ - .notification-list-item-link .octicon-git-pull-request-draft { + .notification-list-item-link .octicon-git-pull-request-draft { stroke: var(--fgColor-muted, var(--color-fg-muted, fuchsia)); stroke-width: 1.2px; color: var(--rgh-background, fuchsia) !important; diff --git a/source/features/extend-diff-expander.css b/source/features/extend-diff-expander.css index cca3d6db6445..124782d4a86e 100644 --- a/source/features/extend-diff-expander.css +++ b/source/features/extend-diff-expander.css @@ -1,6 +1,7 @@ /* TODO: Revert https://github.com/refined-github/refined-github/pull/8111 in April 2025 */ /* Hovering the line will highlight the first direction button, unless you hover the buttons directly */ -.rgh-extend-diff-expander .js-expandable-line:hover +.rgh-extend-diff-expander + .js-expandable-line:hover :is( .blob-num:not(:hover) .directional-expander:first-child, .blob-num:not(:hover) + .blob-code diff --git a/source/features/github-bugs.css b/source/features/github-bugs.css index 167211507f92..0c7b50f1fcbc 100644 --- a/source/features/github-bugs.css +++ b/source/features/github-bugs.css @@ -1,7 +1,7 @@ /* Style backticked code in links #4817, matches GitHub’s `.markdown-title code` rule */ li[data-testid='commit-row-item'] code /* `isCommitList` commit message */, -div[class^='CommitHeader-module__commitMessageContainer'] - code /* `isCommit` commit message */, +/* `isCommit` commit message */ +div[class^='CommitHeader-module__commitMessageContainer'] code, a[class*='PinnedIssue-module__Link'] code { padding: 2px 4px; background-color: var( @@ -14,7 +14,8 @@ a[class*='PinnedIssue-module__Link'] code { } /* Fix spacing of repo header button icons #5620 */ -.pagehead-actions :is( +.pagehead-actions + :is( .btn, .Button--secondary, [class^='prc-Button-ButtonBase'], @@ -72,9 +73,9 @@ div.markdown-body { @media (width >= 768px) { /* Pulls the alert container to the right when empty */ .gap-4.pl-3:not(:has(a.h6)):has( - > .d-md-block - > .js-socket-channel[data-url^='/notifications/beta/recent_notifications_alert'] - ) { + > .d-md-block + > .js-socket-channel[data-url^='/notifications/beta/recent_notifications_alert'] + ) { /* Subtract 16px spacing from both .gap-3 and .ml-3 */ margin-right: -32px; } @@ -122,7 +123,7 @@ div.markdown-body { /* Info: https://github.com/refined-github/refined-github/pull/9116/ */ /* Test: https://github.com/refined-github/sandbox/pull/61 */ div[class^='prc-PageHeader-Description'] -> .flex-column.flex-sm-row.flex-items-start { + > .flex-column.flex-sm-row.flex-items-start { /* flex-sm-items-center */ @media (min-width: 544px) { align-items: center !important; @@ -157,7 +158,8 @@ react-app[app-name='pull-requests'] { /* Fix checks state icon alignment in file tree sidebar */ /* Info: https://github.com/refined-github/refined-github/issues/9198 */ /* Test: https://github.com/refined-github/refined-github/pull/8958/changes */ -div[class^='PRIVATE_TreeView-item-visual'] > .flex-items-center.flex-row +div[class^='PRIVATE_TreeView-item-visual'] + > .flex-items-center.flex-row > div:has(> svg) { line-height: 0; diff --git a/source/features/hide-diff-signs.css b/source/features/hide-diff-signs.css index 99629fffd1ef..7a1f0f11fe69 100644 --- a/source/features/hide-diff-signs.css +++ b/source/features/hide-diff-signs.css @@ -1,11 +1,11 @@ html:not([rgh-OFF-hide-diff-signs]) :is( - .diff-text-cell - .diff-text /* Edit page, probably upcoming DOM everywhere */, + /* Edit page, probably upcoming DOM everywhere */ + .diff-text-cell .diff-text, .blob-code-inner /* Inline review blocks in PRs */, .blob-code-marker-cell /* Commit page */ )::before, /* React commit page */ - .diff-text-marker { +.diff-text-marker { visibility: hidden; } diff --git a/source/features/highest-rated-comment.css b/source/features/highest-rated-comment.css index 8a57d4677697..5761fc1b060b 100644 --- a/source/features/highest-rated-comment.css +++ b/source/features/highest-rated-comment.css @@ -13,7 +13,8 @@ a.rgh-highest-rated-comment { border: 2px solid - var(--borderColor-success-emphasis, var(--color-success-emphasis, fuchsia)) !important; + var(--borderColor-success-emphasis, var(--color-success-emphasis, fuchsia)) + !important; } a.rgh-highest-rated-comment .avatar { diff --git a/source/features/monospace-textareas.css b/source/features/monospace-textareas.css index c4ad79da5aa8..19d38f69cc2d 100644 --- a/source/features/monospace-textareas.css +++ b/source/features/monospace-textareas.css @@ -4,15 +4,15 @@ /* https://github.com/refined-github/sandbox/pull/10#issue-comment-box */ [placeholder='Add an optional extended description…'], /* Test URL: https://github.com/refined-github/refined-github/edit/main/.editorconfig */ - #commit-message-input, +#commit-message-input, /* Test URL: https://github.com/refined-github/refined-github/edit/main/.editorconfig */ - #commit-description-input, +#commit-description-input, /* Test URL: https://github.com/refined-github/refined-github/releases/new */ - #release_body, +#release_body, /* Test URL: https://github.com/settings/gpg/new */ - #gpg_key_public_key, +#gpg_key_public_key, /* Test URL: https://github.com/settings/ssh/new */ - #ssh_key_key { +#ssh_key_key { font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace !important; diff --git a/source/features/no-unnecessary-split-diff-view.css b/source/features/no-unnecessary-split-diff-view.css index b4c3d9764487..dee0c0b962c5 100644 --- a/source/features/no-unnecessary-split-diff-view.css +++ b/source/features/no-unnecessary-split-diff-view.css @@ -4,26 +4,26 @@ html:not([rgh-OFF-no-unnecessary-split-diff-view]) { .js-diff-table:has([data-split-side]) { &:not( - :has( - [data-split-side='left']:is( - .blob-code-addition, - .blob-code-deletion - ) - ) - ) { + :has( + [data-split-side='left']:is( + .blob-code-addition, + .blob-code-deletion + ) + ) + ) { --rgh-only-additions: none; table-layout: auto !important; } &:not( - :has( - [data-split-side='right']:is( - .blob-code-addition, - .blob-code-deletion - ) - ) - ) { + :has( + [data-split-side='right']:is( + .blob-code-addition, + .blob-code-deletion + ) + ) + ) { --rgh-only-deletions: none; table-layout: auto !important; diff --git a/source/features/open-all-notifications.css b/source/features/open-all-notifications.css index da3198d0653a..4bc1fb630997 100644 --- a/source/features/open-all-notifications.css +++ b/source/features/open-all-notifications.css @@ -1,6 +1,6 @@ /* Only show "Open all unread" if no notifications are selected */ .js-notifications-mark-selected-actions[hidden] -~ .rgh-open-notifications-button { + ~ .rgh-open-notifications-button { display: inline-block !important; } diff --git a/source/features/pr-approvals-count.css b/source/features/pr-approvals-count.css index dc7182d240cf..67b8bda9c2c1 100644 --- a/source/features/pr-approvals-count.css +++ b/source/features/pr-approvals-count.css @@ -1,7 +1,8 @@ /* TODO: Drop coloring in July 2025. New PR view renders this defunct and redundant. */ /* Show approvals count in PR list */ -.js-issue-row .color-fg-muted +.js-issue-row + .color-fg-muted [href$='#partial-pull-merging'][aria-label*='approval'] { font-size: 0; color: transparent !important; @@ -30,7 +31,8 @@ } /* Disable now-duplicate tooltip */ -.js-issue-row .color-fg-muted +.js-issue-row + .color-fg-muted [href$='#partial-pull-merging'][aria-label*='approval']::after { content: none; } diff --git a/source/features/sticky-comment-header.css b/source/features/sticky-comment-header.css index 789cddf7c1d9..c08a5cf68c26 100644 --- a/source/features/sticky-comment-header.css +++ b/source/features/sticky-comment-header.css @@ -6,7 +6,7 @@ html:not([rgh-OFF-sticky-comment-header]).rgh-show-names { react-app[app-name='issues-react'], /* TODO: Remove after July 2026 */ - .pull-request-tab-content { + .pull-request-tab-content { --rgh-issue-or-pr-sticky-header-height: 56px; } react-app[app-name='pull-requests'] { @@ -26,7 +26,7 @@ html:not([rgh-OFF-sticky-comment-header]).rgh-show-names { z-index: 3; top: calc( var(--base-sticky-header-height, 0px) + - var(--rgh-issue-or-pr-sticky-header-height, 0px) + var(--rgh-issue-or-pr-sticky-header-height, 0px) ); } diff --git a/source/features/sticky-notifications-actions.css b/source/features/sticky-notifications-actions.css index 3b0763e7a608..8afe8f03ff99 100644 --- a/source/features/sticky-notifications-actions.css +++ b/source/features/sticky-notifications-actions.css @@ -29,8 +29,7 @@ .js-notifications-banners-target { margin-bottom: calc( - max(var(--shadow-blur-radius) * 0.6, 0px) + - var(--shadow-spread-radius) + max(var(--shadow-blur-radius) * 0.6, 0px) + var(--shadow-spread-radius) ); } } diff --git a/source/features/sticky-sidebar.css b/source/features/sticky-sidebar.css index 4e8ab17bea98..813b17d16361 100644 --- a/source/features/sticky-sidebar.css +++ b/source/features/sticky-sidebar.css @@ -7,14 +7,14 @@ Exclusively use simple sums and use `0px` instead of `0` --rgh-sticky-header-height: 70px; /* 60px plus some padding */ --rgh-sticky-sidebar-offset: calc( var(--rgh-sticky-header-height, 0px) + - var(--rgh-sticky-notification-header-height, 0px) + var(--rgh-sticky-notification-header-height, 0px) ); } /* `isRepoRoot` */ div[class^='prc-PageLayout-Pane']:has( - > rails-partial[data-partial-name='codeViewRepoRoute.Sidebar'] - ), + > rails-partial[data-partial-name='codeViewRepoRoute.Sidebar'] +), /* Old `isRepoRoot` - Remove after August 2026 */ .Layout-sidebar .BorderGrid { --rgh-sticky-sidebar-offset: 0; diff --git a/source/features/suggest-commit-title-limit.css b/source/features/suggest-commit-title-limit.css index 66bfb62cae0e..04ce12ba6b36 100644 --- a/source/features/suggest-commit-title-limit.css +++ b/source/features/suggest-commit-title-limit.css @@ -4,12 +4,12 @@ /* Limit width of commit title to 72 characters */ .rgh-suggest-commit-title-limit -:is( - [data-testid='mergebox-partial'] input[type='text'], - #commit-message-input, - /* TODO: Remove after July 2026 */ + :is( + [data-testid='mergebox-partial'] input[type='text'], + #commit-message-input, + /* TODO: Remove after July 2026 */ #commit-summary-input -) { + ) { box-sizing: content-box; /* Exclude padding/border from `width`; No need to mess with `calc` */ width: 72ch; @@ -22,7 +22,7 @@ /* TODO: Remove after August 2026 */ #pull_request_title, /* TODO: Remove after July 2026 */ - #commit-summary-input, +#commit-summary-input, #issue_title { &.rgh-title-over-limit { border-color: var(--rgh-limit-color); diff --git a/source/features/table-input.css b/source/features/table-input.css index 863665dd2214..e2fd63a9d961 100644 --- a/source/features/table-input.css +++ b/source/features/table-input.css @@ -38,23 +38,23 @@ .rgh-tic:hover::before, /* Hovering the 1st column */ - .rgh-tic:is(:nth-of-type(5n + 1)):has( - ~ .rgh-tic:hover:nth-of-type(5n + 1) - )::before, +.rgh-tic:is(:nth-of-type(5n+1)):has( + ~ .rgh-tic:hover:nth-of-type(5n+1) +)::before, /* Hovering the 2nd column */ - .rgh-tic:is(:nth-of-type(5n + 1), :nth-of-type(5n + 2)):has( - ~ .rgh-tic:hover:nth-of-type(5n + 2) - )::before, +.rgh-tic:is(:nth-of-type(5n+1), :nth-of-type(5n+2)):has( + ~ .rgh-tic:hover:nth-of-type(5n+2) +)::before, /* Hovering the 3rd column */ - .rgh-tic:not(:nth-of-type(5n + 4), :nth-of-type(5n + 5)):has( - ~ .rgh-tic:hover:nth-of-type(5n + 3) - )::before, +.rgh-tic:not(:nth-of-type(5n+4), :nth-of-type(5n+5)):has( + ~ .rgh-tic:hover:nth-of-type(5n+3) +)::before, /* Hovering the 4th column */ - .rgh-tic:not(:nth-of-type(5n + 5)):has( - ~ .rgh-tic:hover:nth-of-type(5n + 4) - )::before, +.rgh-tic:not(:nth-of-type(5n+5)):has( + ~ .rgh-tic:hover:nth-of-type(5n+4) +)::before, /* Hovering the 5th column */ - .rgh-tic:has(~ .rgh-tic:hover:nth-of-type(5n + 5))::before { +.rgh-tic:has(~ .rgh-tic:hover:nth-of-type(5n+5))::before { border-color: var(--borderColor-accent-muted, fuchsia); background-color: var(--bgColor-accent-muted, fuchsia); } diff --git a/source/features/tag-changes-link.css b/source/features/tag-changes-link.css index 7a814cece265..b7f1e9ac3fc1 100644 --- a/source/features/tag-changes-link.css +++ b/source/features/tag-changes-link.css @@ -1,7 +1,8 @@ /* Don't break layout on mobile (https://primer.style/css/support/breakpoints) */ @media (width >= 768px) { /* Reserve some space above the "Compare" dropdown (the selector will be disabled as soon as the "Changelog" link is inserted) */ - .rgh-tag-changes-link .repository-content + .rgh-tag-changes-link + .repository-content .my-5 > :first-child > :nth-child(5):not(.rgh-changelog-link) { diff --git a/source/features/warning-for-disallow-edits.css b/source/features/warning-for-disallow-edits.css index 688721f0fb20..9f31585d8337 100644 --- a/source/features/warning-for-disallow-edits.css +++ b/source/features/warning-for-disallow-edits.css @@ -6,15 +6,15 @@ } :is(.discussion-sidebar-item, .js-collab-option):has( - input[name='collab_privs']:not(:checked) - ) + input[name='collab_privs']:not(:checked) +) ~ .rgh-warning-for-disallow-edits { display: block; } :is(.discussion-sidebar-item, .js-collab-option):has( - input[name='collab_privs']:checked - ) + input[name='collab_privs']:checked +) ~ .rgh-warning-for-disallow-edits { display: none; } diff --git a/source/refined-github.css b/source/refined-github.css index 2ca6c60e6dd0..108cdccf1621 100644 --- a/source/refined-github.css +++ b/source/refined-github.css @@ -37,9 +37,9 @@ https://github.com/notifications?query=reason%3Acomment (which is an unsaved fil } :is( - .js-notifications-mark-selected-actions, - .js-notifications-mark-all-actions - ):not([hidden]) { + .js-notifications-mark-selected-actions, + .js-notifications-mark-all-actions +):not([hidden]) { display: contents !important; } From 321cd93154ea24874e77af803c167e28e8db86b6 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 22 Apr 2026 02:59:28 +0700 Subject: [PATCH 26/79] Meta: format Svelte files with dprint (#9220) Co-authored-by: fregante --- .prettierignore | 3 --- dprint.json | 20 ++++++++++++++------ eslint.config.js | 3 ++- package-lock.json | 22 +++++++++------------- package.json | 22 +++------------------- source/options/header.svelte | 2 +- source/options/storage-usage.svelte | 8 +++++--- source/options/version-info.svelte | 6 +++--- source/welcome.svelte | 6 +++--- 9 files changed, 40 insertions(+), 52 deletions(-) diff --git a/.prettierignore b/.prettierignore index 59922da7af85..01b5dbbe7b03 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,2 @@ # Ensure Prettier is not automatically run by editors on unwanted files *.* -# Only svelte files are covered -# TODO: After https://github.com/biomejs/biome/issues/6657 -!*.svelte diff --git a/dprint.json b/dprint.json index a5c79cb25afe..dad5455f02b3 100644 --- a/dprint.json +++ b/dprint.json @@ -1,16 +1,24 @@ { "$schema": "https://dprint.dev/schemas/v0.json", "plugins": [ + "./node_modules/dprint-plugin-markup/plugin.wasm", "./node_modules/dprint-plugin-malva/plugin.wasm", "./node_modules/dprint-plugin-graphql/plugin.wasm" ], - "includes": ["source/**/*.css", "source/**/*.gql"], + "includes": [ + "**/*.svelte", + "**/*.css", + "**/*.gql" + ], + "useTabs": true, + "markup": { + "whitespaceSensitivity": "strict", + "scriptIndent": true, + "styleIndent": true + }, "malva": { "linebreakInPseudoParens": true, - "quotes": "alwaysSingle", - "useTabs": true + "quotes": "alwaysSingle" }, - "graphql": { - "useTabs": true - } + "graphql": {} } diff --git a/eslint.config.js b/eslint.config.js index 6c357541e305..5b3779032672 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,6 +1,7 @@ import xo from 'xo'; import sveltePlugin from 'eslint-plugin-svelte'; import svelteParser from 'svelte-eslint-parser'; +import eslintConfigPrettier from 'eslint-config-prettier'; import {includeIgnoreFile} from '@eslint/compat'; import {fileURLToPath} from 'node:url'; @@ -39,7 +40,6 @@ const refinedGithubPlugin = { }; const gitignorePath = fileURLToPath(new URL('.gitignore', import.meta.url)); - export default [ includeIgnoreFile(gitignorePath, 'Imported .gitignore patterns'), ...xo.xoToEslintConfig([ @@ -316,6 +316,7 @@ export default [ location: 'readonly', }, }, + rules: eslintConfigPrettier.rules, }, { files: ['source/features/**'], diff --git a/package-lock.json b/package-lock.json index 1f8f20b5e5e3..9475512a27b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -75,7 +75,9 @@ "dprint": "^0.54.0", "dprint-plugin-graphql": "^0.2.3", "dprint-plugin-malva": "^0.15.3", + "dprint-plugin-markup": "^0.27.0", "eslint": "^9.39.2", + "eslint-config-prettier": "^10.1.8", "eslint-formatter-unix": "^9.0.1", "eslint-import-resolver-typescript": "^4.4.4", "eslint-plugin-import-x": "^4.16.1", @@ -87,8 +89,6 @@ "linkedom": "^0.18.12", "npm-run-all2": "^8.0.4", "p-memoize": "^8.0.0", - "prettier": "^3.8.1", - "prettier-plugin-svelte": "^3.4.1", "rollup": "^4.56.0", "rollup-plugin-cleanup": "^3.2.1", "rollup-plugin-copy": "^3.5.0", @@ -4229,6 +4229,13 @@ "dev": true, "license": "MIT" }, + "node_modules/dprint-plugin-markup": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/dprint-plugin-markup/-/dprint-plugin-markup-0.27.0.tgz", + "integrity": "sha512-scC2pesWfc4sAzeE+kPyO+h+pxHJUC1EBBS1oP8lu+AxUjhURm4svn76WinXH8VVyxXwdJaI238vgN8GG6P5Fw==", + "dev": true, + "license": "MIT" + }, "node_modules/electron-to-chromium": { "version": "1.5.278", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.278.tgz", @@ -8879,17 +8886,6 @@ "node": ">=6.0.0" } }, - "node_modules/prettier-plugin-svelte": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-3.4.1.tgz", - "integrity": "sha512-xL49LCloMoZRvSwa6IEdN2GV6cq2IqpYGstYtMT+5wmml1/dClEoI0MZR78MiVPpu6BdQFfN0/y73yO6+br5Pg==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "prettier": "^3.0.0", - "svelte": "^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0" - } - }, "node_modules/pretty-bytes": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-7.1.0.tgz", diff --git a/package.json b/package.json index c40e6b9d1433..fbb55e9381a3 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,10 @@ "build:typescript": "tsc --noEmit", "build:bundle": "rollup -c", "fix": "run-p \"lint:biome -- --write\" \"lint:js -- --fix\" format \"vitest -- --update\" --continue-on-error", - "format": "prettier . --write && dprint fmt", + "format": "dprint fmt", "lint": "run-p lint:* --continue-on-error", "lint:js": "eslint .", "lint:biome": "biome lint", - "lint:prettier": "prettier . --check", "lint:dprint": "dprint check", "new": "bash build/new-feature.sh", "pack:safari": "xcodebuild -project 'safari/Refined GitHub.xcodeproj' -scheme 'Refined GitHub' -destination 'platform=macOS'", @@ -22,21 +21,6 @@ "watch:typescript": "tsc --noEmit --watch --preserveWatchOutput", "watch:bundle": "rollup -c --watch" }, - "prettier": { - "bracketSpacing": false, - "plugins": [ - "prettier-plugin-svelte" - ], - "singleQuote": true, - "overrides": [ - { - "files": "*.svelte", - "options": { - "parser": "svelte" - } - } - ] - }, "dependencies": { "@fregante/mi-cron": "^2.0.1", "@sindresorhus/to-milliseconds": "^2.0.0", @@ -108,7 +92,9 @@ "dprint": "^0.54.0", "dprint-plugin-graphql": "^0.2.3", "dprint-plugin-malva": "^0.15.3", + "dprint-plugin-markup": "^0.27.0", "eslint": "^9.39.2", + "eslint-config-prettier": "^10.1.8", "eslint-formatter-unix": "^9.0.1", "eslint-import-resolver-typescript": "^4.4.4", "eslint-plugin-import-x": "^4.16.1", @@ -120,8 +106,6 @@ "linkedom": "^0.18.12", "npm-run-all2": "^8.0.4", "p-memoize": "^8.0.0", - "prettier": "^3.8.1", - "prettier-plugin-svelte": "^3.4.1", "rollup": "^4.56.0", "rollup-plugin-cleanup": "^3.2.1", "rollup-plugin-copy": "^3.5.0", diff --git a/source/options/header.svelte b/source/options/header.svelte index 81f7649beaa2..cf978ab06a54 100644 --- a/source/options/header.svelte +++ b/source/options/header.svelte @@ -7,7 +7,7 @@ }} /> - + - {available < 100_000 + { + available < 100_000 ? `Only ${prettyBytes(available)} available` - : `${prettyBytes(used)} used`} + : `${prettyBytes(used)} used` + } diff --git a/source/options/version-info.svelte b/source/options/version-info.svelte index a1a73fc0dd2b..107f7d43a5bb 100644 --- a/source/options/version-info.svelte +++ b/source/options/version-info.svelte @@ -4,7 +4,7 @@ }} /> - +