From 6934792eb34c75c16ac810951d0abadfe96238a9 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Sun, 4 Feb 2018 13:38:18 -0600 Subject: lint: move eslint to new plugin system PR-URL: https://github.com/nodejs/node/pull/18566 Reviewed-By: Joyee Cheung Reviewed-By: Roman Reiss --- .../node_modules/eslint-plugin-node-core/index.js | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tools/node_modules/eslint-plugin-node-core/index.js (limited to 'tools') 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; + }, +}; -- cgit v1.2.3