obsidian-linter
obsidian-linter copied to clipboard
FR: Support exclude glob patterns for files
Is Your Feature Request Related to a Problem? Please Describe.
I would like to have the ability to exclude a given set of files.
As a practical example, in my case I use Excalidraw plugin so I do have some files ending with .excalidraw.md
and I want to exclude all of these files from the linting.
Describe the Solution You'd Like
Have an array of file path globs to exclude.
Please include an example where applicable:
In this case it'd be ["*.exclidraw.md"]
to exclude all these files.
Describe Alternatives You've Considered
There's the folder feature (which is for folders ofc, not files), and the one to exclude a file put writing it down in the frontmatter on each files to exclude, but I may not remember this all the time, when creating new excalidraw files etc... So it's far from ideal.
Additional Context
None. Thanks for the great tool!
This library may be worth considering for using for excluding files that match a specific pattern: https://github.com/axtgr/wildcard-match/tree/master
The only problem I can think of with doing this right now is the potential issue with having to check each file name against the regex that would be generated based on the globs. That could add up in terms of time it takes to lint a whole vault or folder.
Assuming that this could really be a bottleneck for some people with plenty of notes, maybe you could come up with a caching strategy that saves the regex or a hash of the regex and for each file by default look up into a table if we already have the result otherwise the first time for a file, run the regex and save the result so that next time it comes from the cache.
Might be a bit premature to jump on such optimizations but I know some people have thousands of files in their vault so maybe it's a good idea.
There is a ticket for caching right now, but I have not taken the time to tackle it yet. It would likely mitigate the issue.