Is there a tool for detecting browser compatibility issues in my Javascript code? [closed]
Asked Answered
L

2

19

I'm writing a Javascript library, and I'd like to be able to run it through some tool that will

  1. detect any methods that are incompatible with certain browsers, and/or
  2. tell me which browsers do support my code.

So far I can't find anything like this. Does it really not exist?


Prior Research:

  • I've found http://caniuse.com for checking specific methods, but it doesn't help me identify problems I don't know about.
  • I've read question after question about browser compatibility, but found nothing that fits.
  • I've found a bunch of tools for running my unit tests in different browsers (e.g., Sauce Labs), but that's not really what I'm trying to do.
Lyly answered 8/7, 2016 at 1:29 Comment(0)
E
6

I'd recommend you to use this website http://jscc.info/ (wayback machine) or https://seedmanc.github.io/jscc/

Its done the job for me in the past.

Expostulatory answered 8/7, 2016 at 1:31 Comment(2)
Looks like the domain expired. The source is up at github.com/tbusser/jscc if you want to dig deep and revive it.Ragin
Hosted again by a fork here: seedmanc.github.io/jsccRizal
C
5

You can use eslint-plugin-compat, a plugin for the ESlint linting utility. You can even use Browserlist to configure the browsers you want to support.

Nice animation about eslint-plugin-compat

Installation is very easy. You'll have to install eslint and this plugin:

npm install --save-dev eslint-plugin-compat

or

yarn add --dev eslint eslint-plugin-compat

And add a ESlint configuration file:

// .eslintrc
{
  "extends": ["plugin:compat/recommended"]
}

Add the supported browsers to your package.json file:

// sample configuration (package.json)
{
  // ...
  "browserslist": ["last 2 Chrome versions", "IE 11"],
}

And then run the linter:

eslint yourfile.js

In my case this was the output:

92:9   error  Promise.all() is not supported in IE 11  compat/compat
94:9   error  Promise.all() is not supported in IE 11  compat/compat
Corn answered 26/7, 2021 at 8:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.