mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
20 lines
485 B
JavaScript
20 lines
485 B
JavaScript
|
'use strict';
|
||
|
|
||
|
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() {
|
||
|
const globalScope = context.getScope();
|
||
|
const variable = globalScope.set.get('Buffer');
|
||
|
if (variable) {
|
||
|
variable.references.forEach(flagIt);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
};
|