Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.
like image 438
Carolyn Conway Avatar asked Jul 08 '16 01:07

Carolyn Conway


People also ask

How do I know if JavaScript is compatible?

To verify JS browser compatibility quickly and accurately, try BrowserStack's real device cloud of 3000+ real browsers and devices, Just sign up for free, select the real browser-device combination you want to test on, enter the website URL and start testing.


2 Answers

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
like image 73
Stephan Vierkant Avatar answered Oct 26 '22 08:10

Stephan Vierkant


I'd recommend you to use this website http://jscc.info/ Its done the job for me in the past.

like image 44
Dragg Avatar answered Oct 26 '22 07:10

Dragg