Note: This ESLint plugin is still under development. Please submit a issue or PR if you have any suggestions and changes.
- Install
npm install @menglinmaker/eslint-plugin-runtime-compat
- Add ESLint config
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'], {
deprecated: true,
experimental: true,
})];
Prerequisite - must have pnpm
installed. All git-hooks for formatting will be automatically installed and configured.
- Clone repo
- Build dist before linting -
pnpm run build
- Contribute to some files
- Create a pull request changeset -
pnpm changeset
- Approved PRs that passes CI will be released to npm
The feedback cycle for detecting and fixing runtime compatability issues is too large:
- Executing JavaScript requires a runtime, which there are many that do not fully comply to web standards. So what runs on Node.js locally and CI may not run on Cloudflare workers in production.
- As an interpreted language, incompatible JavaScript will only throw errors on execution, so errors may not occur immediately.
Lint compatability issues before deployment using pre-collected runtime-compat-data.
An alternative approach is to use remocal testing. However, this does require a more complex setup with more test code to maintain.
- Does not lint across multiple files since ESLint only analyses each file in isolation.
- Cannot detect overiding of APIs - variables cannot be tracked across files due to ESLint's design.
- Track variable reassignments within a file.
- Detect incompatability issues from instance methods and properties.
- Disable rules due to polyfills.