-
Notifications
You must be signed in to change notification settings - Fork 909
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
Can't run commitlint on project with tsconfig.json #3256
Comments
I tested with latest Regards. |
Pity, looks like it's somehow picking this up?: https://gitlab.mim-libre.fr/alphabet/laboite-blog-api/-/blob/dev/tsconfig.json#L3 Not sure when we can get to this. |
It looks like yes, I'm not sure it's a good idea for |
I managed to work around this issue by |
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
…onfiguration **@commitlint/cli** added support for TypeScript-based configurations via `ts-node`, and that has caused a good deal of grief: conventional-changelog/commitlint#3420 conventional-changelog/commitlint#3351 conventional-changelog/commitlint#3218 conventional-changelog/commitlint#3256 hoverinc/web-react#1792 Both because it's a heavy-ass dependency and because it requires configuration to work properly. It seems like project-local configuration can affect it's invocation of ts-node, which happens even JavaScript configuration files now?... lame. Anyways, this ensures we avoid any type-checking that happens in it's ts-node invocation until we get a better solution upstream (or contribute one). Ideally, installing ts-node would be opt-in etc.
I got a similar issue running Here is the FROM node:18.14-alpine
RUN apk add --no-cache git~=2 \
&& npm install --global @commitlint/cli@17.4.4 @commitlint/config-conventional@17.4.4
# Contains only commitlint.config.js
COPY rootfs /
USER node
ENTRYPOINT [ "commitlint", "--strict", "--config", "/commitlint.config.js" ] The related CI job: release:commitlint:
stage: release
needs: []
image:
name: registry.gitlab.com/company/images/commitlint
entrypoint: ['']
script:
- git config --global --add safe.directory ${CI_PROJECT_DIR}
- git fetch --quiet origin ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
- npx commitlint --version
- npx commitlint --strict --config /commitlint.config.js --from=origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
allow_failure:
exit_codes: 2 Works on any of my project excepts the one using My workaround was to add a |
@baby-gnu I |
🤔 It seems that we suffer from the same problem for the okp4/team-wiki project. The temporary solution was to delete the |
Just check the encoding of index.ts. |
I'm getting the same UTF-16 file after following docs https://commitlint.js.org/#/guides-local-setup?id=install-commitlint with command
Error log:
The problem is solved after changing the file encoding to UTF-8 manually. |
@TimeCoder Can you be a little more specific? Which index.ts file has this problem? I badly need to resolve this conflict My error message still is:
|
When I use the latest array values in my tsconfig/extends, I encounter this error. However, when I change it to a string, the error disappears. Therefore, I believe it's an issue with ts-node not supporting parsing of the latest ts configuration. Perhaps upgrading ts-node version could resolve this problem? |
According to the lock-file commitlint is on the latest version?:
|
Unfortunately, ts-node did not solve this problem.TypeStrong/ts-node#2000 |
Sounds like a good idea. You up for a PR? |
Reopening because of #3641 |
Another issue here is why
All internal loaders of cosmiconfig are already lazily loaded. Refer this commit - cosmiconfig/cosmiconfig@08ebcd5 |
When running
commitlint
on a typeScript project, I have an error becausecommitlint
use the projecttsconfig.json
.Expected Behavior
commitlint
should not use the project typeScript configuration.Current Behavior
commitlint
produce the following traceback:Affected packages
Possible Solution
Steps to Reproduce (for bugs)
commitlint --from HEAD~2 --to HEAD
commitlint.config.js
Context
We upgraded our
commitlint
container for our CI and now all typeScript project are failling.Your Environment
commitlint --version
git --version
node --version
The text was updated successfully, but these errors were encountered: