I think files in node_modules/ should be suppressed in diffs, or at least the option for it should exist.
I recently added a module to package.json and ended up with 300 new files and 46k additions in node_modules/, and then made a pull request. That comparison took a while to load.
Related but not exactly the same: https://github.com/github/linguist/issues/137
That's something you would set in a .gitignore.
Why on earth would you want to commit your node_modules?
Here are 3 reasons why to put it in a .gitignore
Just put _node_modules_ in the main .gitignore
Yeah, that was my own first thought as well, but I'm not making that choice by myself for the project in question.
Choice based on: http://www.futurealoof.com/posts/nodemodules-in-git.html.
TL;DR: Node doesn't have a Gemfile.lock, so
could differ between deploys and developer machines.
As for your number 3: if it's vendor code, shouldn't it _not_ mess with linguist?
Hmm.. I understand.
You have a point there.
And yes it shouldn't mess with it but it always does (for me).
I've been looking for a solution for a while now to exclude specific files or folders from linguist.
Ah, what a pity. I'm guessing you haven't missed the discussion in #137?
As far as I can tell node_modules/ should be added permanently as a vendor folder though.
Is there any time you wouldn't make node_modules/? ignored. Seems like that could just be set in our in vendored file, and we'll always ignore site-wide.
Closing this issue since we're working on improving detection site-wide instead of just doing per-repo restrictions, but please feel free to open an PR for ignoring this directory.
node_modules/ is already listed in vendor.yml, so I'm assuming that already works.
I do not understand why you (GitHub) are so opposed to per-repo configuration.
@Frogging101, probably because it makes the parsing of the language data a lot more complex if each project can set its own world-view on these things?
Also Pods folder is excluded in vendor.yml, it doesn't work. It counts ruby as a language in my repo, and also it counts Pods in calculating line additions, shows Pods folder in diff window.
@milani Please open a new issue, it's not the same problem.
@tnm Re "Is there any time you wouldn't make node_modules ignored?" Here's a use case. When you do require("module-x") in Node.js it searches upwards from the file containing the statement until it finds a subdirectory named node_modules/module-x. So if I have a bunch of interdependent source-code-controlled modules in a single repository I can make them accessible to each other by simply putting them into a directory named node_modules. After git clone and npm install, our repo looks like this:
+1. I think a good solution would be to add a URL param like ?exclude="node_modules/*". This would match the interface for the existing ?w= param which toggles whitespace diffing.
Most helpful comment
+1. I think a good solution would be to add a URL param like
?exclude="node_modules/*". This would match the interface for the existing?w=param which toggles whitespace diffing.