-
Notifications
You must be signed in to change notification settings - Fork 222
tooling: update pre-commit hook to stop failure propagation of no-import rule of missing dependencies #5430
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
base: main
Are you sure you want to change the base?
Changes from 7 commits
bfb90e5
e9f8531
c2a4e4a
9e4d9f0
e6264c1
038564f
109fb02
7757a68
0e15bbc
5902583
f32711d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@spectrum-web-components/icon': minor | ||
--- | ||
|
||
fix: added missing reactive controller dependency for IconBase which was importing SystemContextResolution for context switching |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
#!/usr/bin/env bash | ||
bash << EOF | ||
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 | ||
#!/bin/bash | ||
set -e | ||
|
||
[ -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 | ||
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/*/src/**/*.ts tools/*/src/**/*.ts) | ||
STAGED_CSS_FILES=$(git diff --name-only --cached --diff-filter=d -- 'packages/**/*.css' 'tools/**/*.css') | ||
VERSION_FILE=$(dirname "$0")/../tools/base/src/version.js | ||
|
||
yarn pretty-quick --staged | ||
[ -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 genversion --es6 --semi $VERSION_FILE | ||
git add $VERSION_FILE | ||
EOF | ||
yarn pretty-quick --staged | ||
|
||
yarn genversion --es6 --semi "$VERSION_FILE" | ||
git add "$VERSION_FILE" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,8 @@ | |
], | ||
"dependencies": { | ||
"@spectrum-web-components/base": "1.6.0", | ||
"@spectrum-web-components/iconset": "1.6.0" | ||
"@spectrum-web-components/iconset": "1.6.0", | ||
"@spectrum-web-components/reactive-controllers": "1.6.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch here |
||
}, | ||
"devDependencies": { | ||
"@spectrum-css/icon": "9.1.0" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,6 @@ export class IconBase extends SpectrumElement { | |
public static override get styles(): CSSResultArray { | ||
return [iconStyles]; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean to remove this whitespace? It seems useful to delineate the two properties. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah! I was testing the linting with some additional fail checks here. Should be removed. Thanks for catching this |
||
private unsubscribeSystemContext: (() => void) | null = null; | ||
|
||
@state() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I've noticed this issue as well, however here's the documentation around why we added the bash wrapper: https://typicode.github.io/husky/how-to.html#bash
We're not currently supporting Windows so it seemed a fine compromise. The if syntax however is Bash syntax so removing that would be a potential issue. What do you suggest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking we could migrate all these rules into a lint-staged config and just run the
yarn lint-staged
command here instead of all this logic. What are your thoughts? Was playing around with that here: #5393There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of migrate these in a module in a lint-staged config. More scalable. Let me update this here and test. Please feel free to add your thoughts too!