Package Exports
- stylelint-browser-compat
- stylelint-browser-compat/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stylelint-browser-compat) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
stylelint-browser-compat

Yet another linter rule to detect compatibility of CSS features.
This plugin checks if the CSS you're using is supported by the browsers you're targeting. It uses @mdn/browser-compat-data to detect browser support.
⚠️ This plugin is beta. USE AT YOUR OWN RISK.
Table of Contents
Background
stylelint-no-unsupported-browser-features (using doiuse) is available to detect compatibility of CSS features.
However, doiuse have not been maintained for a long time.
This library provides another alternative to detect compatibility of CSS features.
Although doiuse detects compatibility from caniuse data, this library uses @mdn/browser-compat-data to do so.
Install
$ npm install --dev browserslist stylelint stylelint-browser-compat$ yarn add --dev browserslist stylelint stylelint-browser-compatUsage
module.exports = {
plugins: ['stylelint-browser-compat'],
rules: {
'plugin/browser-compat': [
true,
{
allow: {
features: ['at-rules.supports'],
flagged: false,
partialImplementation: false,
prefix: true,
},
browserslist: ['last 2 versions'],
},
],
},
};Options
browserslist(string or array, optional)- Accepts browserslist queries for target browsers.
- By default, browserslist automatically loads the configuration file (e.g.
package.json,.browserslistrc).
allow.features(array, optional)- Accepts an array of features to allow.
- Feature names are from @mdn/browser-compat-data.
- For example, if you want to use
@supportsat-rules, passat-rules.supports.
- For example, if you want to use
allow.flagged(boolean, optional)- Allows features that are available when the browser's feature flags is enabled.
falseby default
allow.partialImplementation(boolean, optional)- Allows features that are partial implementations.
falseby default
allow.prefix(boolean, optional)- Allows features with vendor prefix.
trueby default
Contributing
PRs accepted.