tools: remove obsolete lint rules
authorRich Trott <rtrott@gmail.com>
Sat, 13 Feb 2016 21:57:34 +0000 (13:57 -0800)
committerMyles Borins <mborins@us.ibm.com>
Wed, 2 Mar 2016 22:01:11 +0000 (14:01 -0800)
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 <mic.besace@gmail.com>
Reviewed-By: jbergstroem - Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
.eslintrc
tools/eslint-rules/new-with-error.js
tools/eslint-rules/require-buffer.js
tools/eslint-rules/required-modules.js

index 49f77d3..a15348e 100644 (file)
--- 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
index b0f550d..655f34b 100644 (file)
@@ -24,11 +24,6 @@ module.exports = function(context) {
 
 module.exports.schema = {
   'type': 'array',
-  'items': [
-    {
-      'enum': [0, 1, 2]
-    }
-  ],
   'additionalItems': {
     'type': 'string'
   },
index 4fec765..c9818cb 100644 (file)
@@ -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);
+      }
     }
   };
 };
index 94ef1e2..3e4a8e8 100644 (file)
@@ -92,11 +92,6 @@ module.exports = function(context) {
 
 module.exports.schema = {
   'type': 'array',
-  'items': [
-    {
-      'enum': [0, 1, 2]
-    }
-  ],
   'additionalItems': {
     'type': 'string'
   },