digital-analytics-program / gov-wide-code

Provides a set of javascript files and documentation to implement web analytics on US federal websites
http://www.digital.gov/dap
104 stars 55 forks source link

Add linter to check browser compatibility. #119

Closed sanason closed 3 months ago

sanason commented 3 months ago

The goal of this PR is to declare which browsers the DAP code will support and to add an automated mechanism to check that the DAP code actually does support those browsers.

The supported browsers policy is declared in .browserslistrc which uses the Browserslist configuration language.

The automated mechanism is a linter which uses the eslint-plugin-compat plugin to check JS code against a Browserslist policy.

The linter can be run with npm run lint. The current code is compatible with all of the required browsers so this command generates no output. It would make sense to eventually add this linting step as part of a CI/CD pipeline but, for now, it must be checked manually.