0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/tools/eslint-rules/require-buffer.js

17 lines
392 B
JavaScript
Raw Normal View History

'use strict';
const msg = 'Use const Buffer = require(\'buffer\').Buffer; ' +
'at the beginning of this file';
module.exports = function(context) {
return {
'Program:exit': function() {
context.getScope().through.forEach(function(ref) {
if (ref.identifier.name === 'Buffer') {
context.report(ref.identifier, msg);
}
});
}
};
};