stylelint-order 5.0.0 → 6.0.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/README.md CHANGED
@@ -64,6 +64,7 @@ All these configs have `properties-order` configured with logical properties gr
64
64
  * [`stylelint-config-hudochenkov/order`](https://github.com/hudochenkov/stylelint-config-hudochenkov/blob/master/order.js)
65
65
  * [`stylelint-config-recess-order`](https://github.com/stormwarning/stylelint-config-recess-order)
66
66
  * [`stylelint-config-property-sort-order-smacss`](https://github.com/cahamilton/stylelint-config-property-sort-order-smacss)
67
+ * [`stylelint-config-clean-order`](https://github.com/kutsan/stylelint-config-clean-order)
67
68
 
68
69
  ## Thanks
69
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stylelint-order",
3
- "version": "5.0.0",
3
+ "version": "6.0.0",
4
4
  "description": "A collection of order related linting rules for Stylelint.",
5
5
  "keywords": [
6
6
  "stylelint-plugin",
@@ -21,35 +21,31 @@
21
21
  ],
22
22
  "main": "index.js",
23
23
  "dependencies": {
24
- "postcss": "^8.3.11",
25
- "postcss-sorting": "^7.0.1"
24
+ "postcss": "^8.4.20",
25
+ "postcss-sorting": "^8.0.0"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "stylelint": "^14.0.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@stylelint/postcss-css-in-js": "^0.37.2",
32
- "eslint": "^7.27.0",
33
- "eslint-config-hudochenkov": "^8.0.0",
34
- "eslint-config-prettier": "^8.3.0",
35
- "eslint-plugin-import": "^2.25.2",
36
- "eslint-plugin-jest": "^24.3.6",
37
- "eslint-plugin-unicorn": "^33.0.1",
38
- "husky": "^7.0.2",
39
- "jest": "^27.2.5",
40
- "jest-preset-stylelint": "^4.1.1",
41
- "jest-watch-typeahead": "^1.0.0",
42
- "lint-staged": "^11.2.3",
43
- "postcss-html": "^0.36.0",
44
- "postcss-less": "^5.0.0",
45
- "prettier": "~2.4.1",
31
+ "eslint": "^8.31.0",
32
+ "eslint-config-hudochenkov": "^9.0.0",
33
+ "eslint-config-prettier": "^8.6.0",
34
+ "husky": "^8.0.3",
35
+ "jest": "^29.3.1",
36
+ "jest-preset-stylelint": "^6.0.0",
37
+ "jest-watch-typeahead": "^2.2.1",
38
+ "lint-staged": "^13.1.0",
39
+ "postcss-html": "^1.5.0",
40
+ "postcss-less": "^6.0.0",
41
+ "postcss-styled-syntax": "^0.1.0",
42
+ "prettier": "~2.8.1",
46
43
  "prettier-config-hudochenkov": "^0.3.0",
47
- "stylelint": "^14.0.0"
44
+ "stylelint": "^14.16.1"
48
45
  },
49
46
  "scripts": {
50
- "pretest": "eslint . --max-warnings=0 && prettier '**/*.js' --check",
47
+ "lint": "eslint . --max-warnings=0 && prettier '**/*.js' --check",
51
48
  "test": "jest",
52
- "jest": "jest",
53
49
  "watch": "jest --watch",
54
50
  "coverage": "jest --coverage",
55
51
  "fix": "eslint . --fix --max-warnings=0 && prettier '**/*.js' --write",
@@ -18,16 +18,16 @@ type PrimaryOption = Array<Keyword | AtRule | Rule>;
18
18
  type Keyword = "custom-properties" | "dollar-variables" | "at-variables" | "declarations" | "rules" | "at-rules" | "less-mixins";
19
19
 
20
20
  type AtRule = {
21
- type: 'at-rule',
22
- name?: string,
23
- parameter?: string | RegExp,
24
- hasBlock?: boolean
21
+ type: 'at-rule';
22
+ name?: string;
23
+ parameter?: string | RegExp;
24
+ hasBlock?: boolean;
25
25
  };
26
26
 
27
27
  type Rule = {
28
- type: 'rule',
29
- selector?: string | RegExp,
30
- name?: string
28
+ type: 'rule';
29
+ selector?: string | RegExp;
30
+ name?: string;
31
31
  };
32
32
  ```
33
33
 
@@ -178,7 +178,7 @@ Matches all rules with selector matching pattern:
178
178
 
179
179
  ```ts
180
180
  type SecondaryOptions = {
181
- unspecified?: "top" | "bottom" | "ignore",
181
+ unspecified?: "top" | "bottom" | "ignore";
182
182
  };
183
183
  ```
184
184
 
@@ -82,7 +82,7 @@ module.exports = function checkNode({
82
82
 
83
83
  allNodes.push(nodeData);
84
84
 
85
- let previousNodeData = allNodes[allNodes.length - 2];
85
+ let previousNodeData = allNodes[allNodes.length - 2]; // eslint-disable-line unicorn/prefer-at -- Need to support older Node.js
86
86
 
87
87
  // Skip first node
88
88
  if (!previousNodeData) {
@@ -36,7 +36,7 @@ module.exports = function checkNode(node, result, ruleName, messages) {
36
36
  node: child,
37
37
  };
38
38
 
39
- let previousPropData = allPropData[allPropData.length - 1];
39
+ let previousPropData = allPropData[allPropData.length - 1]; // eslint-disable-line unicorn/prefer-at -- Need to support older Node.js
40
40
 
41
41
  allPropData.push(propData);
42
42
 
@@ -19,7 +19,7 @@ This rule ignores variables (`$sass`, `@less`, `--custom-property`).
19
19
  * Optional secondary options
20
20
  * [`unspecified`](#unspecified)
21
21
  * [`emptyLineBeforeUnspecified`](#emptyLineBeforeUnspecified)
22
- * [`emptyLineMinimumPropertyThreshold`](#emptylineminimumpropertythreshold)
22
+ * [`emptyLineMinimumPropertyThreshold`](#emptyLineMinimumPropertyThreshold)
23
23
  * [Autofixing caveats](#autofixing-caveats)
24
24
 
25
25
  ## Options
@@ -28,11 +28,11 @@ This rule ignores variables (`$sass`, `@less`, `--custom-property`).
28
28
  type PrimaryOption = Array<string | Group>;
29
29
 
30
30
  type Group = {
31
- properties: Array<string>,
32
- emptyLineBefore?: 'always' | 'never' | 'threshold',
33
- noEmptyLineBetween?: boolean,
34
- groupName?: string
35
- order?: 'flexible,
31
+ properties: Array<string>;
32
+ emptyLineBefore?: 'always' | 'never' | 'threshold';
33
+ noEmptyLineBetween?: boolean;
34
+ groupName?: string;
35
+ order?: 'flexible';
36
36
  };
37
37
  ```
38
38
 
@@ -47,7 +47,7 @@ Array of unprefixed property names or group objects. Within an order array, you
47
47
 
48
48
  If `emptyLineBefore` specified, regardless of it's value, the first property in a rule would be forced to not have an empty line before it.
49
49
 
50
- For `threshold`, refer to the [`emptyLineMinimumPropertyThreshold` documentation](#emptylineminimumpropertythreshold-number).
50
+ For `threshold`, refer to the [`emptyLineMinimumPropertyThreshold` documentation](#emptyLineMinimumPropertyThreshold).
51
51
 
52
52
  If this option is not working as expected, make sure you don't have `declaration-empty-line-before` configured in a conflicting way in your Stylelint config or config you're extending (e. g. [`stylelint-config-standard`](https://github.com/stylelint/stylelint-config-standard)).
53
53
 
@@ -507,9 +507,9 @@ a {
507
507
 
508
508
  ```ts
509
509
  type SecondaryOptions = {
510
- unspecified?: "top" | "bottom" | "bottomAlphabetical" | "ignore",
511
- emptyLineBeforeUnspecified?: "always" | "never" | "threshold",
512
- emptyLineMinimumPropertyThreshold?: number,
510
+ unspecified?: "top" | "bottom" | "bottomAlphabetical" | "ignore";
511
+ emptyLineBeforeUnspecified?: "always" | "never" | "threshold";
512
+ emptyLineMinimumPropertyThreshold?: number;
513
513
  };
514
514
  ```
515
515
 
@@ -688,7 +688,7 @@ Default behavior does not enforce the presence of an empty line before an unspec
688
688
  If `"always"`, the unspecified group must be separated from other properties by an empty newline.
689
689
  If `"never"`, the unspecified group must have no empty lines separating it from other properties.
690
690
 
691
- For `"threshold"`, see the [`emptyLineMinimumPropertyThreshold` documentation](#emptylineminimumpropertythreshold-number) for more information.
691
+ For `"threshold"`, see the [`emptyLineMinimumPropertyThreshold` documentation](#emptyLineMinimumPropertyThreshold) for more information.
692
692
 
693
693
  If `emptyLineBeforeUnspecified` specified, regardless of it's value, if the first property in a rule is target of this option, that property would be forced to not have an empty line before it.
694
694
 
@@ -3,13 +3,13 @@ let vendor = require('../vendor');
3
3
  const VALUE = '-1px -1px 1px rgba(0, 0, 0, 0.2) inset';
4
4
 
5
5
  it('returns prefix', () => {
6
- expect(vendor.prefix('-moz-color')).toEqual('-moz-');
7
- expect(vendor.prefix('color')).toEqual('');
8
- expect(vendor.prefix(VALUE)).toEqual('');
6
+ expect(vendor.prefix('-moz-color')).toBe('-moz-');
7
+ expect(vendor.prefix('color')).toBe('');
8
+ expect(vendor.prefix(VALUE)).toBe('');
9
9
  });
10
10
 
11
11
  it('returns unprefixed version', () => {
12
- expect(vendor.unprefixed('-moz-color')).toEqual('color');
13
- expect(vendor.unprefixed('color')).toEqual('color');
12
+ expect(vendor.unprefixed('-moz-color')).toBe('color');
13
+ expect(vendor.unprefixed('color')).toBe('color');
14
14
  expect(vendor.unprefixed(VALUE)).toEqual(VALUE);
15
15
  });
@@ -1,12 +1,6 @@
1
1
  module.exports = function getContainingNode(node) {
2
- // For styled-components declarations are children of Root node
3
- if (
4
- node.type !== 'rule' &&
5
- node.type !== 'atrule' &&
6
- node.parent.document &&
7
- node.parent.document.nodes &&
8
- node.parent.document.nodes.some((item) => item.type === 'root')
9
- ) {
2
+ // For styled-components: declarations are children of Root node
3
+ if (node.type !== 'rule' && node.type !== 'atrule' && node.parent.type === 'root') {
10
4
  return node.parent;
11
5
  }
12
6