Upgrade prettier to v2
Prettier v2 has the following breaking changes: * enforces spaces between `function` and params * enforces trailing commas by default
This commit is contained in:
committed by
Jay Linski
parent
f6ff3bf52b
commit
e534a911f3
+15
-15
@@ -4,13 +4,13 @@ import {
|
||||
COMPILER_REVISION,
|
||||
createFrame,
|
||||
LAST_COMPATIBLE_COMPILER_REVISION,
|
||||
REVISION_CHANGES
|
||||
REVISION_CHANGES,
|
||||
} from './base';
|
||||
import { moveHelperToHooks } from './helpers';
|
||||
import { wrapHelper } from './internal/wrapHelper';
|
||||
import {
|
||||
createProtoAccessControl,
|
||||
resultIsAllowed
|
||||
resultIsAllowed,
|
||||
} from './internal/proto-access';
|
||||
|
||||
export function checkRevision(compilerInfo) {
|
||||
@@ -73,7 +73,7 @@ export function template(templateSpec, env) {
|
||||
|
||||
let extendedOptions = Utils.extend({}, options, {
|
||||
hooks: this.hooks,
|
||||
protoAccessControl: this.protoAccessControl
|
||||
protoAccessControl: this.protoAccessControl,
|
||||
});
|
||||
|
||||
let result = env.VM.invokePartial.call(
|
||||
@@ -115,15 +115,15 @@ export function template(templateSpec, env) {
|
||||
|
||||
// Just add water
|
||||
let container = {
|
||||
strict: function(obj, name, loc) {
|
||||
strict: function (obj, name, loc) {
|
||||
if (!obj || !(name in obj)) {
|
||||
throw new Exception('"' + name + '" not defined in ' + obj, {
|
||||
loc: loc
|
||||
loc: loc,
|
||||
});
|
||||
}
|
||||
return container.lookupProperty(obj, name);
|
||||
},
|
||||
lookupProperty: function(parent, propertyName) {
|
||||
lookupProperty: function (parent, propertyName) {
|
||||
let result = parent[propertyName];
|
||||
if (result == null) {
|
||||
return result;
|
||||
@@ -137,7 +137,7 @@ export function template(templateSpec, env) {
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
lookup: function(depths, name) {
|
||||
lookup: function (depths, name) {
|
||||
const len = depths.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
let result = depths[i] && container.lookupProperty(depths[i], name);
|
||||
@@ -146,21 +146,21 @@ export function template(templateSpec, env) {
|
||||
}
|
||||
}
|
||||
},
|
||||
lambda: function(current, context) {
|
||||
lambda: function (current, context) {
|
||||
return typeof current === 'function' ? current.call(context) : current;
|
||||
},
|
||||
|
||||
escapeExpression: Utils.escapeExpression,
|
||||
invokePartial: invokePartialWrapper,
|
||||
|
||||
fn: function(i) {
|
||||
fn: function (i) {
|
||||
let ret = templateSpec[i];
|
||||
ret.decorator = templateSpec[i + '_d'];
|
||||
return ret;
|
||||
},
|
||||
|
||||
programs: [],
|
||||
program: function(i, data, declaredBlockParams, blockParams, depths) {
|
||||
program: function (i, data, declaredBlockParams, blockParams, depths) {
|
||||
let programWrapper = this.programs[i],
|
||||
fn = this.fn(i);
|
||||
if (data || depths || blockParams || declaredBlockParams) {
|
||||
@@ -179,13 +179,13 @@ export function template(templateSpec, env) {
|
||||
return programWrapper;
|
||||
},
|
||||
|
||||
data: function(value, depth) {
|
||||
data: function (value, depth) {
|
||||
while (value && depth--) {
|
||||
value = value._parent;
|
||||
}
|
||||
return value;
|
||||
},
|
||||
mergeIfNeeded: function(param, common) {
|
||||
mergeIfNeeded: function (param, common) {
|
||||
let obj = param || common;
|
||||
|
||||
if (param && common && param !== common) {
|
||||
@@ -198,7 +198,7 @@ export function template(templateSpec, env) {
|
||||
nullContext: Object.seal({}),
|
||||
|
||||
noop: env.VM.noop,
|
||||
compilerInfo: templateSpec.compiler
|
||||
compilerInfo: templateSpec.compiler,
|
||||
};
|
||||
|
||||
function ret(context, options = {}) {
|
||||
@@ -412,7 +412,7 @@ function executeDecorators(fn, prog, container, depths, data, blockParams) {
|
||||
}
|
||||
|
||||
function wrapHelpersToPassLookupProperty(mergedHelpers, container) {
|
||||
Object.keys(mergedHelpers).forEach(helperName => {
|
||||
Object.keys(mergedHelpers).forEach((helperName) => {
|
||||
let helper = mergedHelpers[helperName];
|
||||
mergedHelpers[helperName] = passLookupPropertyOption(helper, container);
|
||||
});
|
||||
@@ -420,7 +420,7 @@ function wrapHelpersToPassLookupProperty(mergedHelpers, container) {
|
||||
|
||||
function passLookupPropertyOption(helper, container) {
|
||||
const lookupProperty = container.lookupProperty;
|
||||
return wrapHelper(helper, options => {
|
||||
return wrapHelper(helper, (options) => {
|
||||
return Utils.extend({ lookupProperty }, options);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user