diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index a7a1c15e90b3fb..81a764f0f85b81 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -1,5 +1,6 @@ rules: prefer-object-spread: error + no-buffer-constructor: error no-restricted-syntax: # Config copied from .eslintrc.js - error @@ -26,7 +27,6 @@ rules: message: "Use an error exported by the internal/errors module." # Custom rules in tools/eslint-rules node-core/require-globals: error - node-core/buffer-constructor: error node-core/no-let-in-for-declaration: error node-core/lowercase-name-for-primitive: error node-core/non-ascii-character: error diff --git a/test/parallel/test-eslint-buffer-constructor.js b/test/parallel/test-eslint-buffer-constructor.js deleted file mode 100644 index daa1a527673c1a..00000000000000 --- a/test/parallel/test-eslint-buffer-constructor.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -const common = require('../common'); -common.skipIfEslintMissing(); - -const RuleTester = require('../../tools/node_modules/eslint').RuleTester; -const rule = require('../../tools/eslint-rules/buffer-constructor'); - -const message = 'Use of the Buffer() constructor has been deprecated. ' + - 'Please use either Buffer.alloc(), Buffer.allocUnsafe(), ' + - 'or Buffer.from()'; - -new RuleTester().run('buffer-constructor', rule, { - valid: [ - 'Buffer.from(foo)' - ], - invalid: [ - { - code: 'Buffer(foo)', - errors: [{ message }] - }, - { - code: 'new Buffer(foo)', - errors: [{ message }] - } - ] -}); diff --git a/test/root.status b/test/root.status index 9c40512cb68051..e5dd389cae0424 100644 --- a/test/root.status +++ b/test/root.status @@ -31,7 +31,6 @@ parallel/test-domain-with-abort-on-uncaught-exception: SLOW parallel/test-env-var-no-warnings: SLOW parallel/test-error-reporting: SLOW parallel/test-eslint-alphabetize-errors: SLOW -parallel/test-eslint-buffer-constructor: SLOW parallel/test-eslint-crypto-check: SLOW parallel/test-eslint-documented-errors: SLOW parallel/test-eslint-duplicate-requires: SLOW diff --git a/tools/eslint-rules/buffer-constructor.js b/tools/eslint-rules/buffer-constructor.js deleted file mode 100644 index 412fdaa934664b..00000000000000 --- a/tools/eslint-rules/buffer-constructor.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @fileoverview Require use of new Buffer constructor methods in lib - * @author James M Snell - */ -'use strict'; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ -const msg = 'Use of the Buffer() constructor has been deprecated. ' + - 'Please use either Buffer.alloc(), Buffer.allocUnsafe(), ' + - 'or Buffer.from()'; -const astSelector = 'NewExpression[callee.name="Buffer"],' + - 'CallExpression[callee.name="Buffer"]'; - -module.exports = function(context) { - return { - [astSelector]: (node) => context.report(node, msg) - }; -};