Skip to content

Commit

Permalink
Use eslint-env "shared-node-browser" for shared handlebars code
Browse files Browse the repository at this point in the history
  • Loading branch information
nknapp committed Jan 7, 2022
1 parent b65135a commit 6cfbc26
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lib/.eslintrc.js
@@ -1,6 +1,8 @@
module.exports = {
env: {
// Handlebars should run natively in the browser
node: false
// Handlebars not use node or browser-specific apis
'shared-node-browser': true,
node: false,
browser: false
}
};
4 changes: 2 additions & 2 deletions lib/handlebars/compiler/code-gen.js
@@ -1,4 +1,4 @@
/* global define */
/* global define, require */
import { isArray } from '../utils';

let SourceNode;
Expand All @@ -8,7 +8,7 @@ try {
if (typeof define !== 'function' || !define.amd) {
// We don't support this in AMD environments. For these environments, we assume that
// they are running on the browser and thus have no need for the source-map library.
let SourceMap = require('source-map'); // eslint-disable-line no-undef
let SourceMap = require('source-map');
SourceNode = SourceMap.SourceNode;
}
} catch (err) {
Expand Down
3 changes: 2 additions & 1 deletion lib/handlebars/no-conflict.js
@@ -1,6 +1,7 @@
/* global global, window */
export default function(Handlebars) {
/* istanbul ignore next */
let root = typeof global !== 'undefined' ? global : window, // eslint-disable-line no-undef
let root = typeof global !== 'undefined' ? global : window,
$Handlebars = root.Handlebars;
/* istanbul ignore next */
Handlebars.noConflict = function() {
Expand Down

0 comments on commit 6cfbc26

Please sign in to comment.