1.0.0 • Published 2 years ago

@dropbox/eslint-plugin-service-worker v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

eslint-plugin-service-worker

ESLint plugin for service worker environment.

Installation

npm install eslint @dropbox/eslint-plugin-service-worker -D

Configuration

// .eslintrc.js
module.exports = {
  ...
  plugin: [
    "@dropbox/service-worker",
  ],
  rules: {
    "@dropbox/service-worker/no-restricted-web-api": "error",
    "@dropbox/service-worker/no-deprecated-extension-api": "error",
    "@dropbox/service-worker/no-dynamic-import": "error",
  },
  ...
}

Rules

no-restricted-web-api

In web extension service worker, certain web APIs will be restricted in use, such as XMLHttpRequest and window API. The rule catch the use of restricted Web APIs in service worker.

no-deprecated-extension-api

As part of Manifest V3 upgrade, certain extension APIs, such as browser.browserAction and browser.pageAction were deprecated. The rule will catch the usage of the deprecated extension APIS in service worker.

no-dynamic-import

Service worker does not allow dynamic import, import(). This rule will catch the usage of dynamic import in service worker.

License

Apache 2.0