mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
lint: change require-buffer rule message
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
58f61dbf8e
commit
e0c7d783e0
1 file changed
+4
-4
@@ -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,
|
||||
@@ -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`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user