Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-compat

Package Overview
Dependencies
Maintainers
2
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-compat

Lint browser compatibility of API used

  • 5.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
467K
decreased by-10.34%
Maintainers
2
Weekly downloads
 
Created

What is eslint-plugin-compat?

eslint-plugin-compat is an ESLint plugin that helps developers ensure their code is compatible with specified browser versions. It checks for the use of modern JavaScript features and APIs that may not be supported in older browsers, helping to avoid runtime errors in production.

What are eslint-plugin-compat's main functionalities?

Check browser compatibility

This configuration extends the recommended settings for eslint-plugin-compat and sets the environment to browser. It also specifies polyfills for 'fetch' and 'Promise' to ensure compatibility with older browsers.

module.exports = {
  "extends": [
    "plugin:compat/recommended"
  ],
  "env": {
    "browser": true
  },
  "settings": {
    "polyfills": [
      "fetch",
      "Promise"
    ]
  }
};

Custom browser targets

This configuration allows you to specify custom browser targets using the 'browsers' setting. In this example, it targets the last 2 versions of all browsers and browsers with more than 1% market share.

module.exports = {
  "extends": [
    "plugin:compat/recommended"
  ],
  "env": {
    "browser": true
  },
  "settings": {
    "browsers": [
      "last 2 versions",
      "> 1%"
    ]
  }
};

Other packages similar to eslint-plugin-compat

Keywords

FAQs

Package last updated on 10 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc