Skip to content

Commit 39828ad

Browse files
committed
feat: add stylelint configuration and update package.json for CSS linting
Refs: #7537
1 parent ba12c49 commit 39828ad

File tree

14 files changed

+601
-7
lines changed

14 files changed

+601
-7
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@
3737
"javascript.updateImportsOnFileMove.enabled": "always",
3838
"typescript.preferences.importModuleSpecifier": "relative",
3939
"typescript.updateImportsOnFileMove.enabled": "always",
40-
"html.customData": ["./node_modules/@public-ui/components/vscode-custom-data.json"]
40+
"html.customData": ["./node_modules/@public-ui/components/vscode-custom-data.json"],
41+
"stylelint.validate": ["css", "scss", "sass", "less"]
4142
}

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
"clean:pnpm": "pnpm -r exec rimraf pnpm-lock.yaml && rimraf pnpm-lock.yaml && pnpm clean",
2828
"format": "pnpm -r format",
2929
"lint": "pnpm -r lint",
30+
"lint:eslint": "pnpm -r --no-bail lint:eslint",
31+
"lint:stylelint": "pnpm -r --no-bail lint:stylelint",
32+
"lint:tsc": "pnpm -r --no-bail lint:tsc",
3033
"lint-staged": "lint-staged",
3134
"unused": "pnpm -r unused",
3235
"ts-prune": "git clean -f -d -X packages/adapters/**/src && pnpm -r exec npx ts-prune src -e",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/assets/
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"extends": ["stylelint-config-standard", "stylelint-config-recommended-scss"],
3+
"plugins": ["stylelint-scss"],
4+
"rules": {
5+
"block-no-empty": true,
6+
"color-no-invalid-hex": true,
7+
"custom-property-pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*(?:--[a-z0-9]+(?:-[a-z0-9]+)*)*$",
8+
"declaration-block-no-duplicate-properties": true,
9+
"declaration-property-value-no-unknown": null,
10+
"no-duplicate-selectors": true,
11+
"selector-class-pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*(?:__(?:[a-z0-9]+(?:-[a-z0-9]+)*))?(?:--(?:[a-z0-9]+(?:-[a-z0-9]+)*))?$",
12+
13+
"scss/load-no-partial-leading-underscore": true,
14+
"scss/at-mixin-pattern": "^[a-z][a-z0-9-]*$",
15+
"scss/dollar-variable-pattern": "^[a-z][a-z0-9-]*$",
16+
17+
"comment-empty-line-before": null,
18+
"declaration-empty-line-before": null,
19+
"selector-pseudo-element-colon-notation": null,
20+
"color-function-notation": null,
21+
"alpha-value-notation": null,
22+
"value-keyword-case": null,
23+
"property-no-vendor-prefix": null,
24+
"rule-empty-line-before": null,
25+
"at-rule-empty-line-before": null,
26+
"media-feature-range-notation": null,
27+
"declaration-block-no-redundant-longhand-properties": null,
28+
"shorthand-property-no-redundant-values": null,
29+
"comment-whitespace-inside": null,
30+
"declaration-property-value-keyword-no-deprecated": null,
31+
"declaration-block-no-duplicate-properties": null,
32+
"no-descending-specificity": null,
33+
"no-duplicate-selectors": null,
34+
"font-family-no-missing-generic-family-keyword": null,
35+
"keyframes-name-pattern": null,
36+
"declaration-block-no-shorthand-property-overrides": null,
37+
"color-hex-length": null,
38+
"custom-property-empty-line-before": null,
39+
"scss/at-mixin-pattern": null,
40+
"scss/dollar-variable-pattern": null
41+
}
42+
}

packages/components/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@
6060
"clear": "rimraf -g dist doc loader www ../adapters/angular/v15/src ../adapters/angular/v16/src ../adapters/angular/v17/src ../adapters/angular/v18/src ../adapters/hydrate/dist ../adapters/react/src ../adapters/solid/src ../adapters/vaadin/*.java ../adapters/vue/src",
6161
"format": "prettier --check src",
6262
"lighthouse": "lighthouse --chrome-flags=\"--headless\" --output-path lighthouse.report.html --preset=desktop --quiet",
63-
"lint": "tsc --noemit && eslint src",
63+
"lint": "pnpm lint:eslint && pnpm lint:stylelint && pnpm lint:tsc",
64+
"lint:eslint": "eslint src",
65+
"lint:stylelint": "stylelint \"src/**/*.{css,scss}\"",
66+
"lint:tsc": "tsc --noemit",
6467
"dev": "cross-env NODE_ENV=development stencil build --prod --watch",
6568
"test": "pnpm test:unit",
6669
"test:unit": "cross-env NODE_ENV=test stencil test --spec --json --outputFile dist/jest-test-results.json",
@@ -123,6 +126,10 @@
123126
"pug": "3.0.3",
124127
"rimraf": "6.0.1",
125128
"stencil-awesome-test": "1.0.6",
129+
"stylelint": "16.17.0",
130+
"stylelint-config-recommended-scss": "14.1.0",
131+
"stylelint-config-standard": "37.0.0",
132+
"stylelint-scss": "6.11.1",
126133
"terser": "5.39.0",
127134
"twig": "1.17.1",
128135
"typescript": "5.8.2"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"extends": ["stylelint-config-standard", "stylelint-config-recommended-scss"],
3+
"plugins": ["stylelint-scss"],
4+
"rules": {
5+
"block-no-empty": true,
6+
"color-no-invalid-hex": true,
7+
"custom-property-pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*(?:--[a-z0-9]+(?:-[a-z0-9]+)*)*$",
8+
"declaration-block-no-duplicate-properties": true,
9+
"declaration-property-value-no-unknown": null,
10+
"no-duplicate-selectors": true,
11+
"selector-class-pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*(?:__(?:[a-z0-9]+(?:-[a-z0-9]+)*))?(?:--(?:[a-z0-9]+(?:-[a-z0-9]+)*))?$",
12+
13+
"scss/load-no-partial-leading-underscore": true,
14+
"scss/at-mixin-pattern": "^[a-z][a-z0-9-]*$",
15+
"scss/dollar-variable-pattern": "^[a-z][a-z0-9-]*$",
16+
17+
"comment-empty-line-before": null,
18+
"declaration-empty-line-before": null,
19+
"selector-pseudo-element-colon-notation": null,
20+
"color-function-notation": null,
21+
"alpha-value-notation": null,
22+
"value-keyword-case": null,
23+
"property-no-vendor-prefix": null,
24+
"rule-empty-line-before": null,
25+
"at-rule-empty-line-before": null,
26+
"media-feature-range-notation": null,
27+
"declaration-block-no-redundant-longhand-properties": null,
28+
"shorthand-property-no-redundant-values": null,
29+
"comment-whitespace-inside": null,
30+
"declaration-property-value-keyword-no-deprecated": null,
31+
"declaration-block-no-duplicate-properties": null,
32+
"no-descending-specificity": null,
33+
"no-duplicate-selectors": null,
34+
"font-family-no-missing-generic-family-keyword": null,
35+
"keyframes-name-pattern": null,
36+
"declaration-block-no-shorthand-property-overrides": null,
37+
"color-hex-length": null,
38+
"custom-property-empty-line-before": null,
39+
"scss/at-mixin-pattern": null,
40+
"scss/dollar-variable-pattern": null
41+
}
42+
}

packages/samples/react/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
"build": "rimraf dist && cross-env NODE_ENV=production webpack",
1313
"build:deps": "pnpm --filter @public-ui/sample-react^... build",
1414
"format": "prettier --check src",
15-
"lint": "tsc --noemit && eslint \"{src,tests,e2e}/**/*.{html,js,json,jsx,ts,tsx,gql,graphql}\"",
15+
"lint": "pnpm lint:eslint && pnpm lint:stylelint && pnpm lint:tsc",
16+
"lint:eslint": "eslint src",
17+
"lint:stylelint": "stylelint \"src/**/*.{css,scss}\"",
18+
"lint:tsc": "tsc --noemit",
1619
"postinstall": "pnpm exec playwright install",
1720
"prepare": "npm-run-all prepare:*",
1821
"prepare:components-assets": "cpy \"node_modules/@public-ui/components/assets/**/*\" public/assets --dot",
@@ -68,6 +71,10 @@
6871
"rimraf": "6.0.1",
6972
"sass-loader": "16.0.5",
7073
"string-replace-loader": "3.1.0",
74+
"stylelint": "16.17.0",
75+
"stylelint-config-recommended-scss": "14.1.0",
76+
"stylelint-config-standard": "37.0.0",
77+
"stylelint-scss": "6.11.1",
7178
"tslib": "2.8.1",
7279
"typescript": "5.8.2",
7380
"webpack": "5.98.0",
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"extends": ["stylelint-config-standard", "stylelint-config-recommended-scss"],
3+
"plugins": ["stylelint-scss"],
4+
"rules": {
5+
"block-no-empty": true,
6+
"color-no-invalid-hex": true,
7+
"custom-property-pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*(?:--[a-z0-9]+(?:-[a-z0-9]+)*)*$",
8+
"declaration-block-no-duplicate-properties": true,
9+
"declaration-property-value-no-unknown": null,
10+
"no-duplicate-selectors": true,
11+
"selector-class-pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*(?:__(?:[a-z0-9]+(?:-[a-z0-9]+)*))?(?:--(?:[a-z0-9]+(?:-[a-z0-9]+)*))?$",
12+
13+
"scss/load-no-partial-leading-underscore": true,
14+
"scss/at-mixin-pattern": "^[a-z][a-z0-9-]*$",
15+
"scss/dollar-variable-pattern": "^[a-z][a-z0-9-]*$",
16+
17+
"comment-empty-line-before": null,
18+
"declaration-empty-line-before": null,
19+
"selector-pseudo-element-colon-notation": null,
20+
"color-function-notation": null,
21+
"alpha-value-notation": null,
22+
"value-keyword-case": null,
23+
"property-no-vendor-prefix": null,
24+
"rule-empty-line-before": null,
25+
"at-rule-empty-line-before": null,
26+
"media-feature-range-notation": null,
27+
"declaration-block-no-redundant-longhand-properties": null,
28+
"shorthand-property-no-redundant-values": null,
29+
"comment-whitespace-inside": null,
30+
"declaration-property-value-keyword-no-deprecated": null,
31+
"declaration-block-no-duplicate-properties": null,
32+
"no-descending-specificity": null,
33+
"no-duplicate-selectors": null,
34+
"font-family-no-missing-generic-family-keyword": null,
35+
"keyframes-name-pattern": null,
36+
"declaration-block-no-shorthand-property-overrides": null,
37+
"color-hex-length": null,
38+
"custom-property-empty-line-before": null,
39+
"scss/at-mixin-pattern": null,
40+
"scss/dollar-variable-pattern": null
41+
}
42+
}

packages/themes/default/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
"build": "rollup -c",
4747
"dev": "rollup -c --watch",
4848
"format": "prettier --check src",
49-
"lint": "tsc --noemit && eslint src",
49+
"lint": "pnpm lint:eslint && pnpm lint:stylelint && pnpm lint:tsc",
50+
"lint:eslint": "eslint src",
51+
"lint:stylelint": "stylelint \"src/**/*.{css,scss}\"",
52+
"lint:tsc": "tsc --noemit",
5053
"prepare": "cpy \"node_modules/@public-ui/components/assets/**/*\" assets --dot",
5154
"start": "npm-run-all --parallel dev serve",
5255
"serve": "sh serve.sh DEFAULT",
@@ -71,6 +74,10 @@
7174
"rollup": "4.36.0",
7275
"rollup-plugin-postcss": "4.0.2",
7376
"sass": "1.86.0",
77+
"stylelint": "16.17.0",
78+
"stylelint-config-recommended-scss": "14.1.0",
79+
"stylelint-config-standard": "37.0.0",
80+
"stylelint-scss": "6.11.1",
7481
"typescript": "5.8.2",
7582
"unbuild": "1.2.1"
7683
},
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"extends": ["stylelint-config-standard", "stylelint-config-recommended-scss"],
3+
"plugins": ["stylelint-scss"],
4+
"rules": {
5+
"block-no-empty": true,
6+
"color-no-invalid-hex": true,
7+
"custom-property-pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*(?:--[a-z0-9]+(?:-[a-z0-9]+)*)*$",
8+
"declaration-block-no-duplicate-properties": true,
9+
"declaration-property-value-no-unknown": null,
10+
"no-duplicate-selectors": true,
11+
"selector-class-pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*(?:__(?:[a-z0-9]+(?:-[a-z0-9]+)*))?(?:--(?:[a-z0-9]+(?:-[a-z0-9]+)*))?$",
12+
13+
"scss/load-no-partial-leading-underscore": true,
14+
"scss/at-mixin-pattern": "^[a-z][a-z0-9-]*$",
15+
"scss/dollar-variable-pattern": "^[a-z][a-z0-9-]*$",
16+
17+
"comment-empty-line-before": null,
18+
"declaration-empty-line-before": null,
19+
"selector-pseudo-element-colon-notation": null,
20+
"color-function-notation": null,
21+
"alpha-value-notation": null,
22+
"value-keyword-case": null,
23+
"property-no-vendor-prefix": null,
24+
"rule-empty-line-before": null,
25+
"at-rule-empty-line-before": null,
26+
"media-feature-range-notation": null,
27+
"declaration-block-no-redundant-longhand-properties": null,
28+
"shorthand-property-no-redundant-values": null,
29+
"comment-whitespace-inside": null,
30+
"declaration-property-value-keyword-no-deprecated": null,
31+
"declaration-block-no-duplicate-properties": null,
32+
"no-descending-specificity": null,
33+
"no-duplicate-selectors": null,
34+
"font-family-no-missing-generic-family-keyword": null,
35+
"keyframes-name-pattern": null,
36+
"declaration-block-no-shorthand-property-overrides": null,
37+
"color-hex-length": null,
38+
"custom-property-empty-line-before": null,
39+
"scss/at-mixin-pattern": null,
40+
"scss/dollar-variable-pattern": null
41+
}
42+
}

0 commit comments

Comments
 (0)