summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package-lock.json6
-rw-r--r--package.json2
-rw-r--r--source/features/faster-pr-diff-options.tsx2
-rw-r--r--source/features/highlight-closing-prs-in-open-issues.tsx2
-rw-r--r--source/libs/features.tsx5
-rw-r--r--source/libs/get-default-branch.ts10
-rw-r--r--source/options.html5
-rw-r--r--source/options.tsx18
-rw-r--r--webpack.config.ts2
9 files changed, 19 insertions, 33 deletions
diff --git a/package-lock.json b/package-lock.json
index de7bfbae..edf90a53 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4726,9 +4726,9 @@
}
},
"dom-chef": {
- "version": "3.6.2",
- "resolved": "https://registry.npmjs.org/dom-chef/-/dom-chef-3.6.2.tgz",
- "integrity": "sha512-vT8IYkzIXDET7gplO+U4XCctBadIOX2SsVr4WSt6pUjrBOdVQGYWIVjArnhxbqA+6sHKgjXR31iNsRv+1Tk6uA==",
+ "version": "3.6.3",
+ "resolved": "https://registry.npmjs.org/dom-chef/-/dom-chef-3.6.3.tgz",
+ "integrity": "sha512-VQjKmjoMQEIsDWJLem4dJCiJBwBePM9iRKnKiG/pxMaadbupSRpRNW+wOp4nO0Q+J0EZYGHuL8RasX1llTBTYA==",
"requires": {
"arr-flatten": "^1.0.3",
"svg-tag-names": "^1.1.1"
diff --git a/package.json b/package.json
index 8eea0ece..5bd86dc3 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"debounce-fn": "^3.0.1",
"delay": "^4.3.0",
"delegate-it": "^1.1.0-7",
- "dom-chef": "^3.6.2",
+ "dom-chef": "^3.6.3",
"dom-loaded": "^2.0.0",
"doma": "^1.0.3",
"element-ready": "^4.1.1",
diff --git a/source/features/faster-pr-diff-options.tsx b/source/features/faster-pr-diff-options.tsx
index 10f87bc0..baf867f7 100644
--- a/source/features/faster-pr-diff-options.tsx
+++ b/source/features/faster-pr-diff-options.tsx
@@ -41,7 +41,7 @@ function createWhitespaceButton(): HTMLElement {
data-hotkey="d w"
className={`btn btn-sm btn-outline tooltipped tooltipped-s ${isHidingWhitespace ? 'bg-gray-light text-gray-light' : ''}`}
aria-label={`${isHidingWhitespace ? 'Show' : 'Hide'} whitespace in diffs`}>
- {isHidingWhitespace ? icons.check() : false} No Whitespace
+ {isHidingWhitespace && icons.check()} No Whitespace
</a>
);
}
diff --git a/source/features/highlight-closing-prs-in-open-issues.tsx b/source/features/highlight-closing-prs-in-open-issues.tsx
index 518d2a72..71ad1f3a 100644
--- a/source/features/highlight-closing-prs-in-open-issues.tsx
+++ b/source/features/highlight-closing-prs-in-open-issues.tsx
@@ -23,7 +23,7 @@ function add(): void {
className="btn btn-outline btn-sm border-blue rgh-closing-pr tooltipped tooltipped-se"
aria-label={infoBubble.getAttribute('aria-label')!}>
{isIssue ? icons.openPullRequest() : icons.commit()}
- {isIssue ? ' ' + reference.textContent! : ''}
+ {isIssue && ' ' + reference.textContent!}
</a>
</div>
);
diff --git a/source/libs/features.tsx b/source/libs/features.tsx
index a84c5b17..cc8f718f 100644
--- a/source/libs/features.tsx
+++ b/source/libs/features.tsx
@@ -64,10 +64,7 @@ onAjaxedPages(async () => {
await globalReady; // Match `add()`
await Promise.resolve(); // Kicks it to the next tick, after the other features have `run()`
- const ajaxContainer = select('#js-repo-pjax-container,#js-pjax-container');
- if (ajaxContainer) {
- ajaxContainer.append(<has-rgh/>);
- }
+ select('#js-repo-pjax-container, #js-pjax-container')?.append(<has-rgh/>);
});
let log: typeof console.log;
diff --git a/source/libs/get-default-branch.ts b/source/libs/get-default-branch.ts
index b056f0c6..11930d2a 100644
--- a/source/libs/get-default-branch.ts
+++ b/source/libs/get-default-branch.ts
@@ -16,14 +16,8 @@ function parseBranchFromDom(): string | undefined {
}
// We can find the name in the infobar, available in folder views
- const branchInfo = select('.branch-infobar');
- if (!branchInfo) {
- return;
- }
-
- // Parse the infobar
- const matches = branchInfoRegex.exec(branchInfo.textContent!.trim());
- return matches ? matches[1] : undefined;
+ const branchInfo = select('.branch-infobar')?.textContent?.trim();
+ return branchInfoRegex.exec(branchInfo!)?.[1];
}
async function fetchFromApi(): Promise<string> {
diff --git a/source/options.html b/source/options.html
index 3686e088..6e99ffb6 100644
--- a/source/options.html
+++ b/source/options.html
@@ -46,11 +46,6 @@
<div class="js-features"></div>
</div>
- <div class="js-minimized-users-container extended-options">
- <p>User list:</p>
- <textarea name="minimizedUsers" rows="2" spellcheck="false"></textarea>
- </div>
-
<hr>
<p>
diff --git a/source/options.tsx b/source/options.tsx
index 4002f62a..a18592a2 100644
--- a/source/options.tsx
+++ b/source/options.tsx
@@ -28,10 +28,6 @@ function buildFeatureCheckbox({name, description, screenshot, disabled}: Feature
// `undefined` disconnects it from the options
const key = disabled ? undefined : `feature:${name}`;
- const disabledText = disabled ?
- <small>{parseDescription(`(Disabled because of ${disabled}) `)}</small> :
- false;
-
return (
<div className={`feature feature--${disabled ? 'disabled' : 'enabled'}`} data-text={`${name} ${description}`.toLowerCase()}>
<input type="checkbox" name={key} id={name} disabled={Boolean(disabled)} />
@@ -39,14 +35,21 @@ function buildFeatureCheckbox({name, description, screenshot, disabled}: Feature
<label for={name}>
<span className="feature-name">{name}</span>
{' '}
- {disabledText}
+ {disabled && <small>{parseDescription(`(Disabled because of ${disabled}) `)}</small>}
<a href={`https://github.com/sindresorhus/refined-github/blob/master/source/features/${name}.tsx`}>
source
</a>
- {screenshot ? <>, <a href={screenshot}>screenshot</a></> : ''}
+ {screenshot && <>, <a href={screenshot}>screenshot</a></>}
<br/>
<p className="description">{parseDescription(description)}</p>
</label>
+ {
+ name === 'minimize-user-comments' &&
+ <div className="extended-options">
+ <p>User list:</p>
+ <textarea name="minimizedUsers" rows={2} spellCheck="false"/>
+ </div>
+ }
</div>
</div>
);
@@ -104,9 +107,6 @@ async function init(): Promise<void> {
select<HTMLAnchorElement>('#personal-token-link')!.host = dropdown.value;
});
}
-
- // Move minimized users input field below the respective feature checkbox
- select('[for="minimize-user-comments"]')!.after(select('.js-minimized-users-container')!);
}
init();
diff --git a/webpack.config.ts b/webpack.config.ts
index fd1597b9..1f61c99d 100644
--- a/webpack.config.ts
+++ b/webpack.config.ts
@@ -15,7 +15,7 @@ function parseFeatureDetails(name: string): FeatureInfo {
const feature: Partial<FeatureInfo> = {name};
for (const field of fields) {
- const [, value]: string[] | [] = new RegExp(`\n\t${field}: '([^\\n]+)'`).exec(content) || [];
+ const value = new RegExp(`\n\t${field}: '([^\\n]+)'`).exec(content)?.[1];
if (value) {
const validValue = value.trim().replace(/\\'/g, '’'); // Catch trailing spaces and incorrect apostrophes
if (value !== validValue) {