@mrhenry/stylelint-mrhenry-prop-order 3.0.20 → 3.1.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.
Files changed (2) hide show
  1. package/index.mjs +22 -19
  2. package/package.json +3 -3
package/index.mjs CHANGED
@@ -126,27 +126,30 @@ const ruleFunction = (primaryOption) => {
126
126
  endIndex,
127
127
  result: postcssResult,
128
128
  ruleName,
129
- fix: () => {
130
- sortedSection.reverse().forEach((decl) => {
131
- container.insertBefore(firstNodeIndex, decl);
132
- return;
133
- });
134
-
135
- const finalFirstNode = container.nodes[firstNodeIndex];
136
- if (originalFirstNode.raws.before && finalFirstNode.raws.before) {
137
- const originalRawBefore = originalFirstNode.raws.before;
138
- originalFirstNode.raws.before = finalFirstNode.raws.before;
139
- finalFirstNode.raws.before = originalRawBefore;
140
- }
141
-
142
- for (const [comment, prev] of matchedComments) {
143
- if (!section.includes(prev)) {
144
- continue;
129
+ fix: {
130
+ apply: () => {
131
+ sortedSection.reverse().forEach((decl) => {
132
+ container.insertBefore(firstNodeIndex, decl);
133
+ return;
134
+ });
135
+
136
+ const finalFirstNode = container.nodes[firstNodeIndex];
137
+ if (originalFirstNode.raws.before && finalFirstNode.raws.before) {
138
+ const originalRawBefore = originalFirstNode.raws.before;
139
+ originalFirstNode.raws.before = finalFirstNode.raws.before;
140
+ finalFirstNode.raws.before = originalRawBefore;
145
141
  }
146
142
 
147
- comment.remove();
148
- container.insertAfter(prev, comment);
149
- }
143
+ for (const [comment, prev] of matchedComments) {
144
+ if (!section.includes(prev)) {
145
+ continue;
146
+ }
147
+
148
+ comment.remove();
149
+ container.insertAfter(prev, comment);
150
+ }
151
+ },
152
+ node: container
150
153
  }
151
154
  });
152
155
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrhenry/stylelint-mrhenry-prop-order",
3
- "version": "3.0.20",
3
+ "version": "3.1.0",
4
4
  "description": "Mr. Henry's preferred order for CSS properties",
5
5
  "type": "module",
6
6
  "main": "index.mjs",
@@ -27,10 +27,10 @@
27
27
  "stylelint-plugin"
28
28
  ],
29
29
  "peerDependencies": {
30
- "stylelint": "^16.13.0"
30
+ "stylelint": "^16.14.1"
31
31
  },
32
32
  "devDependencies": {
33
33
  "css-tree": "^3.1.0",
34
- "stylelint": "^16.13.0"
34
+ "stylelint": "^16.14.1"
35
35
  }
36
36
  }