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 compatability issues during development.

Note: This ESLint plugin is still under development. Please submit a issue or PR if you have any suggestions and changes.

 

Setup

  1. Install
npm install @menglinmaker/eslint-plugin-runtime-compat
  1. 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,
})];

 

Contributing

Prerequisite - must have pnpm installed. All git-hooks for formatting will be automatically installed and configured.

  1. Clone repo
  2. Build dist before linting - pnpm run build
  3. Contribute to some files
  4. Create a pull request changeset - pnpm changeset
  5. Approved PRs that passes CI will be released to npm

 

Problem statement

What problem does this solve?

The feedback cycle for detecting and fixing runtime compatability issues is too large:

Solution

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.

Limitations:

  • 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.

Todo:

  • Track variable reassignments within a file.
  • Detect incompatability issues from instance methods and properties.
  • Disable rules due to polyfills.

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