Introducing super slick browser compatibility check module, built on the top of reliable MDN database.
- Install the plugin with following command:
npm i browsercompat --save-dev
- Open tslint.json and add code inside
rulesDirectory
option,"node_modules/browsercompat/dist"
For Angular project, it should look like this:"rulesDirectory": ["codelyzer", "node_modules/browsercompat/dist"],
Following is the schema needed to add inside tslint.json:
"rules": {
"supported-browsers": {
"options": {
"targets": {
"ie": 11,
"chrome": 60,
"safari": 10,
"firefox": 60
},
"whitelist": [
"Promise",
"Promise.*",
"Object.assign",
"Array.from",
"Array.find",
"Set.add",
"Set",
"String.startsWith",
"String.endsWith",
"Array.fill",
"String.repeat",
"HTMLElement.style"
]
}
}
}
- targets - It contains the minimum browser name and minimum supported version.
- whitelist - If you've added polyfills for some unsupported function and you want to exclude this from the checks, you can it inside the whitelist section.