stylelint-plugin-defensive-css 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -29,8 +29,17 @@ npm i stylelint-plugin-defensive-css --save-dev
29
29
  yarn add stylelint-plugin-defensive-css --dev
30
30
  ```
31
31
 
32
- With the plugin installed, the individual rule(s) can be added to the project's
33
- Stylelint configuration.
32
+ With the plugin installed, the rule(s) can be added to the project's Stylelint
33
+ configuration.
34
+
35
+ ```json
36
+ {
37
+ "plugins": ["stylelint-plugin-defensive-css"],
38
+ "rules": {
39
+ "plugin/use-defensive-css": [true, { "severity": "warning" }]
40
+ }
41
+ }
42
+ ```
34
43
 
35
44
  ## Rules / Options
36
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stylelint-plugin-defensive-css",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "A Stylelint plugin to enforce defensive CSS best practices.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -3,6 +3,8 @@ const expression = /-\b(moz|ms|o|webkit)\b-/g;
3
3
  export function findVendorPrefixes(selector) {
4
4
  if (!selector) return false;
5
5
 
6
- let prefixesFound = [...selector.trim().matchAll(expression)];
7
- return prefixesFound.length > 1;
6
+ const prefixesFound = [...selector.trim().matchAll(expression)];
7
+ const prefixes = new Set(prefixesFound.map((prefix) => prefix[1]));
8
+
9
+ return prefixes.size > 1;
8
10
  }