All Projects → ismay → Stylelint No Unsupported Browser Features

ismay / Stylelint No Unsupported Browser Features

Disallow features that aren't supported by your target browser audience.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Stylelint No Unsupported Browser Features

Postcss Less
PostCSS Syntax for parsing LESS
Stars: ✭ 93 (-60.92%)
Mutual labels:  stylelint
Vscode Stylelint
Official Visual Studio Code extension to lint CSS/SCSS/Less with stylelint
Stars: ✭ 141 (-40.76%)
Mutual labels:  stylelint
Awesome Stylelint
A list of awesome stylelint plugins, configs, etc.
Stars: ✭ 179 (-24.79%)
Mutual labels:  stylelint
Static Site Boilerplate
A better workflow for building modern static websites.
Stars: ✭ 1,633 (+586.13%)
Mutual labels:  stylelint
Nextjs Ts
Opinionated Next JS project boilerplate with TypeScript and Redux
Stars: ✭ 134 (-43.7%)
Mutual labels:  stylelint
Gulp Stylelint
Gulp plugin for running Stylelint results through various reporters.
Stars: ✭ 149 (-37.39%)
Mutual labels:  stylelint
Stylelint Config Suitcss
SUIT CSS config for stylelint
Stars: ✭ 73 (-69.33%)
Mutual labels:  stylelint
Styled React Boilerplate
Minimal & Modern boilerplate for building apps with React & styled-components
Stars: ✭ 198 (-16.81%)
Mutual labels:  stylelint
Stylelint Config Recommended Scss
The recommended shareable SCSS config for stylelint
Stars: ✭ 141 (-40.76%)
Mutual labels:  stylelint
Stylelint Config Primer
Sharable stylelint config used by GitHub's CSS
Stars: ✭ 165 (-30.67%)
Mutual labels:  stylelint
Frasco
Quick starter for Jekyll including full setup for Sass, PostCSS, Autoprefixer, stylelint, Webpack, ESLint, imagemin, Browsersync, etc.
Stars: ✭ 123 (-48.32%)
Mutual labels:  stylelint
Stylelint Config Recess Order
🗂️ Recess-based property sort order for Stylelint.
Stars: ✭ 133 (-44.12%)
Mutual labels:  stylelint
Express Webpack React Redux Typescript Boilerplate
🎉 A full-stack boilerplate that using express with webpack, react and typescirpt!
Stars: ✭ 156 (-34.45%)
Mutual labels:  stylelint
React Typescript Webpack2 Cssmodules Postcss
Simple Starter Template for React, TypeScript, postCSS, ITCSS, CSS-Modules, Webpack and Live Reloading (React Hot Loader 3)
Stars: ✭ 117 (-50.84%)
Mutual labels:  stylelint
Stylefmt
stylefmt is a tool that automatically formats stylesheets.
Stars: ✭ 2,123 (+792.02%)
Mutual labels:  stylelint
Stylelint Config Css Modules
CSS modules shareable config for stylelint
Stars: ✭ 78 (-67.23%)
Mutual labels:  stylelint
Workflow
一个工作流平台
Stars: ✭ 1,888 (+693.28%)
Mutual labels:  stylelint
Front End Guide
📚 Study guide and introduction to the modern front end stack.
Stars: ✭ 14,073 (+5813.03%)
Mutual labels:  stylelint
Stylelint Prettier
Stylelint plugin for Prettier formatting
Stars: ✭ 188 (-21.01%)
Mutual labels:  stylelint
Prettier Stylelint
code > prettier > stylelint > formatted code
Stars: ✭ 162 (-31.93%)
Mutual labels:  stylelint

stylelint-no-unsupported-browser-features

npm version ci codecov dependabot status semantic-release

disallow features that aren't supported by your target browser audience

screenshot

This plugin checks if the CSS you're using is supported by the browsers you're targeting. It uses doiuse to detect browser support. Doiuse itself checks your code against the caniuse database and uses browserslist to get the list of browsers you want to support. Doiuse and this plugin are only compatible with standard css syntax, so syntaxes like scss, less and others aren't supported.

Installation

$ npm install stylelint-no-unsupported-browser-features

Stylelint is a peerdependency of this plugin, so you'll have to install stylelint as well:

$ npm install stylelint

Usage

  1. Add "stylelint-no-unsupported-browser-features" to your stylelint config plugins array
  2. Add "plugin/no-unsupported-browser-features" to your stylelint config rules
  3. Enable the rule by setting it to true, or pass optional extra configuration

Options

  • browsers: optional. Accepts an array of browsers you want to support. For example ['> 1%', 'Last 2 versions']. See browserslist for documentation.
  • ignore: optional. Accepts an array of features to ignore. For example: ['rem', 'css-table']. Feature names can be found in the error messages.
  • ignorePartialSupport: optional, off by default. Accepts a boolean. When enabled:
    • Rules that only trigger partial violations will be ignored.
    • Rules that trigger both partial and full violations will only report on the full support violations.
    • Rules that trigger only full support violations will not be affected.

So for example, in a .stylelintrc:

{
  "plugins": [
    "stylelint-no-unsupported-browser-features"
  ],
  "rules": {
    "plugin/no-unsupported-browser-features": [true, {
      "browsers": ["> 1%", "Last 2 versions"],
      "ignore": ["rem"],
      "ignorePartialSupport": true
    }]
  }
}

Recommendations

This is a good rule to use with "warning"-level severity, because its primary purpose is to warn you that you are using features not all browsers fully support and therefore ought to provide fallbacks. But the warning will continue even if you have a fallback in place (it doesn't know); so you probably do not want this rule to break your build. Instead, consider it a friendly reminder to double-check certain spots for fallbacks.

Also, doiuse uses browserslist to get the list of browsers you want to support. Browserslist accepts a browserslist file at the root of your project with a list of browsers that you want to support. Since there are other projects that can use this file (like autoprefixer or eslint-plugin-compat) the simplest solution is to just define your intended browser support there (note that there are a lot of different ways to define this list, so check out the browserslist documentation for more options).

For the above setup you could use the following config:

./.stylelintrc

{
  "plugins": [
    "stylelint-no-unsupported-browser-features"
  ],
  "rules": {
    "plugin/no-unsupported-browser-features": [true, {
      "severity": "warning"
    }]
  }
}

./browserslist:

> 5%
Last 2 versions

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].