Skip to content

Commit 02f3f46

Browse files
committed
fix: OPTIONS_FILE could be unavailable
1 parent 87b2347 commit 02f3f46

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import doom from '@alauda/doom/eslint'
1212

1313
export default config(
1414
{
15-
ignores: ['dist', '**/lib', '**/pyodide'],
15+
ignores: ['dist', 'fixture-docs', '**/lib', '**/pyodide'],
1616
},
1717
...(await doom(new URL('docs', import.meta.url))),
1818
eslint.configs.recommended,

packages/doom/src/remark-lint/check-dead-links.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@ export const checkDeadLinks = lintRule<Root>(
2121
'doom-lint:check-dead-links',
2222
async (tree, vfile) => {
2323
if (!config || !configFilePath) {
24-
const { root, globalOptions } = JSON.parse(
25-
await fs.readFile(OPTIONS_FILE, 'utf8'),
24+
let optionsText: string | undefined
25+
26+
try {
27+
optionsText = await fs.readFile(OPTIONS_FILE, 'utf8')
28+
} catch {
29+
//
30+
}
31+
32+
const { root, globalOptions } = (
33+
optionsText ? JSON.parse(optionsText) : { globalOptions: {} }
2634
) as {
2735
root?: string
2836
globalOptions: GlobalCliOptions

0 commit comments

Comments
 (0)