refactor(commitlint): update commitlint configuration and prompts#462
Merged
di-sukharev merged 4 commits intodi-sukharev:masterfrom Apr 25, 2025
Merged
refactor(commitlint): update commitlint configuration and prompts#462di-sukharev merged 4 commits intodi-sukharev:masterfrom
di-sukharev merged 4 commits intodi-sukharev:masterfrom
Conversation
… improved clarity and consistency The commitlint configuration and prompts have been refactored to enhance clarity and maintain consistency throughout the codebase. The type assertion for commitLintConfig is updated to use 'as any' for better type handling. Additionally, formatting adjustments are made in the prompts to ensure proper readability and alignment with the defined conventions. These changes aim to streamline the commit message generation process and improve overall code maintainability.
…ved file management Including rimraf in the project allows for easier and more efficient removal of files and directories, enhancing the development workflow, especially for tasks like cleaning up build artifacts.
48da90d to
2e46a63
Compare
Resolves persistent `ReferenceError: exports is not defined` errors encountered during unit tests (`unit-test (20.x)` job) in the GitHub Actions CI environment. These errors occurred specifically when importing `cli-testing-library` in the global Jest setup file (`test/jest-setup.ts`), despite tests passing locally with the same Node.js version (v20.19.0). After iterative testing, the following Jest configuration combination was identified as necessary to ensure consistent ESM handling and test success in both local and CI environments: - Set preset to `ts-jest/presets/default-esm` for stricter ESM rules. - Configured `transformIgnorePatterns` to ensure Jest transforms specific ESM dependencies (`cli-testing-library`, `@clack`, `cleye`) within `node_modules`. - Expanded the `transform` pattern (`^.+\\.(ts|tsx|js|jsx|mjs)$`) to explicitly cover various script types handled by `ts-jest`. - Included explicit `tsconfig` overrides (`module: 'ESNext'`, `target: 'ES2022'`) within the `ts-jest` transform options to resolve potential environment discrepancies. - Retained `moduleNameMapper` for `.js` imports for reliable module resolution. - Ensured `cli-testing-library` imports remain in the global setup (`test/jest-setup.ts`). - Removed test cache clearing from the `test:unit` script in `package.json`. This configuration now passes reliably across environments.
The space normalization logic is updated to replace only multiple spaces and tabs with a single space, while preserving newlines. This change ensures that the formatting of the content is maintained, especially when dealing with empty line requirements and max line length.
di-sukharev
approved these changes
Apr 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refactor(commitlint): update commitlint configuration and prompts for improved clarity and consistency
The commitlint configuration and prompts have been refactored to enhance clarity and maintain consistency throughout the codebase. The type assertion for commitLintConfig is updated to use 'as any' for better type handling. Additionally, formatting adjustments are made in the prompts to ensure proper readability and alignment with the defined conventions. These changes aim to streamline the commit message generation process and improve overall code maintainability.
This merge request is the 2nd of 5 commits intended to archive
feat(commitlint): Improve consistency handling and prompt structure. I have split the changes into five reviewable merge requests that will be submitted sequentially.feat(commitlint): Improve consistency handling and prompt structure
Problem:
The current commitlint integration has limitations in generating commit messages that strictly follow commitlint rules. For example, when commitlint config has
body-leading-blank: [2, 'always'], the default prompt cannot generate messages with proper blank line between header and body:Solution:
We refactor the consistency handling to use the default commit message format as a reference style, while ensuring the generated messages strictly follow commitlint rules. This approach: