Add eslint-plugin-rulesdir to node_modules

This plugin needs to be used to write our own custom ESLint plugins that
live in our repository. It replaces the `rulesdir` CLI option, as the
solution of putting it in `.eslintrc.js` is compatible with code editor
plugins.

I also discovered that we were incorrectly running clang-format on
`node_modules`, as I recently fixed the PRESUBMIT. To make sure that
doens't happen again, add a `.clang-format` that disables the formatting
in that folder.

DISABLE_THIRD_PARTY_CHECK=Add new node_module

Bug: 1060123
Change-Id: Ib2c0d23f499604deeea51cb06192bce3a7aa89af
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2096449
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
diff --git a/node_modules/eslint-plugin-rulesdir/.eslintrc.js b/node_modules/eslint-plugin-rulesdir/.eslintrc.js
new file mode 100644
index 0000000..b70f5cb
--- /dev/null
+++ b/node_modules/eslint-plugin-rulesdir/.eslintrc.js
@@ -0,0 +1,29 @@
+'use strict';
+
+const fs = require('fs');
+const path = require('path');
+const PACKAGE_NAME = require('./package').name;
+
+const SYMLINK_LOCATION = path.join(__dirname, 'node_modules', PACKAGE_NAME);
+
+// Symlink node_modules/{package name} to this directory
+// so that ESLint resolves this plugin name correctly.
+// (Yes, this plugin still has to hack node_modules to bootstrap itself.)
+if (!fs.existsSync(SYMLINK_LOCATION)) {
+  fs.symlinkSync(__dirname, SYMLINK_LOCATION);
+}
+
+require('.').RULES_DIR = path.resolve('tests');
+
+module.exports = {
+  extends: 'airbnb-base',
+  parserOptions: {
+    sourceType: 'script',
+  },
+  rules: {
+    'global-require': 'off',
+    'import/no-dynamic-require': 'off',
+    'rulesdir/fake-rule': 'error',
+  },
+  plugins: [PACKAGE_NAME],
+};