stylelint-plugin-defensive-css 0.6.0 → 0.8.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stylelint-plugin-defensive-css",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "A Stylelint plugin to enforce defensive CSS best practices.",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -33,13 +33,12 @@ let isLastStyleDeclaration = false;
33
33
  let isWrappedInHoverAtRule = false;
34
34
 
35
35
  function traverseParentRules(parent) {
36
- console.log({ parent });
37
36
  if (parent.parent.type === 'root') {
38
37
  return;
39
38
  }
40
39
 
41
40
  if (parent.parent.type === 'atrule') {
42
- if (parent.parent.params.includes('hover: hover')) {
41
+ if (parent.parent.params && parent.parent.params.includes('hover: hover')) {
43
42
  isWrappedInHoverAtRule = true;
44
43
  } else {
45
44
  traverseParentRules(parent.parent);
@@ -64,7 +63,7 @@ const ruleFunction = (_, options) => {
64
63
  if (options?.['accidental-hover']) {
65
64
  const parent = decl.parent;
66
65
  const selector = parent.selector;
67
- const isHoverSelector = selector.includes(':hover');
66
+ const isHoverSelector = selector?.includes(':hover');
68
67
  isWrappedInHoverAtRule = false;
69
68
 
70
69
  if (isHoverSelector) {
@@ -155,11 +154,19 @@ const ruleFunction = (_, options) => {
155
154
  flexWrappingProps.nodeToReport = decl;
156
155
  }
157
156
 
157
+ if (decl.prop === 'flex-flow' && decl.value.includes('column')) {
158
+ flexWrappingProps.isFlexRow = false;
159
+ flexWrappingProps.isMissingFlexWrap = false;
160
+ }
161
+
158
162
  if (decl.prop === 'flex-direction' && decl.value.includes('column')) {
159
163
  flexWrappingProps.isFlexRow = false;
160
164
  }
161
165
 
162
- if (decl.prop === 'flex-wrap') {
166
+ if (
167
+ decl.prop === 'flex-wrap' ||
168
+ (decl.prop === 'flex-flow' && decl.value.includes('wrap'))
169
+ ) {
163
170
  flexWrappingProps.isMissingFlexWrap = false;
164
171
  }
165
172