Skip to content

Commit 47ccf5c

Browse files
committed
Lint
1 parent 1ae0edf commit 47ccf5c

File tree

4 files changed

+127
-120
lines changed

4 files changed

+127
-120
lines changed

index.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function shortenURL(href, currentUrl = 'https://github.com') {
4545
pathname,
4646
search,
4747
searchParams,
48-
hash
48+
hash,
4949
} = url;
5050

5151
const pathnameParts = pathname.slice(1).split('/'); // ['user', 'repo', 'pull', '342']
@@ -54,7 +54,7 @@ function shortenURL(href, currentUrl = 'https://github.com') {
5454
const isRaw = [
5555
'https://raw.githubusercontent.com',
5656
'https://cdn.rawgit.com',
57-
'https://rawgit.com'
57+
'https://rawgit.com',
5858
].includes(origin);
5959

6060
let [
@@ -96,7 +96,7 @@ function shortenURL(href, currentUrl = 'https://github.com') {
9696
'tree',
9797
'blob',
9898
'blame',
99-
'commits'
99+
'commits',
100100
].includes(type);
101101

102102
const repoUrl = isThisRepo ? '' : `${user}/${repo}`;
@@ -117,7 +117,10 @@ function shortenURL(href, currentUrl = 'https://github.com') {
117117
}
118118

119119
if (isFileOrDir) {
120-
const revisioned = joinValues([joinValues([repoUrl, revision], '@'), filePath], '/');
120+
const revisioned = joinValues(
121+
[joinValues([repoUrl, revision], '@'), filePath],
122+
'/',
123+
);
121124
const partial = `${revisioned}${search}${hash}`;
122125
if (type !== 'blob' && type !== 'tree') {
123126
return `${partial} (${type})`;
@@ -147,7 +150,10 @@ function shortenURL(href, currentUrl = 'https://github.com') {
147150
}
148151

149152
if (label) {
150-
return joinValues([repoUrl, decodeURIComponent(label)]) + `${search}${hash} (label)`;
153+
return (
154+
joinValues([repoUrl, decodeURIComponent(label)])
155+
+ `${search}${hash} (label)`
156+
);
151157
}
152158

153159
if (isDependents) {
@@ -187,7 +193,10 @@ function applyToLink(a, currentUrl) {
187193
// Shorten only if the link name hasn't been customized.
188194
// .href automatically adds a / to naked origins so that needs to be tested too
189195
// `trim` makes it compatible with this feature: https://github.com/sindresorhus/refined-github/pull/3085
190-
if ((a.href === a.textContent.trim() || a.href === `${a.textContent}/`) && !a.firstElementChild) {
196+
if (
197+
(a.href === a.textContent.trim() || a.href === `${a.textContent}/`)
198+
&& !a.firstElementChild
199+
) {
191200
const shortened = shortenURL(a.href, currentUrl);
192201
a.innerHTML = shortened;
193202
return true;

index.test-d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
/// <reference lib="dom" />
2-
31
import {expectType} from 'tsd';
42
import {applyToLink} from './index.js';
53

64
expectType<void>(
7-
applyToLink(document.createElement('a'), 'https://bettersite.com')
5+
applyToLink(document.createElement('a'), 'https://bettersite.com'),
86
);

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@
2727
},
2828
"xo": {
2929
"rules": {
30-
"@typescript-eslint/no-confusing-void-expression": "off",
3130
"unicorn/better-regex": "off",
31+
"unicorn/prefer-module": "off",
3232
"complexity": "off"
3333
}
3434
},
3535
"dependencies": {
3636
"github-reserved-names": "^2.0.4"
3737
},
3838
"devDependencies": {
39-
"@sindresorhus/tsconfig": "^0.8.0",
39+
"@sindresorhus/tsconfig": "^1.0.2",
4040
"ava": "^3.15.0",
41-
"tsd": "^0.14.0",
42-
"xo": "^0.37.1"
41+
"tsd": "^0.17.0",
42+
"xo": "^0.44.0"
4343
},
4444
"engines": {
4545
"node": ">=10.0.0"

0 commit comments

Comments
 (0)