What is eslint-plugin-baseline-js
Check JavaScript syntax, builtins, and Web APIs with one Baseline rule.
Overview
eslint-plugin-baseline-js brings Baseline browser support data into your editor and lint checks.
It reports detected features that exceed your chosen policy.
- One threshold: choose
'widely','newly', or a year. - One rule:
baseline-js/use-baselinegives reports a consistent format. - Three surfaces: check JavaScript syntax, JS builtins, and Web APIs.
- One project policy: use the same threshold with CSS and HTML plugins.
Start with your project
Use recommended for JavaScript or recommended-ts with a configured TypeScript parser.
Quick Start walks through both setups.
Detection that uses TypeScript types
Type information helps the plugin distinguish a platform method from a custom method with the same name.
For example, use the TypeScript preset with available: 'widely':
const values = new ([1, 2]);.(new ([2]));
const custom = { : () => [] };.(); // A custom method, so no set-methods report.Hover over values and custom to compare their types. The platform call reports:
The 'difference' member of Set instances does not meet your Baseline Widely available target. It is Baseline Newly available. Feature ID: set-methods.Other supported checks include:
| Feature | Example |
|---|---|
Array by copy (array-by-copy) | values.toReversed() and values.toSorted() |
Intl.Locale info (intl-locale-info) | locale.getCalendars() |
Iterator helpers (iterator-methods) | iterator.map(fn) |
Iterator join (iterator-join) | iterator.join(", ") |
Uint8Array base64/hex (uint8array-base64-hex) | bytes.toHex() |
The parser supplies the receiver's declared or inferred type. Supported checks can also follow some aliases, unions, and inherited types.
What type information needs to include
Your TypeScript project must include the files and library declarations for the APIs you use.
The receiver's type must contain the member. Missing declarations or any types can hide a report.
These checks do not cover every type or access pattern. When parser type information is missing, the plugin skips checks that need it and keeps other checks active. See Quick Start for parser setup.
Data from web-features
web-features, maintained by WebDX, supplies the Baseline statuses behind the reports. Each plugin release bundles a generated data snapshot.
Check the data and the detector
A feature needs both Baseline data and a matching rule or descriptor. Use Coverage to see what is mapped before investigating a missing report.
Why results can differ from current browser support
Linting uses the installed snapshot. It does not fetch live browser data or advance feature status as time passes. A newer plugin release may include updated data and detectors.
The plugin checks source code. It does not validate polyfills, build output, Node.js support, or runtime behavior. Use it alongside tests in your target browsers.
Scope & Terms
Choose the checks that fit your JavaScript, builtins, and Web APIs
Last updated on