( fileNames: string[], cwd = process.cwd(), )
| 102 | } |
| 103 | |
| 104 | export async function findNearestFile( |
| 105 | fileNames: string[], |
| 106 | cwd = process.cwd(), |
| 107 | ): Promise<string | undefined> { |
| 108 | // eslint-disable-next-line functional/no-loop-statements |
| 109 | for ( |
| 110 | // eslint-disable-next-line functional/no-let |
| 111 | let directory = cwd; |
| 112 | directory !== path.dirname(directory); |
| 113 | directory = path.dirname(directory) |
| 114 | ) { |
| 115 | // eslint-disable-next-line functional/no-loop-statements |
| 116 | for (const file of fileNames) { |
| 117 | if (await fileExists(path.join(directory, file))) { |
| 118 | return path.join(directory, file); |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | return undefined; |
| 123 | } |
| 124 | |
| 125 | export function findLineNumberInText( |
| 126 | content: string, |
no test coverage detected