WordPress-Coding-Standards / stylelint-config-wordpress

WordPress shareable config for stylelint Note: Migrating to Gutenberg repo:

Home Page:https://github.com/WordPress/gutenberg/pull/22777

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add `no-unsupported-browser-features` rule

ntwb opened this issue · comments

Copied from WordPress Autoprefixer configiruation:

https://core.trac.wordpress.org/browser/trunk/Gruntfile.js#L28

browsers: [
  'Android >= 2.1',
  'Chrome >= 21',
  'Edge >= 12',
  'Explorer >= 7',
  'Firefox >= 17',
  'Opera >= 12.1',
  'Safari >= 6.0'
],

stylelint rule:

    "no-unsupported-browser-features": [true, {
      "browsers": "Android >= 2.1, Chrome >= 21, Edge >= 12, Explorer >= 7, Firefox >= 17, Opera >= 12.1, Safari >= 6.0"
    }],

Testing this rule on WordPress CSS currently results in 3279 warnings, of which 2463 relate to IE, 790 Android Browser, and 227 Opera leaving 158 warnings for all other browsers.

Bumping the versions of each browser greater than 1% usage results in 148 warnings in total:

    "no-unsupported-browser-features": [true, {
      "browsers": "Android >= 4.4, Chrome >= 49, Edge >= 13, Explorer >= 11, Firefox >= 46, Opera >= 38, Safari >= 9.1"
    }],

Bumping explicitly to >1% results in 1448 warnings:

    "no-unsupported-browser-features": [true, {
      "browsers": ">1%"
    }],

Above stats from http://caniuse.com/usage-table

Note: supporting all of the browsers via the Autoprefixer configuration cited is not the same as any WordPress policy on supported browsers, it doesn't hurt to support older browser vendor prefixes and this in no way suggests WordPress supports all these browser versions

Note: Via http://stylelint.io/user-guide/rules/no-unsupported-browser-features/

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.

Note: no-unsupported-browser-features was deprecated as part of stylelint 7.8

Per that, I'm closing this.