diff options
author | Rich Trott <rtrott@gmail.com> | 2019-02-01 11:44:36 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-02-03 16:46:26 -0800 |
commit | 7540f9dbe8114c62e0ec7d751bf2a36998514b2c (patch) | |
tree | 1fe235430de7fd84606affb77b6fb68bf516915a /tools/node_modules/eslint/lib/rules.js | |
parent | b322b76dad5b05e20586622cdc86c83367e863e1 (diff) | |
download | android-node-v8-7540f9dbe8114c62e0ec7d751bf2a36998514b2c.tar.gz android-node-v8-7540f9dbe8114c62e0ec7d751bf2a36998514b2c.tar.bz2 android-node-v8-7540f9dbe8114c62e0ec7d751bf2a36998514b2c.zip |
tools: update ESLint to 5.13.0
PR-URL: https://github.com/nodejs/node/pull/25877
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Diffstat (limited to 'tools/node_modules/eslint/lib/rules.js')
-rw-r--r-- | tools/node_modules/eslint/lib/rules.js | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/tools/node_modules/eslint/lib/rules.js b/tools/node_modules/eslint/lib/rules.js index ee747311e7..d0f9095141 100644 --- a/tools/node_modules/eslint/lib/rules.js +++ b/tools/node_modules/eslint/lib/rules.js @@ -10,7 +10,6 @@ //------------------------------------------------------------------------------ const lodash = require("lodash"); -const loadRules = require("./load-rules"); const ruleReplacements = require("../conf/replacements").rules; const builtInRules = require("./built-in-rules-index"); @@ -60,7 +59,9 @@ function normalizeRule(rule) { class Rules { constructor() { this._rules = Object.create(null); - this.defineAll(builtInRules); + Object.keys(builtInRules).forEach(ruleId => { + this.define(ruleId, builtInRules[ruleId]); + }); } /** @@ -74,46 +75,6 @@ class Rules { } /** - * Loads and registers all rules from passed rules directory. - * @param {string} [rulesDir] Path to rules directory, may be relative. Defaults to `lib/rules`. - * @param {string} cwd Current working directory - * @returns {void} - */ - load(rulesDir, cwd) { - const newRules = loadRules(rulesDir, cwd); - - this.defineAll(newRules); - } - - /** - * Pulls a Map of new rules to the defined ones of this instance. - * @param {Object} newRules Expects to have an object here that maps the rule ID to the rule definition. - * @returns {void} - */ - defineAll(newRules) { - Object.keys(newRules).forEach(ruleId => { - this.define(ruleId, newRules[ruleId]); - }); - } - - /** - * Registers all given rules of a plugin. - * @param {Object} plugin The plugin object to import. - * @param {string} pluginName The name of the plugin without prefix (`eslint-plugin-`). - * @returns {void} - */ - importPlugin(plugin, pluginName) { - if (plugin.rules) { - Object.keys(plugin.rules).forEach(ruleId => { - const qualifiedRuleId = `${pluginName}/${ruleId}`, - rule = plugin.rules[ruleId]; - - this.define(qualifiedRuleId, rule); - }); - } - } - - /** * Access rule handler by id (file name). * @param {string} ruleId Rule id (file name). * @returns {{create: Function, schema: JsonSchema[]}} |