@readme/stylelint-config 3.2.1 → 3.2.2
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/CHANGELOG.md +11 -0
- package/__tests__/__snapshots__/index.js.snap +7 -4
- package/__tests__/index.js +20 -1
- package/__tests__/invalid.scss +26 -19
- package/__tests__/valid.scss +8 -0
- package/package.json +2 -2
- package/src/index.js +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.2.2](https://github.com/readmeio/standards/compare/@readme/stylelint-config@3.2.1...@readme/stylelint-config@3.2.2) (2023-07-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **stylelint-config:** disable media-query-no-invalid rule ([#700](https://github.com/readmeio/standards/issues/700)) ([c6cfebd](https://github.com/readmeio/standards/commit/c6cfebdacf63b5f8cc73ee06d79dcac8a66d945c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [3.2.1](https://github.com/readmeio/standards/compare/@readme/stylelint-config@3.2.0...@readme/stylelint-config@3.2.1) (2023-07-05)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @readme/stylelint-config
|
|
@@ -4,6 +4,9 @@ exports[`stylelint-config with an invalid file and auto-fix enabled matches the
|
|
|
4
4
|
"@import "x.css";
|
|
5
5
|
@import "y.css";
|
|
6
6
|
|
|
7
|
+
$one: "one";
|
|
8
|
+
$twoCamelCase: "two";
|
|
9
|
+
|
|
7
10
|
/**
|
|
8
11
|
* Multi-line comment
|
|
9
12
|
*/
|
|
@@ -33,8 +36,8 @@ exports[`stylelint-config with an invalid file and auto-fix enabled matches the
|
|
|
33
36
|
.selector-3[type="text"] {
|
|
34
37
|
background: linear-gradient(#fff, rgb(0 0 0 / 0.8));
|
|
35
38
|
box-sizing: border-box;
|
|
36
|
-
display: block;
|
|
37
39
|
color: var(--brand-red);
|
|
40
|
+
display: block;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
.selector-a,
|
|
@@ -81,16 +84,16 @@ exports[`stylelint-config with an invalid file and auto-fix enabled matches the
|
|
|
81
84
|
#fff 25px,
|
|
82
85
|
rgb(255 255 255 / 1) 50px
|
|
83
86
|
);
|
|
84
|
-
margin: 10px;
|
|
85
|
-
margin-bottom: 5px;
|
|
86
87
|
box-shadow: 0 1px 1px #000, 0 1px 0 #fff, 2px 2px 1px 1px #ccc inset;
|
|
87
88
|
height: 10rem;
|
|
89
|
+
margin: 10px;
|
|
90
|
+
margin-bottom: 5px;
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
/* Flush nested single line comment */
|
|
91
94
|
.selector::after {
|
|
92
|
-
content: "→";
|
|
93
95
|
background-image: url("x.svg");
|
|
96
|
+
content: "→";
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
99
|
|
package/__tests__/index.js
CHANGED
|
@@ -48,7 +48,26 @@ describe('stylelint-config', () => {
|
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
it('flags warnings', () => {
|
|
51
|
-
expect(warnings).
|
|
51
|
+
expect(warnings).toContainEqual(
|
|
52
|
+
expect.objectContaining({
|
|
53
|
+
text: expect.stringMatching(/scss\/dollar-variable-pattern/),
|
|
54
|
+
})
|
|
55
|
+
);
|
|
56
|
+
expect(warnings).toContainEqual(
|
|
57
|
+
expect.objectContaining({
|
|
58
|
+
text: expect.stringMatching(/color-function-notation/),
|
|
59
|
+
})
|
|
60
|
+
);
|
|
61
|
+
expect(warnings).toContainEqual(
|
|
62
|
+
expect.objectContaining({
|
|
63
|
+
text: expect.stringMatching(/selector-id-pattern/),
|
|
64
|
+
})
|
|
65
|
+
);
|
|
66
|
+
expect(warnings).toContainEqual(
|
|
67
|
+
expect.objectContaining({
|
|
68
|
+
text: expect.stringMatching(/selector-max-id/),
|
|
69
|
+
})
|
|
70
|
+
);
|
|
52
71
|
});
|
|
53
72
|
|
|
54
73
|
it('expects no more than 1 id selector', () => {
|
package/__tests__/invalid.scss
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
@import url("x.css");
|
|
2
2
|
@import url("y.css");
|
|
3
3
|
|
|
4
|
+
$one: "one";
|
|
5
|
+
$twoCamelCase: "two";
|
|
6
|
+
|
|
4
7
|
/**
|
|
5
8
|
* Multi-line comment
|
|
6
9
|
*/
|
|
@@ -40,9 +43,15 @@
|
|
|
40
43
|
top: calc(100% - 2rem);
|
|
41
44
|
}
|
|
42
45
|
|
|
43
|
-
.selector-x {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
.selector-x {
|
|
47
|
+
width: 10%;
|
|
48
|
+
}
|
|
49
|
+
.selector-y {
|
|
50
|
+
width: 20%;
|
|
51
|
+
}
|
|
52
|
+
.selector-z {
|
|
53
|
+
width: 30%;
|
|
54
|
+
}
|
|
46
55
|
|
|
47
56
|
/* Single-line comment */
|
|
48
57
|
|
|
@@ -61,24 +70,18 @@
|
|
|
61
70
|
}
|
|
62
71
|
|
|
63
72
|
/* Flush single line comment */
|
|
64
|
-
@media
|
|
65
|
-
screen and (min-resolution: 192dpi),
|
|
66
|
-
screen and (min-resolution: 2dppx) {
|
|
73
|
+
@media screen and (min-resolution: 192dpi), screen and (min-resolution: 2dppx) {
|
|
67
74
|
.selector {
|
|
68
75
|
animation: 3s none fade-in;
|
|
69
|
-
background-image:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
);
|
|
76
|
+
background-image: repeating-linear-gradient(
|
|
77
|
+
-45deg,
|
|
78
|
+
transparent,
|
|
79
|
+
#fff 25px,
|
|
80
|
+
rgb(255 255 255 / 100%) 50px
|
|
81
|
+
);
|
|
76
82
|
margin: 10px;
|
|
77
83
|
margin-bottom: 5px;
|
|
78
|
-
box-shadow:
|
|
79
|
-
0 1px 1px #000,
|
|
80
|
-
0 1px 0 #fff,
|
|
81
|
-
2px 2px 1px 1px #ccc inset;
|
|
84
|
+
box-shadow: 0 1px 1px #000, 0 1px 0 #fff, 2px 2px 1px 1px #ccc inset;
|
|
82
85
|
height: 10rem;
|
|
83
86
|
}
|
|
84
87
|
|
|
@@ -90,8 +93,12 @@
|
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
@keyframes fade-in {
|
|
93
|
-
from {
|
|
94
|
-
|
|
96
|
+
from {
|
|
97
|
+
opacity: 0;
|
|
98
|
+
}
|
|
99
|
+
to {
|
|
100
|
+
opacity: 1;
|
|
101
|
+
}
|
|
95
102
|
}
|
|
96
103
|
|
|
97
104
|
// Prefer "simple" selector-not-notation
|
package/__tests__/valid.scss
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
@import "x.css";
|
|
2
2
|
@import "y.css";
|
|
3
3
|
|
|
4
|
+
$one: "one";
|
|
5
|
+
$two-kebab-case: "two";
|
|
6
|
+
$media-query-width: 300px;
|
|
7
|
+
|
|
4
8
|
/**
|
|
5
9
|
* Multi-line comment
|
|
6
10
|
*/
|
|
@@ -46,6 +50,10 @@
|
|
|
46
50
|
|
|
47
51
|
/* Single-line comment */
|
|
48
52
|
|
|
53
|
+
@media (min-width: $media-query-width) {
|
|
54
|
+
border: 1px solid black;
|
|
55
|
+
}
|
|
56
|
+
|
|
49
57
|
@media (width >= 60em) {
|
|
50
58
|
.selector {
|
|
51
59
|
/* Flush to parent comment */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@readme/stylelint-config",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "ReadMe coding standards for styles",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"@readme/eslint-config": "^10.6.2",
|
|
34
34
|
"jest": "^29.4.3"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "c6355d9f0a28ebc9a9e739d9718a91e27d7ed256"
|
|
37
37
|
}
|
package/src/index.js
CHANGED
|
@@ -59,6 +59,11 @@ module.exports = {
|
|
|
59
59
|
// https://stylelint.io/user-guide/rules/media-feature-range-notation/
|
|
60
60
|
'media-feature-range-notation': null,
|
|
61
61
|
|
|
62
|
+
// Rule is not appropriate when using SCSS variables with media queries.
|
|
63
|
+
// e.g. @media (max-width: $container-lg)
|
|
64
|
+
// https://stylelint.io/user-guide/rules/media-query-no-invalid/
|
|
65
|
+
'media-query-no-invalid': null,
|
|
66
|
+
|
|
62
67
|
// Allows us to write duplicate selectors in groups
|
|
63
68
|
// https://github.com/stylelint/stylelint/issues/3196
|
|
64
69
|
'no-descending-specificity': [
|
|
@@ -130,7 +135,7 @@ module.exports = {
|
|
|
130
135
|
'selector-id-pattern': [
|
|
131
136
|
'^(([a-z][a-z0-9]*(-[a-z0-9]+)*)|([A-Z][a-z0-9]*)+)$',
|
|
132
137
|
{
|
|
133
|
-
message: 'Expected id selector to be kebab-case or TitleCase',
|
|
138
|
+
message: 'Expected id selector to be kebab-case or TitleCase (selector-id-pattern)',
|
|
134
139
|
},
|
|
135
140
|
],
|
|
136
141
|
|