-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transform commonjs: show warning on import/export of reserved keyword #313
Comments
This is a nice One! i will write about that in my book thanks for supplying this but let me show you a importent code style change when you code esModules exports.new = function() {}; // Wrong Really bad! 'use strict' // Only needed in the first file but is here for education
const new = function() {}; // This already errors even in es5
exports.new = new; // Good thing we assign to exports a already defined var
this error is also already correctly catched by eslint and typescript so this can be closed its out of scope for lebab to run such checks before the main transform applys while i think it would be nice to add something that changes exports.new = function() {}; to const new = function() {};
exports.new = new; and use that as pre transform so that people could check if that cjs code runs before they apply the import/export transform |
this works in es5
this fails in es6
cos
new
is a reserved keywordonly solution is to rename the export/import
lebab should at least show a warning
The text was updated successfully, but these errors were encountered: