Skip to content

Commit

Permalink
lint: change require-buffer rule message
Browse files Browse the repository at this point in the history
PR-URL: #19701
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
devsnek authored and targos committed Apr 3, 2018
1 parent 58f61db commit e0c7d78
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/eslint-rules/require-buffer.js
@@ -1,11 +1,10 @@
'use strict';
const BUFFER_REQUIRE = 'const { Buffer } = require(\'buffer\');\n';
const BUFFER_REQUIRE = 'const { Buffer } = require(\'buffer\');';

module.exports = function(context) {

function flagIt(reference) {
const msg = 'Use const Buffer = require(\'buffer\').Buffer; ' +
'at the beginning of this file';
const msg = `Use ${BUFFER_REQUIRE} at the beginning of this file`;

context.report({
node: reference.identifier,
Expand All @@ -18,7 +17,8 @@ module.exports = function(context) {
const firstLOC = sourceCode.ast.range[0];
const rangeNeedle = hasUseStrict ? useStrict.lastIndex : firstLOC;

return fixer.insertTextBeforeRange([rangeNeedle], BUFFER_REQUIRE);
return fixer.insertTextBeforeRange([rangeNeedle],
`${BUFFER_REQUIRE}\n`);
}
});
}
Expand Down

0 comments on commit e0c7d78

Please sign in to comment.