Skip to content

checkIsInNodeModules

Checks whether a path sits inside a node_modules folder at any depth.

Matches on a full path SEGMENT rather than a substring, so a file whose own name merely contains the word (node_modules-migration.md) is not swept up with it.

Import:

import { checkIsInNodeModules } from 'obsidian-dev-utils/script-utils/linters/markdownlint-ignores';

Signature:

function checkIsInNodeModules(path: string): boolean

Parameters:

ParameterTypeDescription
pathstringA path relative to the repository root, separated by / (the form git ls-files emits).

Returns: booleantrue when the path is inside a node_modules folder.