Summary (TL;DR):
I want to disable Emacs from processing and/or applying any file-local variables, no matter what. However, I still want Emacs to process and apply directory-local variables specified in a .dir-locals.el file (if it exists for any given scenario). Are there any settings or configurations for that would accomplish such a goal? Are there perhaps any alternatives (packages, approaches, etc.) that would be even better suited than relying on Emacs' built-in functionality for configuring Emacs dynamically with/for specific variables/etc. with project specific details only when in any given project?
Details:
I did some research before asking. There were 3 settings that appeared like they could help but they actually don't since they are much broader in scope and either completely enable or disable any type of local variable.
enable-local-variables
enable-local-eval
local-enable-local-variables
Setting them to nil disabled both file-local variables and directory-local variables, unfortunately not what I need. I reviewed the files.el source and it seems this is intentional by design (or at least how they are supposed to work). It also appears local-enable-local-variables is only for an extremely niche obsolete edge-case.
Looking around in files.el, I had the idea of just always forcing file-local-variables-alist to be nil or empty through either various overrides/advice'ing various functions (e.g. hack-local-variables-apply). It's a sort of ugly hack (no pun intended) for sure but seems like it would work.
However, I wondered if there was a better way to achieve the same goal or perhaps an entirely different alternative (i.e. some kind of a package that is better suited than either file-local or directory-local variables entirely)?
Why might I want this?
Well, ignoring that such questions are completely antithetical to Emacs, it's really quite straightforward. All of my projects usually have a .dir-locals.el file in them to configure project specific settings, methods, etc. within Emacs with the particular information only available in that project.
However, from time to time, I visit other files from various repositories, projects, etc. (incl. Emacs' source code). Sometimes people have put file-local variables in those files which are really just an annoying nuisance when I want to explore around the file or what have you.
I then have to make sure they don't do anything I don't want as well as make sure my original settings and any .dir-locals.el changes are correctly re-applied afterward. It's not a huge deal but just frustrating enough that it causes just enough friction that I want to finally fix it.