From 364482dd686fd85ca99170aefd62490748f2f6be Mon Sep 17 00:00:00 2001 From: David Majda Date: Fri, 7 Oct 2016 20:44:26 +0200 Subject: [PATCH] Code style: Fix ESLint "no-prototype-builtins" errors Part of #407. --- lib/compiler/index.js | 2 +- lib/compiler/passes/report-duplicate-labels.js | 2 +- lib/compiler/passes/report-duplicate-rules.js | 2 +- lib/compiler/visitor.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/compiler/index.js b/lib/compiler/index.js index c1f383a..432110b 100644 --- a/lib/compiler/index.js +++ b/lib/compiler/index.js @@ -8,7 +8,7 @@ function processOptions(options, defaults) { }); Object.keys(defaults).forEach(name => { - if (!processedOptions.hasOwnProperty(name)) { + if (!Object.prototype.hasOwnProperty.call(processedOptions, name)) { processedOptions[name] = defaults[name]; } }); diff --git a/lib/compiler/passes/report-duplicate-labels.js b/lib/compiler/passes/report-duplicate-labels.js index 1c83e56..7e15be6 100644 --- a/lib/compiler/passes/report-duplicate-labels.js +++ b/lib/compiler/passes/report-duplicate-labels.js @@ -33,7 +33,7 @@ function reportDuplicateLabels(ast) { action: checkExpressionWithClonedEnv, labeled(node, env) { - if (env.hasOwnProperty(node.label)) { + if (Object.prototype.hasOwnProperty.call(env, node.label)) { throw new GrammarError( "Label \"" + node.label + "\" is already defined " + "at line " + env[node.label].start.line + ", " diff --git a/lib/compiler/passes/report-duplicate-rules.js b/lib/compiler/passes/report-duplicate-rules.js index 72c3e9b..ba318bb 100644 --- a/lib/compiler/passes/report-duplicate-rules.js +++ b/lib/compiler/passes/report-duplicate-rules.js @@ -9,7 +9,7 @@ function reportDuplicateRules(ast) { let check = visitor.build({ rule(node) { - if (rules.hasOwnProperty(node.name)) { + if (Object.prototype.hasOwnProperty.call(rules, node.name)) { throw new GrammarError( "Rule \"" + node.name + "\" is already defined " + "at line " + rules[node.name].start.line + ", " diff --git a/lib/compiler/visitor.js b/lib/compiler/visitor.js index 54446e6..9bb9532 100644 --- a/lib/compiler/visitor.js +++ b/lib/compiler/visitor.js @@ -61,7 +61,7 @@ let visitor = { }; Object.keys(DEFAULT_FUNCTIONS).forEach(type => { - if (!functions.hasOwnProperty(type)) { + if (!Object.prototype.hasOwnProperty.call(functions, type)) { functions[type] = DEFAULT_FUNCTIONS[type]; } });