Skip to content

Commit d4987bf

Browse files
authored
feat(lint): add stylelint for LESS and normalize whitespaces
Like #2501, but for LESS. No functionality change.
1 parent e589cd1 commit d4987bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+24247
-23845
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports = {
1010
sourceType: 'module',
1111
},
1212
ignorePatterns: [
13+
'!.*',
1314
'/dist',
1415
'/examples/assets/library',
1516
'/test/coverage',

.stylelintrc.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
module.exports = {
2+
extends: [
3+
'stylelint-config-standard',
4+
],
5+
customSyntax: 'postcss-less',
6+
ignoreFiles: [
7+
'dist/**',
8+
'test/coverage/**',
9+
],
10+
rules: {
11+
indentation: 4,
12+
'at-rule-empty-line-before': null,
13+
'block-closing-brace-newline-before': null,
14+
'declaration-block-trailing-semicolon': null, // bad formatting with "each()"
15+
'declaration-empty-line-before': null,
16+
'max-line-length': null,
17+
'rule-empty-line-before': null,
18+
19+
// TODO
20+
'no-descending-specificity': null, // 11532 errors
21+
'property-case': null, // 338 errors
22+
'string-quotes': null, // 249 errors
23+
'no-duplicate-selectors': null, // 212 errors
24+
'selector-not-notation': null, // 169 errors
25+
'no-invalid-position-at-import-rule': null, // 104 errors
26+
'at-rule-no-unknown': null, // 104 errors
27+
'import-notation': null, // 55 errors
28+
'function-no-unknown': null, // 43 errors
29+
'property-no-vendor-prefix': null, // 31 errors
30+
'selector-no-vendor-prefix': null, // 19 errors
31+
'number-leading-zero': null, // 19 errors
32+
'declaration-block-no-redundant-longhand-properties': null, // 12 errors
33+
'value-keyword-case': null, // 11 errors
34+
'value-no-vendor-prefix': null, // 9 errors
35+
'keyframes-name-pattern': null, // 9 errors
36+
'color-function-notation': null, // 8 errors
37+
'alpha-value-notation': null, // 8 errors
38+
'selector-attribute-quotes': null, // 7 errors
39+
'number-no-trailing-zeros': null, // 6 errors
40+
'shorthand-property-no-redundant-values': null, // 5 errors
41+
'declaration-block-no-duplicate-properties': null, // 2 errors
42+
'number-max-precision': null, // 2 errors
43+
'color-hex-case': null, // 1 error
44+
'color-hex-length': null, // 1 error
45+
},
46+
};

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"scripts": {
2727
"build": "gulp build",
2828
"changelog": "auto-changelog -p",
29-
"lint": "eslint -c .eslintrc.js --ext .js .",
30-
"lint-fix": "eslint -c .eslintrc.js --ext .js . --fix"
29+
"lint": "eslint --ext .js . && stylelint \"**/*.{css,less}\"",
30+
"lint-fix": "eslint --ext .js . --fix && stylelint \"**/*.{css,less}\" --fix"
3131
},
3232
"dependencies": {
3333
"@actions/core": "^1.6.0",
@@ -77,7 +77,11 @@
7777
"auto-changelog": "^2.4.0",
7878
"eslint": "^8.28.0",
7979
"node-fetch": "^2.6.0",
80-
"semver": "^7.3.5"
80+
"postcss": "^8.4.19",
81+
"postcss-less": "^6.0.0",
82+
"semver": "^7.3.5",
83+
"stylelint": "^14.16.0",
84+
"stylelint-config-standard": "^29.0.0"
8185
},
8286
"engines": {
8387
"node": ">=12",

src/definitions/collections/breadcrumb.less

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,26 @@
1212
Theme
1313
*******************************/
1414

15-
@type : 'collection';
15+
@type : 'collection';
1616
@element : 'breadcrumb';
1717

1818
@import (multiple) '../../theme.config';
1919

20-
2120
/*******************************
2221
Breadcrumb
2322
*******************************/
2423

2524
.ui.breadcrumb {
26-
line-height: @lineHeight;
27-
display: @display;
28-
margin: @verticalMargin 0;
29-
vertical-align: @verticalAlign;
25+
line-height: @lineHeight;
26+
display: @display;
27+
margin: @verticalMargin 0;
28+
vertical-align: @verticalAlign;
3029
}
3130
.ui.breadcrumb:first-child {
32-
margin-top: 0;
31+
margin-top: 0;
3332
}
3433
.ui.breadcrumb:last-child {
35-
margin-bottom: 0;
34+
margin-bottom: 0;
3635
}
3736

3837
/*******************************
@@ -41,82 +40,80 @@
4140

4241
/* Divider */
4342
.ui.breadcrumb .divider {
44-
display: inline-block;
45-
opacity: @dividerOpacity;
46-
margin: 0 @dividerSpacing 0;
43+
display: inline-block;
44+
opacity: @dividerOpacity;
45+
margin: 0 @dividerSpacing 0;
4746

48-
font-size: @dividerSize;
49-
color: @dividerColor;
50-
vertical-align: @dividerVerticalAlign;
47+
font-size: @dividerSize;
48+
color: @dividerColor;
49+
vertical-align: @dividerVerticalAlign;
5150
}
5251

5352
/* Link */
5453
.ui.breadcrumb a {
55-
color: @linkColor;
54+
color: @linkColor;
5655
}
5756
.ui.breadcrumb a:hover {
58-
color: @linkHoverColor;
57+
color: @linkHoverColor;
5958
}
6059

61-
6260
/* Icon Divider */
6361
.ui.breadcrumb .icon.divider {
64-
font-size: @iconDividerSize;
65-
vertical-align: @iconDividerVerticalAlign;
62+
font-size: @iconDividerSize;
63+
vertical-align: @iconDividerVerticalAlign;
6664
}
6765

6866
/* Section */
6967
.ui.breadcrumb a.section {
70-
cursor: pointer;
68+
cursor: pointer;
7169
}
7270
.ui.breadcrumb .section {
73-
display: inline-block;
74-
margin: @sectionMargin;
75-
padding: @sectionPadding;
71+
display: inline-block;
72+
margin: @sectionMargin;
73+
padding: @sectionPadding;
7674
}
7775

7876
/* Loose Coupling */
7977
.ui.breadcrumb.segment {
80-
display: inline-block;
81-
padding: @segmentPadding;
78+
display: inline-block;
79+
padding: @segmentPadding;
8280
}
8381

8482
& when (@variationBreadcrumbInverted) {
85-
/* Inverted */
86-
.ui.inverted.breadcrumb {
87-
color: @invertedColor;
88-
}
89-
.ui.inverted.breadcrumb > .active.section {
90-
color: @invertedActiveColor;
91-
}
92-
.ui.inverted.breadcrumb > .divider {
93-
color: @invertedDividerColor;
94-
}
83+
/* Inverted */
84+
.ui.inverted.breadcrumb {
85+
color: @invertedColor;
86+
}
87+
.ui.inverted.breadcrumb > .active.section {
88+
color: @invertedActiveColor;
89+
}
90+
.ui.inverted.breadcrumb > .divider {
91+
color: @invertedDividerColor;
92+
}
9593
}
9694

9795
/*******************************
9896
States
9997
*******************************/
10098

10199
.ui.breadcrumb .active.section {
102-
font-weight: @activeFontWeight;
100+
font-weight: @activeFontWeight;
103101
}
104102

105-
106103
/*******************************
107104
Variations
108105
*******************************/
109106

110107
.ui.breadcrumb {
111-
font-size: @medium;
108+
font-size: @medium;
112109
}
113110
& when not (@variationBreadcrumbSizes = false) {
114-
each(@variationBreadcrumbSizes, {
115-
@s: @@value;
116-
.ui.@{value}.breadcrumb {
117-
font-size: @s;
118-
}
119-
})
111+
each(@variationBreadcrumbSizes, {
112+
@s: @@value;
113+
.ui.@{value}.breadcrumb {
114+
font-size: @s;
115+
}
116+
})
120117
}
121118

122119
.loadUIOverrides();

0 commit comments

Comments
 (0)