ci: resolve husky pre-push and pre-commit errors#10365
Conversation
| @@ -15,7 +15,7 @@ function collectSassFiles(dir: string): string[] { | |||
|
|
|||
| try { | |||
| fs.readdirSync(dir, { recursive: true, withFileTypes: true }).forEach(dirent => { | |||
There was a problem hiding this comment.
Do we need to recursively check files starting in the root directory or can we be more specific?
The only relevant directories are packages/calcite-components/src and packages/calcite-design-system/dist/scss right?
There was a problem hiding this comment.
Is the suggestion to narrow the search scope mainly for performance reasons? I’d like to avoid an allowlist, so we don’t need to (remember to) update this script if our Sass file directories change.
| @@ -15,7 +15,7 @@ function collectSassFiles(dir: string): string[] { | |||
|
|
|||
| try { | |||
| fs.readdirSync(dir, { recursive: true, withFileTypes: true }).forEach(dirent => { | |||
There was a problem hiding this comment.
Is the suggestion to narrow the search scope mainly for performance reasons? I’d like to avoid an allowlist, so we don’t need to (remember to) update this script if our Sass file directories change.
| fi | ||
| done | ||
|
|
||
| if [ -n "$(git diff --name-only -- "packages/calcite-components/.stylelintrc.json")" ]; then |
There was a problem hiding this comment.
🤦♂️ Thanks for fixing this one.
…estone-estimates * origin/dev: (29 commits) fix(input-time-zone): fix region mode labeling and value mapping (#10345) fix(dropdown): open dropdown on `ArrowDown` & `ArrowUp` keys (#10264) refactor(components): reduce post-migration TypeScript errors (#10356) refactor: do not use Host in functional components (#10352) refactor(tests): reduce TypeScript errors (#10344) feat(alert): add component tokens (#10218) fix(card): properly handle slotted elements (#10378) refactor(panel): remove duplicate tailwind class (#10379) feat(popover, action): add component tokens (#10253) chore(t9n): add translations (#10339) feat: add 3d building, 3d building parameter, divide, parcel, spaces, spaces parameter, square brackets x, n variable, zoning parameter (#10373) build: update browserslist db (#10370) ci: resolve husky pre-push and pre-commit errors (#10365) docs: update component READMEs (#10371) feat(text-area): add component tokens (#10343) fix(action): prefer `disabled` in favor of `aria-disabled` (#10367) docs(a11y): add reference to a11y guidance to issue template (#10372) chore(action): add new string for accessible indicator label (#10360) feat(chip): add component tokens (#10179) feat(avatar): add component tokens (#10280) ...
Summary
Resolve a few errors in our
pre-commitandpre-pushhooks:The
support/updateStylelintCustomSassFunctions.tsscript was trying to open scss files in the root directory.The stylelint config file extension was incorrect.
The
pre-pushhook was only protectingmainwhen it should protectrcanddevtoo.Husky requires scripts to be POSIX compliant, which means we can't use bash features.
Replace the
readprompt's-pand-nflags with a printf and case statementReplace double bracket conditionals used for pattern matching with
grep -qEin thepre-commithook