Skip to content

Commit

Permalink
chore: add eslint-plugin-compat and eslint-plugin-es5
Browse files Browse the repository at this point in the history
- tests are not compiled with babel and must thus be in
  es5
- we don't use polyfills, so we need to make sure no
  functions aren't used that are not supported by popular browsers. (like Object.assign in Safari and IE11)
- Boths are errors that usually only appear when running
  tests in SauceLabs, which happens only on _after_
  merging a PR.
  • Loading branch information
nknapp committed Oct 28, 2019
1 parent 7052e88 commit 088e618
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
"extends": "eslint:recommended",
"extends": ["eslint:recommended","plugin:compat/recommended"],
"globals": {
"self": false
},
Expand Down
103 changes: 100 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"node": ">=0.4.7"
},
"dependencies": {
"eslint-plugin-compat": "^3.3.0",
"neo-async": "^2.6.0",
"optimist": "^0.6.1",
"source-map": "^0.6.1"
Expand All @@ -37,6 +38,7 @@
"dtslint": "^0.5.5",
"dustjs-linkedin": "^2.0.2",
"eco": "~1.1.0-rc-3",
"eslint-plugin-es5": "^1.4.1",
"grunt": "^1.0.3",
"grunt-babel": "^5.0.0",
"grunt-bg-shell": "^2.3.3",
Expand Down
9 changes: 7 additions & 2 deletions spec/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"extends": [
"../.eslintrc.js",
"plugin:es5/no-es2015"
],
"plugins": [
"es5"
],
"globals": {
"CompilerContext": true,
"Handlebars": true,
"handlebarsEnv": true,

"shouldCompileTo": true,
"shouldCompileToWithPartials": true,
"shouldThrow": true,
"compileWithPartials": true,

"console": true,
"require": true,
"suite": true,
Expand Down
4 changes: 2 additions & 2 deletions spec/ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe('ast', function() {
describe('whitespace control', function() {
describe('parse', function() {
it('mustache', function() {
let ast = Handlebars.parse(' {{~comment~}} ');
var ast = Handlebars.parse(' {{~comment~}} ');

equals(ast.body[0].value, '');
equals(ast.body[2].value, '');
Expand All @@ -142,7 +142,7 @@ describe('ast', function() {

describe('parseWithoutProcessing', function() {
it('mustache', function() {
let ast = Handlebars.parseWithoutProcessing(' {{~comment~}} ');
var ast = Handlebars.parseWithoutProcessing(' {{~comment~}} ');

equals(ast.body[0].value, ' ');
equals(ast.body[2].value, ' ');
Expand Down
2 changes: 1 addition & 1 deletion spec/env/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var filename = 'dist/handlebars.js';
if (global.minimizedTest) {
filename = 'dist/handlebars.min.js';
}
var distHandlebars = fs.readFileSync(require.resolve(`../../${filename}`), 'utf-8');
var distHandlebars = fs.readFileSync(require.resolve('../../' + filename), 'utf-8');
vm.runInThisContext(distHandlebars, filename);

global.CompilerContext = {
Expand Down

0 comments on commit 088e618

Please sign in to comment.