From d3c3a928c3a2f9e961881b47ef0796e57ae8d429 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 13 Feb 2016 13:57:34 -0800 Subject: [PATCH] tools: remove obsolete lint rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are about to upgrade from ESlint 1 to ESLint 2. Remove lint rules that will not exist in ESLint 2. PR-URL: https://github.com/nodejs/node/pull/5214 Reviewed-By: Michaël Zasso Reviewed-By: jbergstroem - Johan Bergström Reviewed-By: James M Snell Reviewed-By: Roman Reiss Reviewed-By: Myles Borins --- .eslintrc | 16 +--------------- tools/eslint-rules/new-with-error.js | 5 ----- tools/eslint-rules/require-buffer.js | 19 +++++++++++-------- tools/eslint-rules/required-modules.js | 5 ----- 4 files changed, 12 insertions(+), 33 deletions(-) diff --git a/.eslintrc b/.eslintrc index 49f77d3545..a15348e702 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,18 +1,6 @@ env: node: true - -# enable ECMAScript features -ecmaFeatures: - arrowFunctions: true - binaryLiterals: true - blockBindings: true - classes: true - forOf: true - generators: true - objectLiteralShorthandMethods: true - objectLiteralShorthandProperties: true - octalLiterals: true - templateStrings: true + es6: true rules: # Possible Errors @@ -55,12 +43,10 @@ rules: no-trailing-spaces: 2 quotes: [2, "single", "avoid-escape"] semi: 2 - space-after-keywords: 2 space-before-blocks: [2, "always"] space-before-function-paren: [2, "never"] space-in-parens: [2, "never"] space-infix-ops: 2 - space-return-throw-case: 2 space-unary-ops: 2 # ECMAScript 6 diff --git a/tools/eslint-rules/new-with-error.js b/tools/eslint-rules/new-with-error.js index b0f550db2f..655f34bf08 100644 --- a/tools/eslint-rules/new-with-error.js +++ b/tools/eslint-rules/new-with-error.js @@ -24,11 +24,6 @@ module.exports = function(context) { module.exports.schema = { 'type': 'array', - 'items': [ - { - 'enum': [0, 1, 2] - } - ], 'additionalItems': { 'type': 'string' }, diff --git a/tools/eslint-rules/require-buffer.js b/tools/eslint-rules/require-buffer.js index 4fec765d7e..c9818cb758 100644 --- a/tools/eslint-rules/require-buffer.js +++ b/tools/eslint-rules/require-buffer.js @@ -1,16 +1,19 @@ 'use strict'; -const msg = 'Use const Buffer = require(\'buffer\').Buffer; ' + - 'at the beginning of this file'; - module.exports = function(context) { + function flagIt(reference) { + const msg = 'Use const Buffer = require(\'buffer\').Buffer; ' + + 'at the beginning of this file'; + context.report(reference.identifier, msg); + } + return { 'Program:exit': function() { - context.getScope().through.forEach(function(ref) { - if (ref.identifier.name === 'Buffer') { - context.report(ref.identifier, msg); - } - }); + const globalScope = context.getScope(); + const variable = globalScope.set.get('Buffer'); + if (variable) { + variable.references.forEach(flagIt); + } } }; }; diff --git a/tools/eslint-rules/required-modules.js b/tools/eslint-rules/required-modules.js index 94ef1e2ac0..3e4a8e8aad 100644 --- a/tools/eslint-rules/required-modules.js +++ b/tools/eslint-rules/required-modules.js @@ -92,11 +92,6 @@ module.exports = function(context) { module.exports.schema = { 'type': 'array', - 'items': [ - { - 'enum': [0, 1, 2] - } - ], 'additionalItems': { 'type': 'string' },