Skip to content

Commit 21b5aad

Browse files
authored
fix: require-baseline should not warn for cursor property (#52)
refs #51
1 parent 2c14710 commit 21b5aad

File tree

4 files changed

+19
-44
lines changed

4 files changed

+19
-44
lines changed

docs/rules/require-baseline.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ a {
6060
}
6161
```
6262

63+
**Important:** While the `cursor` property is not considered baseline, it has wide support and will likely be considered baseline once the WebDX Community Group adds [an editorial step](https://github.com/web-platform-dx/web-features/issues/1038). In the meantime, this rule does not warn when `cursor` is used.
64+
6365
### Options
6466

6567
This rule accepts an option object with the following properties:

src/data/baseline-data.js

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ export const properties = new Map([
104104
["counter-set", 5],
105105
["counter-increment", 10],
106106
["counter-reset", 10],
107-
["cursor", 0],
108107
["custom-property", 10],
109108
["display", 10],
110109
["dominant-baseline", 10],
@@ -1377,48 +1376,6 @@ export const propertyValues = new Map([
13771376
["smooth", 0],
13781377
]),
13791378
],
1380-
[
1381-
"cursor",
1382-
new Map([
1383-
["alias", 0],
1384-
["all-scroll", 0],
1385-
["auto", 0],
1386-
["cell", 0],
1387-
["col-resize", 0],
1388-
["context-menu", 0],
1389-
["copy", 0],
1390-
["crosshair", 0],
1391-
["default", 0],
1392-
["e-resize", 0],
1393-
["ew-resize", 0],
1394-
["grab", 0],
1395-
["grabbing", 0],
1396-
["help", 0],
1397-
["move", 0],
1398-
["n-resize", 0],
1399-
["ne-resize", 0],
1400-
["nesw-resize", 0],
1401-
["no-drop", 0],
1402-
["none", 0],
1403-
["not-allowed", 0],
1404-
["ns-resize", 0],
1405-
["nw-resize", 0],
1406-
["nwse-resize", 0],
1407-
["pointer", 0],
1408-
["progress", 0],
1409-
["row-resize", 0],
1410-
["s-resize", 0],
1411-
["se-resize", 0],
1412-
["sw-resize", 0],
1413-
["text", 0],
1414-
["url", 0],
1415-
["vertical-text", 0],
1416-
["w-resize", 0],
1417-
["wait", 0],
1418-
["zoom-in", 0],
1419-
["zoom-out", 0],
1420-
]),
1421-
],
14221379
[
14231380
"text-overflow",
14241381
new Map([

tests/rules/require-baseline.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ ruleTester.run("require-baseline", rule, {
5555
`@supports (width: abs(20% - 100px)) {
5656
a { width: abs(20% - 100px); }
5757
}`,
58+
"div { cursor: pointer; }",
5859
{
5960
code: `@property --foo {
6061
syntax: "*";

tools/generate-baseline.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ import fs from "node:fs";
1717
// Helpers
1818
//------------------------------------------------------------------------------
1919

20+
/*
21+
* Properties that aren't considered baseline but have wide support.
22+
* https://github.com/web-platform-dx/web-features/issues/1038#issuecomment-2627370691
23+
*/
24+
25+
const WIDE_SUPPORT_PROPERTIES = new Set(["cursor"]);
26+
2027
const BASELINE_HIGH = 10;
2128
const BASELINE_LOW = 5;
2229
const BASELINE_FALSE = 0;
@@ -78,13 +85,21 @@ function extractCSSFeatures(features) {
7885
let match;
7986

8087
// property names
81-
if ((match = cssPropertyPattern.exec(key)) !== null) {
88+
if (
89+
(match = cssPropertyPattern.exec(key)) !== null &&
90+
!WIDE_SUPPORT_PROPERTIES.has(match.groups.property)
91+
) {
8292
properties[match.groups.property] = baselineIds.get(baseline);
8393
continue;
8494
}
8595

8696
// property values
8797
if ((match = cssPropertyValuePattern.exec(key)) !== null) {
98+
// don't include values for these properties
99+
if (WIDE_SUPPORT_PROPERTIES.has(match.groups.property)) {
100+
continue;
101+
}
102+
88103
if (!propertyValues[match.groups.property]) {
89104
propertyValues[match.groups.property] = {};
90105
}

0 commit comments

Comments
 (0)