design-system-components
design-system-components copied to clipboard
[WIP] Linting with eslint and husky
As drafted by @toxamiz in #700, this is a more workable branch.
Issue reference: #429
Todo:
- [ ] JavaScript linting needs to be IE8 compliant.
@adamzerella, What you think about https://github.com/govau/design-system-components/pull/700#issuecomment-478085818 ?
Summary easy way to make js code IE8 compliant: stick with es5 syntax and recommend users to apply polyfills if they actually need an IE8 support es-shim, DOM-shim.
Or start to use transpile or even some of bundler (rollup etc.) on module.js
.
jQuery includes some polyfills as i know, so actualy don't need to do anything here (just es5 and jQuery API).
We don't have a choice when it comes to IE8 support, it's something that we support @toxamiz.
We might need to create a IE8 complaint eslint-plugin
to resolve this ticket. We need to be able to write code that provides our developers with linting without relying on polyfills.
@adamzerella but you already using and relying on polyfills. In every test file you have html5-shiv and media-query polyfill for breakpoints from core
globals (AU-media
).
For example grid-12
wouldn't work in ie8 separately if developer wouldn't apply media-query polyfill manually.
Can you explain, please, why you are refusing to use ie8 polyfills here? es5 requirement and polyfills for ie8 will solve this problem.
@toxamiz We are relying on polyfills where it makes sense. We are currently using html5shiv.js
and respond.js
as you've seen in the test/
files. This provides HTML5 and media functionality for older browsers. We do not ship the components with any shiv / shim libraries.
Linting and shivs are unrelated to one another. We need a way to lint our vanilla JavaScript so that it's extremely compatibility across browsers, this means linting for things like using for( ... )
over forEach
or issues like var
over const / let
.
You're right in saying we could just polyfill when we transpile the vanilla JavaScript but this isn't always going to work ( babel isn't perfect ) and it would increase our bundle sizes.