diff options
author | 2020-11-18 19:55:59 -0500 | |
---|---|---|
committer | 2020-11-18 18:55:59 -0600 | |
commit | a935456acab0c7bdc021829e18ce20230e18c752 (patch) | |
tree | e61eed13a433381ba223a4ca962e904c8740fc91 /source/github-helpers | |
parent | cab33f6f47c4eef0a3bc793f2004767f34b6abe9 (diff) | |
download | refined-github-a935456acab0c7bdc021829e18ce20230e18c752.tar.gz refined-github-a935456acab0c7bdc021829e18ce20230e18c752.tar.zst refined-github-a935456acab0c7bdc021829e18ce20230e18c752.zip |
Lint (#3723)20.11.19
Diffstat (limited to 'source/github-helpers')
-rw-r--r-- | source/github-helpers/api.ts | 4 | ||||
-rw-r--r-- | source/github-helpers/dom-formatters.ts | 5 | ||||
-rw-r--r-- | source/github-helpers/github-url.ts | 4 | ||||
-rw-r--r-- | source/github-helpers/group-buttons.tsx | 1 | ||||
-rw-r--r-- | source/github-helpers/index.ts | 5 | ||||
-rw-r--r-- | source/github-helpers/parse-backticks.tsx | 4 |
6 files changed, 11 insertions, 12 deletions
diff --git a/source/github-helpers/api.ts b/source/github-helpers/api.ts index 268d16d2..98b2ddf9 100644 --- a/source/github-helpers/api.ts +++ b/source/github-helpers/api.ts @@ -29,8 +29,8 @@ import mem from 'mem'; import * as pageDetect from 'github-url-detection'; import {JsonObject, AsyncReturnType} from 'type-fest'; -import optionsStorage from '../options-storage'; import {getRepo} from '.'; +import optionsStorage from '../options-storage'; interface JsonError { message: string; @@ -161,6 +161,8 @@ export const v4 = mem(async ( throw new TypeError('`query` should only be what’s inside \'query {...}\', like \'user(login: "foo") { name }\', but is \n' + query); } + query = query.replace('repository() {', () => `repository(owner: "${getRepo()!.owner}", name: "${getRepo()!.name}") {`); + const response = await fetch(api4, { headers: { 'User-Agent': 'Refined GitHub', diff --git a/source/github-helpers/dom-formatters.ts b/source/github-helpers/dom-formatters.ts index 8602b61e..1ae93211 100644 --- a/source/github-helpers/dom-formatters.ts +++ b/source/github-helpers/dom-formatters.ts @@ -14,7 +14,10 @@ export const linkifiedURLClass = 'rgh-linkified-code'; // https://github.com/sindresorhus/refined-github/issues/1305 const currentRepo = getRepo()!; -export function linkifyIssues(element: Element, options: Partial<linkifyIssuesCore.TypeDomOptions> = {}): void { +export function linkifyIssues( + element: Element, + options: Partial<linkifyIssuesCore.TypeDomOptions> = {} +): void { const linkified = linkifyIssuesCore(element.textContent!, { user: currentRepo.owner ?? '/', repository: currentRepo.name ?? '/', diff --git a/source/github-helpers/github-url.ts b/source/github-helpers/github-url.ts index 785a86c5..371b160d 100644 --- a/source/github-helpers/github-url.ts +++ b/source/github-helpers/github-url.ts @@ -33,7 +33,9 @@ export default class GitHubURL { return this; } - private disambiguateReference(ambiguousReference: string[]): {branch: string; filePath: string} { + private disambiguateReference( + ambiguousReference: string[] + ): {branch: string; filePath: string} { const branch = ambiguousReference[0]; // History pages might use search parameters const filePathFromSearch = this.searchParams.getAll('path[]').join('/'); diff --git a/source/github-helpers/group-buttons.tsx b/source/github-helpers/group-buttons.tsx index 0a0bc44d..03b23cef 100644 --- a/source/github-helpers/group-buttons.tsx +++ b/source/github-helpers/group-buttons.tsx @@ -43,4 +43,3 @@ export const groupSiblings = (button: Element): Element => { return groupButtons(siblings); }; - diff --git a/source/github-helpers/index.ts b/source/github-helpers/index.ts index 5b08dc55..b57f1fd4 100644 --- a/source/github-helpers/index.ts +++ b/source/github-helpers/index.ts @@ -51,11 +51,6 @@ export const buildRepoURL = (...pathParts: Array<string | number> & {0: string}) return [location.origin, getRepo()?.nameWithOwner, ...pathParts].join('/'); }; -export const getRepoGQL = (): string => { - const {owner, name} = getRepo()!; - return `owner: "${owner}", name: "${name}"`; -}; - export const getPRHeadRepo = (): ReturnType<typeof getRepo> => { return getRepo(select<HTMLAnchorElement>('.commit-ref.head-ref a')!); }; diff --git a/source/github-helpers/parse-backticks.tsx b/source/github-helpers/parse-backticks.tsx index a7a96723..6ec0b21b 100644 --- a/source/github-helpers/parse-backticks.tsx +++ b/source/github-helpers/parse-backticks.tsx @@ -14,9 +14,7 @@ export default function parseBackticks(description: string): DocumentFragment { // `span.sr-only` keeps the backticks copy-pastable but invisible fragment.append( <span className="sr-only">`</span>, - <code className="rgh-parse-backticks"> - {text.trim()} - </code>, + <code className="rgh-parse-backticks">{text.trim()}</code>, <span className="sr-only">`</span> ); } else if (text.length > 0) { |