department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
282 stars 203 forks source link

Ensure browser compatibility for static JS assets #15615

Open mchelen-gov opened 3 years ago

mchelen-gov commented 3 years ago

Background: JS syntax that is unsupported by some browsers (such as IE11) can cause errors that prevent the site from functioning. Some JS files are served statically and not run through Babel transpilation.

AC: Automatically verify browser compatibility (such as IE11) for static JS assets in https://github.com/department-of-veterans-affairs/vets-website/tree/master/src/site/assets/js

Possible solutions:

Fix for example issue: https://github.com/department-of-veterans-affairs/vets-website/pull/14772/files

billfienberg commented 3 years ago

One potential improvement is adding a separate .eslintrc in the src/site/assets/js folder with rules that are configured to be IE11 compatible.

The configuration cascade works by using the closest .eslintrc file to the file being linted as the highest priority, then any configuration files in the parent directory, and so on. - https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy