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
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
'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);
+ }
}
};
};