• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3module.exports = function(context) {
4  function flagIt(reference) {
5    const msg = 'Use const Buffer = require(\'buffer\').Buffer; ' +
6                'at the beginning of this file';
7    context.report(reference.identifier, msg);
8  }
9
10  return {
11    'Program:exit': function() {
12      const globalScope = context.getScope();
13      const variable = globalScope.set.get('Buffer');
14      if (variable) {
15        variable.references.forEach(flagIt);
16      }
17    }
18  };
19};
20