stylelint-order 6.0.0 → 6.0.1

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-order",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "A collection of order related linting rules for Stylelint.",
5
5
  "keywords": [
6
6
  "stylelint-plugin",
@@ -22,7 +22,7 @@
22
22
  "main": "index.js",
23
23
  "dependencies": {
24
24
  "postcss": "^8.4.20",
25
- "postcss-sorting": "^8.0.0"
25
+ "postcss-sorting": "^8.0.1"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "stylelint": "^14.0.0"
@@ -1,6 +1,15 @@
1
1
  module.exports = function getContainingNode(node) {
2
- // For styled-components: declarations are children of Root node
3
- if (node.type !== 'rule' && node.type !== 'atrule' && node.parent.type === 'root') {
2
+ if (node.type === 'rule' || node.type === 'atrule') {
3
+ return node;
4
+ }
5
+
6
+ // postcss-styled-syntax: declarations are children of Root node
7
+ if (node.parent?.type === 'root' && node.parent?.raws.styledSyntaxIsComponent) {
8
+ return node.parent;
9
+ }
10
+
11
+ // @stylelint/postcss-css-in-js: declarations are children of Root node
12
+ if (node.parent?.document?.nodes?.some((item) => item.type === 'root')) {
4
13
  return node.parent;
5
14
  }
6
15