@alexlit/config-stylelint 60.20.0 → 60.21.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/package.json +1 -1
  2. package/plugins/order.js +86 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexlit/config-stylelint",
3
- "version": "60.20.0",
3
+ "version": "60.21.0",
4
4
  "private": false,
5
5
  "description": "Stylelint config",
6
6
  "keywords": [
package/plugins/order.js CHANGED
@@ -1,9 +1,77 @@
1
1
  const LETTERS = 'abcdefghijklmnopqrstuvwxyz'.split('');
2
2
 
3
+ const MEDIA_FEATURES = [
4
+ '--laptop',
5
+ '--tablet',
6
+ '--mobile',
7
+
8
+ '--reduce-motion',
9
+
10
+ 'any-hover',
11
+ 'any-pointer',
12
+ 'aspect-ratio',
13
+ 'color',
14
+ 'color-gamut',
15
+ 'color-index',
16
+ 'device-aspect-ratio',
17
+ 'device-height',
18
+ 'device-width',
19
+ 'display-mode',
20
+ 'dynamic-range',
21
+ 'environment-blending',
22
+ 'forced-colors',
23
+ 'grid',
24
+ 'height',
25
+ 'horizontal-viewport-segments',
26
+ 'hover',
27
+ 'inverted-colors',
28
+ 'monochrome',
29
+ 'nav-controls',
30
+ 'orientation',
31
+ 'overflow-block',
32
+ 'overflow-inline',
33
+ 'pointer',
34
+ 'prefers-color-scheme',
35
+ 'prefers-contrast',
36
+ 'prefers-reduced-data',
37
+ 'prefers-reduced-motion',
38
+ 'prefers-reduced-transparency',
39
+ 'resolution',
40
+ 'scan',
41
+ 'scripting',
42
+ 'update',
43
+ 'vertical-viewport-segments',
44
+ 'video-color-gamut',
45
+ 'video-dynamic-range',
46
+ 'width',
47
+ ];
48
+
49
+ const AT_RULES = [
50
+ 'annotation',
51
+ 'character-variant',
52
+ 'container',
53
+ 'counter-style',
54
+ 'document',
55
+ 'font-face',
56
+ 'font-feature-values',
57
+ 'keyframes',
58
+ 'media',
59
+ 'ornaments',
60
+ 'page',
61
+ 'screen',
62
+ 'starting-style',
63
+ 'styleset',
64
+ 'stylistic',
65
+ 'supports',
66
+ 'swash',
67
+ 'view-transition',
68
+ 'viewport',
69
+ ];
70
+
3
71
  function buildAttributeRules() {
4
72
  return [
5
- ...LETTERS.map((l) => ({
6
- selector: new RegExp(String.raw`\[${l}`),
73
+ ...LETTERS.map((letter) => ({
74
+ selector: new RegExp(String.raw`\[${letter}`),
7
75
  type: 'rule',
8
76
  })),
9
77
  { selector: /\[/, type: 'rule' },
@@ -12,24 +80,32 @@ function buildAttributeRules() {
12
80
 
13
81
  function buildLetterRules(prefix) {
14
82
  return [
15
- ...LETTERS.map((l) => ({
16
- selector: new RegExp(`${prefix}${l}`),
83
+ ...LETTERS.map((letter) => ({
84
+ selector: new RegExp(`${prefix}${letter}`),
17
85
  type: 'rule',
18
86
  })),
19
87
  { selector: new RegExp(prefix), type: 'rule' },
20
88
  ];
21
89
  }
22
90
 
91
+ function buildMediaFeatureRules() {
92
+ return MEDIA_FEATURES.map((parameter) => ({
93
+ name: 'media',
94
+ parameter,
95
+ type: 'at-rule',
96
+ }));
97
+ }
98
+
23
99
  function buildPseudoClassRules() {
24
100
  return [
25
- ...LETTERS.map((l) => ({ selector: `:${l}`, type: 'rule' })),
101
+ ...LETTERS.map((letter) => ({ selector: `:${letter}`, type: 'rule' })),
26
102
  { selector: ':', type: 'rule' },
27
103
  ];
28
104
  }
29
105
 
30
106
  function buildPseudoElementRules() {
31
107
  return [
32
- ...LETTERS.map((l) => ({ selector: `::${l}`, type: 'rule' })),
108
+ ...LETTERS.map((letter) => ({ selector: `::${letter}`, type: 'rule' })),
33
109
  { selector: '::', type: 'rule' },
34
110
  ];
35
111
  }
@@ -65,7 +141,11 @@ export default {
65
141
  // Declarations
66
142
  'declarations',
67
143
 
144
+ // Media features
145
+ ...buildMediaFeatureRules(),
146
+
68
147
  // At-rules
148
+ ...AT_RULES.map((name) => ({ name, type: 'at-rule' })),
69
149
  'at-rules',
70
150
 
71
151
  // Pseudo-classes