enable prefer const (#5113)

This commit is contained in:
Henry Zhu
2017-01-14 09:48:52 -05:00
committed by GitHub
parent 982850731e
commit 672adba9a1
177 changed files with 1862 additions and 1863 deletions

View File

@@ -12,7 +12,7 @@ sourceMapSupport.install({
handleUncaughtExceptions: false,
environment : "node",
retrieveSourceMap(source) {
let map = maps && maps[source];
const map = maps && maps[source];
if (map) {
return {
url: null,
@@ -27,15 +27,15 @@ sourceMapSupport.install({
registerCache.load();
let cache = registerCache.get();
let transformOpts = {};
const transformOpts = {};
let ignore;
let only;
let oldHandlers = {};
let maps = {};
const maps = {};
let cwd = process.cwd();
const cwd = process.cwd();
function getRelativePath(filename) {
return path.relative(cwd, filename);
@@ -49,7 +49,7 @@ function compile(filename) {
let result;
// merge in base options and resolve all the plugins and presets relative to this file
let opts = new OptionManager().init(extend(
const opts = new OptionManager().init(extend(
{ sourceRoot: path.dirname(filename) }, // sourceRoot can be overwritten
deepClone(transformOpts),
{ filename }
@@ -57,11 +57,11 @@ function compile(filename) {
let cacheKey = `${JSON.stringify(opts)}:${babel.version}`;
let env = process.env.BABEL_ENV || process.env.NODE_ENV;
const env = process.env.BABEL_ENV || process.env.NODE_ENV;
if (env) cacheKey += `:${env}`;
if (cache) {
let cached = cache[cacheKey];
const cached = cache[cacheKey];
if (cached && cached.mtime === mtime(filename)) {
result = cached;
}
@@ -100,7 +100,7 @@ function loader(m, filename) {
}
function registerExtension(ext) {
let old = oldHandlers[ext] || oldHandlers[".js"] || require.extensions[".js"];
const old = oldHandlers[ext] || oldHandlers[".js"] || require.extensions[".js"];
require.extensions[ext] = function (m, filename) {
if (shouldIgnore(filename)) {