Skip to content

chore: improve css import results; optimize precommit runs #5200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ jobs:

- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
allow-empty: true
11 changes: 8 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
STAGED_FILES_TO_LINT=$(git diff --name-only --cached --diff-filter=d -- "*.ts" "*.js")
STAGED_FILES_TO_ANALYZE=$(git diff --name-only --cached --diff-filter=d -- "{packages,tools}/*/src/**/!(*.css).ts")
STAGED_CSS_FILES=$(git diff --name-only --cached --diff-filter=d -- "{packages,tools}/**/*.css")
VERSION_FILE=$(dirname "$0")/../tools/base/src/version.js
yarn eslint -f pretty $STAGED_FILES_TO_LINT
yarn analyze
yarn lint:css

[[ -z "$STAGED_FILES_TO_LINT" ]] || yarn eslint -f pretty $STAGED_FILES_TO_LINT
[[ -z "$STAGED_FILES_TO_ANALYZE" ]] || yarn lit-analyzer $STAGED_FILES_TO_ANALYZE
[[ -z "$STAGED_CSS_FILES" ]] || yarn stylelint $STAGED_CSS_FILES

yarn pretty-quick --staged

yarn genversion --es6 --semi $VERSION_FILE
git add $VERSION_FILE
4 changes: 4 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ trailingComma: es5
bracketSpacing: true
arrowParens: always
htmlWhitespaceSensitivity: ignore
overrides:
- files: '{tools,packages}/*/src/spectrum-*.css'
options:
printWidth: 500
36 changes: 21 additions & 15 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
{
"plugins": ["stylelint-header"],
"extends": ["stylelint-config-standard"],
"extends": [],
"rules": {
"header/header": ["config/license.js", {}],
"length-zero-no-unit": [true, { "ignore": "custom-properties" }],
"selector-type-no-unknown": [true, { "ignore": ["custom-elements"] }],
"selector-pseudo-element-colon-notation": ["single", {}],
"custom-property-pattern": "^_?([a-z][a-z0-9]*)(-[a-z0-9]+)*$",
"no-duplicate-selectors": null,
"selector-class-pattern": null,
"no-descending-specificity": null,
"declaration-block-no-redundant-longhand-properties": null
"header/header": ["config/license.js", {}]
},
"overrides": [
{
"files": [
"packages/**/src/spectrum-*.css",
"tools/**/src/spectrum-*.css",
"tools/styles/**/*.css"
"!packages/**/src/spectrum-*.css",
"!tools/**/src/spectrum-*.css",
"!tools/styles/**/*.css"
],
"extends": [],
"extends": ["stylelint-config-standard"],
"rules": {
"header/header": ["config/license.js", {}]
"header/header": ["config/license.js", {}],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need header redefined in the overrides or does the global setting above cover that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should inherit but this was me just being safe

"length-zero-no-unit": [
true,
{ "ignore": "custom-properties" }
],
"selector-type-no-unknown": [
true,
{ "ignore": ["custom-elements"] }
],
"selector-pseudo-element-colon-notation": ["single", {}],
"custom-property-pattern": "^_?([a-z][a-z0-9]*)(-[a-z0-9]+)*$",
"no-duplicate-selectors": null,
"selector-class-pattern": null,
"no-descending-specificity": null,
"declaration-block-no-redundant-longhand-properties": null
}
}
]
Expand Down
12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@
"process-spectrum": "wireit",
"publish:react": "yarn changeset publish --no-git-tag --tag snapshot --no-push",
"push-to-remote": "git add . && git commit -m \"chore: release new versions #publish\" && git push",
"spectrum-css": "wireit",
"spectrum-tokens": "wireit",
"spectrum-vars": "wireit",
Comment on lines -69 to -71
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These commands don't exist in wireit and haven't for a long while - seems safe to remove the alias'es right?

"start": "yarn storybook",
"storybook": "wireit",
"storybook:build": "NODE_ENV=production storybook build -o projects/documentation/dist/storybook -c storybook",
Expand Down Expand Up @@ -97,9 +94,6 @@
"vrt:preview": "yarn wds --config test/visual/wds-vrt.config.js",
"vrt:quick-link": "yarn netlify deploy --alias=vrt --dir=projects/vrt-quick-link"
},
"peerDependencies": {
"common-tags": "^1.8.0"
},
Comment on lines -100 to -102
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implies consumers checking out the monorepo root would need to install common-tags locally for themselves in order to be able to build this project but I don't believe that is the case. Can we remove this? I don't think the monorepo root has any required peerDeps.

"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.5",
Expand Down Expand Up @@ -387,7 +381,7 @@
]
},
"process-spectrum": {
"command": "node ./scripts/spectrum-vars.js && node ./tasks/process-spectrum.js && node ./scripts/generate-tokens.js && yarn lint:css --fix && pretty-quick --pattern \"{packages,tools}/**/*.css\" && pretty-quick --pattern \"packages/dialog/src/spectrum-dialog.css\"",
"command": "node ./scripts/spectrum-vars.js && node ./tasks/process-spectrum.js && node ./scripts/generate-tokens.js && yarn lint:css --fix && pretty-quick --pattern \"{packages,tools}/**/*.css\"",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the additional pretty-quick run against spectrum-dialog because it's already included in the pattern for the previous pretty-quick run.

"files": [
"tasks/process-spectrum.js",
"packages/**/spectrum-config.js",
Expand All @@ -397,7 +391,9 @@
"scripts/generate-tokens-wrapper.js",
"node_modules/@spectrum-css/**/*.css",
"scripts/spectrum-vars.js",
"tools/styles/package.json"
"tools/styles/package.json",
".prettierrc.yaml",
".stylelintrc.json"
],
"output": [
"packages/*/src/spectrum-*.css",
Expand Down
Loading
Loading