You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added a task to our build cycle to check whether bundled javascript is es5 or not. but the es-check module has some problems.
I think we have to find another module or fix the es-check.
1. Feature
1. When pass build (no have es6 syntax)
> Task :ngrinder-frontend:checkES5
ES-Check: Going to check files using version 5
ES-Check: checking ../ngrinder-controller/build/classes/main/static/js/app.js
ES-Check: there were no ES version matching errors! 🎉
BUILD SUCCESSFUL in 50s
24 actionable tasks: 23 executed, 1 up-to-date
2. When failed build (have es6 syntax)
> Task :ngrinder-frontend:checkES5
ES-Check: Going to check files using version 5
ES-Check: checking ../ngrinder-controller/build/classes/main/static/js/app.js
ES-Check: failed to parse file: ../ngrinder-controller/build/classes/main/static/js/app.js
- error: SyntaxError: The keyword 'const' is reserved (102:144568)
ES-Check: there were 1 ES version matching errors.
ES-Check Error:
----
· erroring file: ../ngrinder-controller/build/classes/main/static/js/app.js
· error: SyntaxError: The keyword 'const' is reserved (102:144568)
· see the printed err.stack below for context
----
SyntaxError: The keyword 'const' is reserved (102:144568)
at Parser.pp$4.raise (/Users/user/.npm/_npx/55223/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:2825:15)
...
> Task :ngrinder-frontend:checkES5 FAILED
FAILURE: Build failed with an exception.
BUILD FAILED in 33s
21 actionable tasks: 18 executed, 3 up-to-date
2. es-check module issue
It does not catch some es6 keywords like Object.assign, Promise
Actually, When I test with the below script, es-check passes the task even if it has es6 syntax.
// es-check-testing.js
var myPromise = new Promise(function(resolve, reject) {
resolve();
reject();
});
var o1 = { a: 1 };
var o2 = { b: 2 };
var o3 = { c: 3 };
var obj = Object.assign(o1, o2, o3);
npx es-check es5 ./es-check-testing.js --verbose
ES-Check: Going to check files using version 5
ES-Check: checking ./es-check-testing.js
ES-Check: there were no ES version matching errors! 🎉
donggyu04
changed the title
Add checkES5 task to build cycle but, the es-check module has some problem
Add checking es5 task to build cycle but, the es-check module has some problem
Jan 29, 2021
As far as I understand ,es-check checks if the check target contains illegal syntax or not. Object.assign, Promise is not syntax but Identifier (which is provided by javascript engine) and these should be handled by something else.
Even though it does not check whole IE compatibility issues, embedding es-check is better to have, I think Object.assign, Promise can be handled by polyfill instead.
Just adopt es-check.
I added a task to our build cycle to check whether bundled javascript is es5 or not. but the es-check module has some problems.
I think we have to find another module or fix the es-check.
1. Feature
1. When pass build (no have es6 syntax)
2. When failed build (have es6 syntax)
2. es-check module issue
It does not catch some es6 keywords like
Object.assign, Promise
Actually, When I test with the below script, es-check passes the task even if it has es6 syntax.
Relevant issues below.
dollarshaveclub/es-check#122
dollarshaveclub/es-check#72
The text was updated successfully, but these errors were encountered: