Skip to content

Commit 1df6187

Browse files
[ci] add stylelint dependency and minimal config (#5926)
## Summary Adds [stylelint](https://stylelint.io/) configuration and tooling to enforce CSS/SCSS code quality and consistency across Vue components. Starts with 21 focused rules for linting CSS in Vue SFC files and standalone stylesheets. Configuration uses postcss-html to parse Vue `<style>` blocks and includes whitelists for Tailwind v4 at-rules (`@reference`, `@plugin`, `@custom-variant`, `@utility`) and Electron-specific CSS properties (`speak: none`, `app-region`). Rules emphasize modern CSS syntax (numeric font weights, modern color functions, double-colon pseudo-elements) while avoiding overly opinionated rules like hex color length enforcement (for now). Currently finds 113 issues (79% auto-fixable). This PR only adds the tooling via `pnpm stylelint` and `pnpm stylelint:fix` scripts - no pre-commit hooks or CI integration yet. A follow-up PR will auto-fix the fixable issues and optionally add enforcement to the commit workflow. ## Changes - **What**: Integrated [stylelint](https://stylelint.io/) with Vue.js support via postcss-html parser - **Dependencies**: Added `[email protected]`, `[email protected]` ## Review Focus CSS rule strictness and Tailwind CSS compatibility - particularly the `no-descending-specificity` rule and Tailwind-specific function ignores. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5926-ci-add-stylelint-dependency-and-minimal-config-2836d73d3650813ea7b7eb714ba7748a) by [Unito](https://www.unito.io)
1 parent c636900 commit 1df6187

File tree

5 files changed

+536
-0
lines changed

5 files changed

+536
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ yarn.lock
1515
# Cache files
1616
.eslintcache
1717
.prettiercache
18+
.stylelintcache
1819

1920
node_modules
2021
dist

.stylelintrc.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"extends": [],
3+
"overrides": [
4+
{
5+
"files": ["*.vue", "**/*.vue"],
6+
"customSyntax": "postcss-html"
7+
}
8+
],
9+
"rules": {
10+
"import-notation": "url",
11+
"font-family-no-missing-generic-family-keyword": true,
12+
"declaration-block-no-redundant-longhand-properties": true,
13+
"declaration-property-value-no-unknown": [
14+
true,
15+
{
16+
"ignoreProperties": {
17+
"speak": ["none"],
18+
"app-region": ["drag", "no-drag"]
19+
}
20+
}
21+
],
22+
"color-function-notation": "modern",
23+
"shorthand-property-no-redundant-values": true,
24+
"selector-pseudo-element-colon-notation": "double",
25+
"no-duplicate-selectors": true,
26+
"font-weight-notation": "numeric",
27+
"length-zero-no-unit": true,
28+
"color-no-invalid-hex": true,
29+
"number-max-precision": 4,
30+
"property-no-vendor-prefix": true,
31+
"value-no-vendor-prefix": true,
32+
"selector-no-vendor-prefix": true,
33+
"media-feature-name-no-vendor-prefix": true,
34+
"selector-max-universal": 1,
35+
"selector-max-type": 2,
36+
"declaration-block-no-duplicate-properties": true,
37+
"block-no-empty": true,
38+
"no-descending-specificity": true,
39+
"no-duplicate-at-import-rules": true,
40+
"at-rule-no-unknown": [
41+
true,
42+
{
43+
"ignoreAtRules": [
44+
"tailwind",
45+
"apply",
46+
"layer",
47+
"config",
48+
"theme",
49+
"reference",
50+
"plugin",
51+
"custom-variant",
52+
"utility"
53+
]
54+
}
55+
],
56+
"function-no-unknown": [
57+
true,
58+
{
59+
"ignoreFunctions": [
60+
"theme"
61+
]
62+
}
63+
]
64+
},
65+
"ignoreFiles": [
66+
"node_modules/**",
67+
"dist/**",
68+
"playwright-report/**",
69+
"public/**",
70+
"src/lib/litegraph/**"
71+
],
72+
"files": ["**/*.css", "**/*.vue"]
73+
}

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
"prepare": "husky || true && git config blame.ignoreRevsFile .git-blame-ignore-revs || true",
3636
"preview": "nx preview",
3737
"storybook": "nx storybook -p 6006",
38+
"stylelint:fix": "stylelint --cache --fix",
39+
"stylelint": "stylelint --cache",
3840
"test:browser": "pnpm exec nx e2e",
3941
"test:unit": "nx run test",
4042
"typecheck": "vue-tsc --noEmit",
@@ -79,8 +81,10 @@
7981
"knip": "catalog:",
8082
"lint-staged": "catalog:",
8183
"nx": "catalog:",
84+
"postcss-html": "catalog:",
8285
"prettier": "catalog:",
8386
"storybook": "catalog:",
87+
"stylelint": "catalog:",
8488
"tailwindcss": "catalog:",
8589
"tailwindcss-primeui": "catalog:",
8690
"tsx": "catalog:",

0 commit comments

Comments
 (0)