File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 11import fs from 'node:fs/promises'
2+ import path from 'node:path'
23
34import {
45 PluginDriver ,
@@ -21,8 +22,16 @@ export const checkDeadLinks = lintRule<Root>(
2122 'doom-lint:check-dead-links' ,
2223 async ( tree , vfile ) => {
2324 if ( ! config || ! configFilePath ) {
24- const { root, globalOptions } = JSON . parse (
25- await fs . readFile ( OPTIONS_FILE , 'utf8' ) ,
25+ let optionsText : string | undefined
26+
27+ try {
28+ optionsText = await fs . readFile ( OPTIONS_FILE , 'utf8' )
29+ } catch {
30+ //
31+ }
32+
33+ const { root, globalOptions } = (
34+ optionsText ? JSON . parse ( optionsText ) : { }
2635 ) as {
2736 root ?: string
2837 globalOptions : GlobalCliOptions
@@ -31,6 +40,13 @@ export const checkDeadLinks = lintRule<Root>(
3140 ; ( { config, configFilePath } = await loadConfig ( root , globalOptions ) )
3241 }
3342
43+ const relativePath = path . relative ( config . root ! , vfile . path )
44+
45+ // Ignore files outside the root directory
46+ if ( relativePath . startsWith ( '..' ) ) {
47+ return
48+ }
49+
3450 let routeService = RouteService . getInstance ( )
3551
3652 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
You can’t perform that action at this time.
0 commit comments