Skip to content

Eslint check JS runtime conpatability issues. Inspired by eslint-plugin-compat and runtime-compat-data.

License

Notifications You must be signed in to change notification settings

MengLinMaker/eslint-plugin-runtime-compat

Repository files navigation

eslint-plugin-runtime-compat

GitHub npm version npm version

Lint JavaScript runtime compat issues before deployment!

 

Features:

  • Configure range of providers according to runtime-compat
  • Detect incompatible class instantiations
  • Detect incompatible class property access
  • Disable rules
  • Detect incompatible event listeners

Note: Project is in alpha. API may change

Setup

The linter config should target the server bundle, not client.

  1. Install
npm install @menglinmaker/eslint-plugin-runtime-compat
  1. Add eslint.config.mjs to root. This detects incompatible APIs for all runtimes in the dataset.
import runtimeCompat from "@menglinmaker/eslint-plugin-runtime-compat";

export default [runtimeCompat.configs.strict];

Alternatively, you can load a custom config:

export default [runtimeCompat.configs.custom(['node', 'bun', 'deno'])];

Limitations:

  • Does not lint across multiple files since ESLint only analyses each file in isolation by building an AST for each file.
  • Cannot detect when globals are overridden

Attibution

About

Eslint check JS runtime conpatability issues. Inspired by eslint-plugin-compat and runtime-compat-data.

Resources

License

Stars

Watchers

Forks

Packages

No packages published