Query Check for Browserslist
Checks your Browserslist queries while you type, in
.browserslistrc, browserslist files and the "browserslist" key of package.json. It shows which browsers
each line selects, which lines are wrong or do nothing, and the final list your build tools (Autoprefixer, Babel,
PostCSS, ESLint plugins and others) will target. Everything runs offline, inside VS Code.
Features
- Syntax highlighting for
.browserslistrc and browserslist files: comments, [environment] sections,
keywords (last, versions, defaults, dead, not, and, or, supports, cover, extends, ...),
numbers, percentages and browser names.
- Problems while you type, in
.browserslistrc and in package.json (string, array or per-environment object):
- Error on the exact query browserslist cannot read, with browserslist's own message
(for example
Unknown browser query `lastt 2 versions` or Unknown browser chrom), including
unknown features, unknown regions, a first query that starts with not, duplicate sections and
non-string entries.
- Warning when a query or a whole section selects no browsers.
- Hint (shown faded) on a line that adds nothing because the lines above already select all of its browsers.
This is deliberately careful: it only marks plain lines (no
and, not or comma inside), and only when
combining the lines one by one gives exactly browserslist's own result, so removing a marked line never
changes the result.
- Error when one folder has both
.browserslistrc and a package.json with "browserslist"
(or a browserslist file): browserslist stops with an error in that case.
- Hover on a query to see the browsers it selects (grouped by browser, consecutive versions joined, with global
usage), what it adds compared with the lines above, and the section total. Hover on a section header, an
environment key or the
"browserslist" key to see the final list and its global usage coverage.
- Completion of queries (
last 2 versions, > 0.5%, not dead, cover 99.5%, baseline widely available, ...),
browser names and aliases, caniuse feature names after supports, and country / region codes after % in.
- Browserslist: Show resolved browsers command: opens a read-only document listing the final browsers of every
environment, with coverage, in the same form as
npx browserslist.
- Status bar: while a Browserslist config is open, shows how many browsers the
production environment selects.
Click it to open the resolved list.
- Old data notice: when the caniuse-lite data in use is six months old or more, a one-time notice and a line in
the hover recommend
npx update-browserslist-db@latest. The extension never runs that command itself.
Which browserslist is used
By default, in a trusted workspace the extension loads the project's own node_modules/browserslist
(looking upwards from the config file to the workspace folder), so the results match your build tools exactly,
including the project's caniuse-lite data. When the project has none, and always in Restricted Mode, it uses
browserslist and caniuse-lite bundled with the extension. The hover footer and the resolved document say which one
was used and how old its data is.
Settings
| Setting |
Default |
Meaning |
browserslistQueryCheck.useWorkspaceBrowserslist |
true |
Use the project's node_modules/browserslist in trusted workspaces. |
browserslistQueryCheck.hintRedundantQueries |
true |
Show the hint on lines that add no browsers. |
browserslistQueryCheck.statusBar |
true |
Show the browser count in the status bar. |
browserslistQueryCheck.statusBarEnvironment |
production |
Environment counted in the status bar (falls back to defaults, as browserslist does). |
Limitations
- Results depend on the browser data in use; dates such as
last 1 year and maintained node versions depend on today's date.
- In Restricted Mode,
extends and > 1% in <package> stats queries are not evaluated, because loading them would run
code from the workspace. browserslist config inside a config refers to the config itself and is never evaluated.
- The project's browserslist is loaded once per session; after updating it (or its data), run Developer: Reload Window.
BROWSERSLIST, BROWSERSLIST_ENV and other environment variables of your build are not known to the editor.
- Configs in
package.json are read only when the file is valid JSON.
Privacy
Nothing is sent anywhere. The extension makes no network requests and collects no data.
About
This is an unofficial extension. It is not affiliated with or endorsed by the Browserslist project or its authors.
It bundles browserslist (MIT) and caniuse-lite (CC BY 4.0, data from Can I Use); see THIRD_PARTY_NOTICES.txt.
It was built with the help of AI (Claude by Anthropic) and tested against the real browserslist package.
| |