PublicisSapient / enable-a11y

MIT License
11 stars 5 forks source link

Fix ES6 to ES4 conversion #142

Closed alisonhall closed 3 months ago

alisonhall commented 3 months ago

Fixes issue #136

Instead of naively using a bash script to remove all lines that start with import or export, I am using the jscodeshift package. This allows us to remove multi-line import/export statements, as well as removing only the export keyword that might come before a function declaration.

Note: Running this updated code has made some minor changes to the existing ES4 files; sometimes adding some additional brackets around modules, and sometimes remove some empty lines; no functionality should be impacted. It does remove the old ES4 hamburger.js file, since there is no matching ES6 file anymore.

Additional Note: there are 2 existing files (enable-carousel.js and enable-dialog.js) where there are import statements embedded within the module code, with then and catch statements coming off of the import. These import statements weren't being removed with the original bash script, and they're not being removed using this new script either. The modules need to be refactored in order for the import statements to be detached from the rest of the modules code.