Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohannes Ewald <johannes.ewald@peerigon.com>2018-04-10 00:54:34 +0300
committerJohannes Ewald <johannes.ewald@peerigon.com>2018-04-10 00:54:34 +0300
commit13cb24e35f670343d9ea6959f544e1d30cf8ea12 (patch)
treeed1689d1d0a2021d0a16221d54d167e68f9af3cc /lib
parent9b77ed9a293c538ec3eb5160bcb933e012ce517f (diff)
Maintain column width when transforming consts
Diffstat (limited to 'lib')
-rw-r--r--lib/moduleEnv.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/moduleEnv.js b/lib/moduleEnv.js
index cbb76d9..688401e 100644
--- a/lib/moduleEnv.js
+++ b/lib/moduleEnv.js
@@ -111,17 +111,19 @@ function jsExtension(module, filename) {
var _compile = module._compile;
module._compile = function (content, filename) {
- const noConstAssignMessage = linter.verify(content, eslintOptions).find(isNoConstAssignMessage);
+ var noConstAssignMessage = linter.verify(content, eslintOptions).find(isNoConstAssignMessage);
+ var line;
+ var column;
if (noConstAssignMessage !== undefined) {
- const { line, column } = noConstAssignMessage;
-
+ line = noConstAssignMessage.line;
+ column = noConstAssignMessage.column;
throw new TypeError(`Assignment to constant variable at ${ filename }:${ line }:${ column }`);
}
_compile.call(
module,
- content.replace(matchConst, "$1let$2"), // replace const with let
+ content.replace(matchConst, "$1let $2"), // replace const with let, while maintaining the column width
filename
);
};