summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGus Caplan <me@gus.host>2018-02-04 13:38:18 -0600
committerGus Caplan <me@gus.host>2018-02-20 13:13:22 -0600
commit6934792eb34c75c16ac810951d0abadfe96238a9 (patch)
tree5f3f34eb259e15dba98c5419f228eafc27616f70 /tools
parent7514eb3cff9f333882db0a3173247df06c0257e5 (diff)
downloadandroid-node-v8-6934792eb34c75c16ac810951d0abadfe96238a9.tar.gz
android-node-v8-6934792eb34c75c16ac810951d0abadfe96238a9.tar.bz2
android-node-v8-6934792eb34c75c16ac810951d0abadfe96238a9.zip
lint: move eslint to new plugin system
PR-URL: https://github.com/nodejs/node/pull/18566 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/node_modules/eslint-plugin-node-core/index.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/node_modules/eslint-plugin-node-core/index.js b/tools/node_modules/eslint-plugin-node-core/index.js
new file mode 100644
index 0000000000..e27945688e
--- /dev/null
+++ b/tools/node_modules/eslint-plugin-node-core/index.js
@@ -0,0 +1,24 @@
+'use strict';
+
+const fs = require('fs');
+const path = require('path');
+
+let cache;
+module.exports = {
+ get rules() {
+ const RULES_DIR = module.exports.RULES_DIR;
+ if (!RULES_DIR)
+ return {};
+
+ if (!cache) {
+ cache = {};
+ const files = fs.readdirSync(RULES_DIR)
+ .filter(filename => filename.endsWith('.js'))
+ for (const file of files) {
+ const name = file.slice(0, -3);
+ cache[name] = require(path.resolve(RULES_DIR, file));
+ }
+ }
+ return cache;
+ },
+};