Skip to content

Commit f6ff3bf

Browse files
committed
Upgrade to ECMAScript 2020
This is needed in order to use `globalThis`, see #1894. It also made it possible to remove some old polyfills and fallbacks.
1 parent da41887 commit f6ff3bf

File tree

21 files changed

+1191
-1618
lines changed

21 files changed

+1191
-1618
lines changed

.eslintrc.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ module.exports = {
55
},
66
env: {
77
node: true,
8-
es6: true
8+
es2020: true
9+
},
10+
parserOptions: {
11+
sourceType: 'module'
912
},
1013
rules: {
1114
'no-console': 'warn',
@@ -57,10 +60,5 @@ module.exports = {
5760
// ECMAScript 6 //
5861
//--------------//
5962
'no-var': 'error'
60-
},
61-
parserOptions: {
62-
sourceType: 'module',
63-
ecmaVersion: 6,
64-
ecmaFeatures: {}
6563
}
6664
};

README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ There are a few Mustache behaviors that Handlebars does not implement.
7979
Supported Environments
8080
----------------------
8181

82-
Handlebars has been designed to work in any ECMAScript 7 (2016) environment. This includes
82+
Handlebars has been designed to work in any ECMAScript 2020 environment. This includes
8383

8484
- Node.js
8585
- Chrome

lib/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-env node */
12
module.exports = {
23
env: {
34
// Handlebars should run natively in the browser

lib/handlebars/compiler/javascript-compiler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ JavaScriptCompiler.prototype = {
128128
this.decorators.push('return fn;');
129129

130130
if (asObject) {
131+
// eslint-disable-next-line no-new-func
131132
this.decorators = Function.apply(this, [
132133
'fn',
133134
'props',
@@ -260,7 +261,7 @@ JavaScriptCompiler.prototype = {
260261
if (asObject) {
261262
params.push(source);
262263

263-
return Function.apply(this, params);
264+
return Function.apply(this, params); // eslint-disable-line no-new-func
264265
} else {
265266
return this.source.wrap([
266267
'function(',

lib/handlebars/utils.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,10 @@ export function extend(obj /* , ...source */) {
3030
export let toString = Object.prototype.toString;
3131

3232
// Sourced from lodash
33-
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
34-
/* eslint-disable func-style */
35-
let isFunction = function(value) {
33+
// https://github.com/lodash/lodash/blob/4.17.21/LICENSE
34+
export function isFunction(value) {
3635
return typeof value === 'function';
37-
};
38-
// fallback for older versions of Chrome and Safari
39-
/* istanbul ignore next */
40-
if (isFunction(/x/)) {
41-
isFunction = function(value) {
42-
return (
43-
typeof value === 'function' &&
44-
toString.call(value) === '[object Function]'
45-
);
46-
};
4736
}
48-
export { isFunction };
49-
/* eslint-enable func-style */
5037

5138
/* istanbul ignore next */
5239
export const isArray =

0 commit comments

Comments
 (0)