Skip to content

Commit 9a3eb07

Browse files
Copilotfregante
andcommitted
Add xo.config.js and apply formatting fixes for xo v1.x compatibility
Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
1 parent 782d4e5 commit 9a3eb07

3 files changed

Lines changed: 25 additions & 16 deletions

File tree

index.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -317,19 +317,15 @@ export function applyToLink(a, currentUrl) {
317317
) {
318318
const url = a.textContent;
319319
const shortened = shortenRepoUrl(url, currentUrl);
320-
a.replaceChildren(
321-
...shortened.split(
322-
/<code>([^<]+)<\/code>/g,
323-
).map((part, i) => {
324-
if (i % 2 === 0) {
325-
return part;
326-
}
327-
328-
const codeElement = document.createElement('code');
329-
codeElement.textContent = part;
330-
return codeElement;
331-
}),
332-
);
320+
a.replaceChildren(...shortened.split(/<code>([^<]+)<\/code>/g).map((part, i) => {
321+
if (i % 2 === 0) {
322+
return part;
323+
}
324+
325+
const codeElement = document.createElement('code');
326+
codeElement.textContent = part;
327+
return codeElement;
328+
}));
333329
return true;
334330
}
335331

index.test-d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import {expectType} from 'tsd';
22
import {applyToLink} from './index.js';
33

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

xo.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/** @type {import('xo').FlatXoConfig} */
2+
export default [
3+
{
4+
languageOptions: {
5+
globals: {
6+
document: 'readonly',
7+
},
8+
},
9+
rules: {
10+
'unicorn/better-regex': 'off',
11+
'unicorn/prefer-module': 'off',
12+
complexity: 'off',
13+
},
14+
},
15+
];

0 commit comments

Comments
 (0)