-
Notifications
You must be signed in to change notification settings - Fork 933
CommitLint with Yarn v2 (Plug'n'play) #2637
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
Comments
Tbh I think we don't support yarn 2 at the moment. |
I've created it here: #2638 |
I've just tried in a fresh Yarn 2 (PNP) monorepo project and it works.
|
Do you mind sharing your monorepo? |
sure, here is a trimmed copy: https://github.com/plus-/yarn-commitlint-sample |
@loctran016 do we need to udpate the docs in a way? |
Context for anyone that stumbles upon this: If you're using Plug n Play, you'll want to go It essentially works, but the current documentation doesn't fully account for it. |
@reywright thanks for your comment! Wanna create a PR to fix the docs? |
With yarn Here's an example:
has anyone else run into this issue? Your EnvironmentMacOS Monterey 12.4 (21F79)
|
This comment was marked as outdated.
This comment was marked as outdated.
@escapedcat sorry, yarn |
Bump? |
@pzimmermaninmo most of my teams have moved back to |
|
Yeah I get it, I just figured I'd double check since it hasn't been closed or anything like that yet. Reverting to |
Do we know why Yarn PnP does not work? Edit: Proof (terminal)developer@a7f267b3db37:/workspaces/palettar$ yarn add --dev @commitlint/{cli,config-conventional}
➤ YN0000: · Yarn 4.5.0
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + @commitlint/cli@npm:19.5.0, @babel/code-frame@npm:7.25.7, @babel/helper-validator-identifier@npm:7.25.7, @babel/highlight@npm:7.25.7, @commitlint/config-validator@npm:19.5.0, and 92 more.
➤ YN0000: └ Completed in 1s 317ms
➤ YN0000: ┌ Post-resolution validation
➤ YN0086: │ Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ 97 packages were added to the project (+ 6.71 MiB).
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: └ Completed
➤ YN0000: · Done with warnings in 1s 485ms
developer@a7f267b3db37:/workspaces/palettar$ echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
developer@a7f267b3db37:/workspaces/palettar$ echo "feat: add commitlint support to Palettar" | yarn commitlint
developer@a7f267b3db37:/workspaces/palettar$ echo "feat2: add commitlint support to Palettar" | yarn commitlint
⧗ input: feat2: add commitlint support to Palettar
✖ type must be one of [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test] [type-enum]
✖ found 1 problems, 0 warnings
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
developer@a7f267b3db37:/workspaces/palettar$ yarn add -D husky
➤ YN0000: · Yarn 4.5.0
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + husky@npm:9.1.6
➤ YN0000: └ Completed
➤ YN0000: ┌ Post-resolution validation
➤ YN0086: │ Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ A package was added to the project (+ 5.06 KiB).
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: └ Completed
➤ YN0000: · Done with warnings in 0s 303ms
developer@a7f267b3db37:/workspaces/palettar$ yarn husky init
developer@a7f267b3db37:/workspaces/palettar$ echo "yarn commitlint --edit \$1" > .husky/commit-msg
developer@a7f267b3db37:/workspaces/palettar$ git add .
developer@a7f267b3db37:/workspaces/palettar$ git commit -m "invalid: test commit message"
⧗ input: invalid: test commit message
✖ type must be one of [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test] [type-enum]
✖ found 1 problems, 0 warnings
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
husky - commit-msg script failed (code 1)
developer@a7f267b3db37:/workspaces/palettar$ git commit -m "feat: lint commit messages"
[main df227c6] chore: lint commit messages
113 files changed, 977 insertions(+), 1 deletion(-)
create mode 100644 .husky/commit-msg
create mode 100644 .yarn/cache/@babel-code-frame-npm-7.25.7-40a9f53f43-14825c298b.zip
create mode 100644 .yarn/cache/@babel-helper-validator-identifier-npm-7.25.7-1c758f0472-07438e5bf0.zip
create mode 100644 .yarn/cache/@babel-highlight-npm-7.25.7-308b20da71-1f5894fdb0.zip
create mode 100644 .yarn/cache/@commitlint-cli-npm-19.5.0-621eb7a04d-a9fb05f3de.zip
create mode 100644 .yarn/cache/@commitlint-config-conventional-npm-19.5.0-aea781dcb6-a7dc6c0d23.zip
create mode 100644 .yarn/cache/@commitlint-config-validator-npm-19.5.0-3e21395d0a-f04b8c6644.zip
create mode 100644 .yarn/cache/@commitlint-ensure-npm-19.5.0-9a76ded8a5-94955d424d.zip
create mode 100644 .yarn/cache/@commitlint-execute-rule-npm-19.5.0-6d93febb36-966dfc09ae.zip
create mode 100644 .yarn/cache/@commitlint-format-npm-19.5.0-6d6e8dd100-209a3d530d.zip
create mode 100644 .yarn/cache/@commitlint-is-ignored-npm-19.5.0-94bd6a650f-ac74cd00c4.zip
create mode 100644 .yarn/cache/@commitlint-lint-npm-19.5.0-b9fef12eb2-8db4d5ca31.zip
create mode 100644 .yarn/cache/@commitlint-load-npm-19.5.0-5e9dc48946-72fb5f3b22.zip
create mode 100644 .yarn/cache/@commitlint-message-npm-19.5.0-47f494dcec-72b990ba8c.zip
create mode 100644 .yarn/cache/@commitlint-parse-npm-19.5.0-eae307254f-63655cedcf.zip
create mode 100644 .yarn/cache/@commitlint-read-npm-19.5.0-ae9658ad59-c2d6f95893.zip
create mode 100644 .yarn/cache/@commitlint-resolve-extends-npm-19.5.0-b6ceaa62ff-10569a4603.zip
create mode 100644 .yarn/cache/@commitlint-rules-npm-19.5.0-a8b1a50340-8dc5a6e827.zip
create mode 100644 .yarn/cache/@commitlint-to-lines-npm-19.5.0-d7bc1d1dc4-7674b4b688.zip
create mode 100644 .yarn/cache/@commitlint-top-level-npm-19.5.0-2be77f8c8c-8c1edc513c.zip
create mode 100644 .yarn/cache/@commitlint-types-npm-19.5.0-e5342f6a60-f4a93992f4.zip
create mode 100644 .yarn/cache/@types-conventional-commits-parser-npm-5.0.0-cc661330d3-16c748ce01.zip
create mode 100644 .yarn/cache/@types-node-npm-22.7.6-cbb64e0ad4-d4406a63af.zip
create mode 100644 .yarn/cache/JSONStream-npm-1.3.5-1987f2e6dd-0f54694da3.zip
create mode 100644 .yarn/cache/ajv-npm-8.17.1-12ade7edc6-ec3ba10a57.zip
create mode 100644 .yarn/cache/ansi-regex-npm-5.0.1-c963a48615-9a64bb8627.zip
create mode 100644 .yarn/cache/ansi-styles-npm-3.2.1-8cb8107983-ece5a8ef06.zip
create mode 100644 .yarn/cache/ansi-styles-npm-4.3.0-245c7d42c7-895a23929d.zip
create mode 100644 .yarn/cache/argparse-npm-2.0.1-faff7999e6-c5640c2d89.zip
create mode 100644 .yarn/cache/array-ify-npm-1.0.0-e09a371977-75c9c072fa.zip
create mode 100644 .yarn/cache/callsites-npm-3.1.0-268f989910-fff9227740.zip
create mode 100644 .yarn/cache/chalk-npm-2.4.2-3ea16dd91e-e6543f02ec.zip
create mode 100644 .yarn/cache/chalk-npm-5.3.0-d181999efb-8297d436b2.zip
create mode 100644 .yarn/cache/cliui-npm-8.0.1-3b029092cf-4bda0f09c3.zip
create mode 100644 .yarn/cache/color-convert-npm-1.9.3-1fe690075e-5ad3c53494.zip
create mode 100644 .yarn/cache/color-convert-npm-2.0.1-79730e935b-37e1150172.zip
create mode 100644 .yarn/cache/color-name-npm-1.1.3-728b7b5d39-566a3d42cc.zip
create mode 100644 .yarn/cache/color-name-npm-1.1.4-025792b0ea-a1a3f91415.zip
create mode 100644 .yarn/cache/compare-func-npm-2.0.0-9cd7852f23-78bd4dd4ed.zip
create mode 100644 .yarn/cache/conventional-changelog-angular-npm-7.0.0-de5edb79f0-90e73e25e2.zip
create mode 100644 .yarn/cache/conventional-changelog-conventionalcommits-npm-7.0.2-f878f86efe-3cb1eab35e.zip
create mode 100644 .yarn/cache/conventional-commits-parser-npm-5.0.0-8c896e66c7-c9e542f488.zip
create mode 100644 .yarn/cache/cosmiconfig-npm-9.0.0-47d78cf275-1c1703be4f.zip
create mode 100644 .yarn/cache/cosmiconfig-typescript-loader-npm-5.0.0-6462903b70-0eb1a767a5.zip
create mode 100644 .yarn/cache/dargs-npm-8.1.0-39fde97ef5-08cbd1ee4a.zip
create mode 100644 .yarn/cache/dot-prop-npm-5.3.0-7bf6ee1eb8-93f0d343ef.zip
create mode 100644 .yarn/cache/emoji-regex-npm-8.0.0-213764015c-b6053ad399.zip
create mode 100644 .yarn/cache/env-paths-npm-2.2.1-7c7577428c-285325677b.zip
create mode 100644 .yarn/cache/error-ex-npm-1.3.2-5654f80c0f-ba827f8936.zip
create mode 100644 .yarn/cache/escalade-npm-3.2.0-19b50dd48f-ced4dd3a78.zip
create mode 100644 .yarn/cache/escape-string-regexp-npm-1.0.5-3284de402f-a968ad453d.zip
create mode 100644 .yarn/cache/fast-deep-equal-npm-3.1.3-790edcfcf5-40dedc862e.zip
create mode 100644 .yarn/cache/fast-uri-npm-3.0.3-0874072625-4b2c5ce681.zip
create mode 100644 .yarn/cache/find-up-npm-7.0.0-2283627385-e6ee3e6154.zip
create mode 100644 .yarn/cache/get-caller-file-npm-2.0.5-80e8a86305-c6c7b60271.zip
create mode 100644 .yarn/cache/git-raw-commits-npm-4.0.0-60e7e666d1-ab51335d9e.zip
create mode 100644 .yarn/cache/global-directory-npm-4.0.1-1de95382fd-f9cbeef41d.zip
create mode 100644 .yarn/cache/has-flag-npm-3.0.0-16ac11fe05-1c6c83b14b.zip
create mode 100644 .yarn/cache/husky-npm-9.1.6-f05821288d-705673db4a.zip
create mode 100644 .yarn/cache/import-fresh-npm-3.3.0-3e34265ca9-7f882953aa.zip
create mode 100644 .yarn/cache/import-meta-resolve-npm-4.1.0-6e93749986-42f3284b04.zip
create mode 100644 .yarn/cache/ini-npm-4.1.1-01c2cbda7b-7fddc8dfd3.zip
create mode 100644 .yarn/cache/is-arrayish-npm-0.2.1-23927dfb15-e7fb686a73.zip
create mode 100644 .yarn/cache/is-fullwidth-code-point-npm-3.0.0-1ecf4ebee5-bb11d825e0.zip
create mode 100644 .yarn/cache/is-obj-npm-2.0.0-3d95e053f4-85044ed7ba.zip
create mode 100644 .yarn/cache/is-text-path-npm-2.0.0-5c0fb9b2bc-e3c470e126.zip
create mode 100644 .yarn/cache/jiti-npm-1.21.6-0bb76563a3-05b9ed58cd.zip
create mode 100644 .yarn/cache/js-tokens-npm-4.0.0-0ac852e9e2-e248708d37.zip
create mode 100644 .yarn/cache/js-yaml-npm-4.1.0-3606f32312-184a24b4ea.zip
create mode 100644 .yarn/cache/json-parse-even-better-errors-npm-2.3.1-144d62256e-140932564c.zip
create mode 100644 .yarn/cache/json-schema-traverse-npm-1.0.0-fb3684f4f0-71e30015d7.zip
create mode 100644 .yarn/cache/jsonparse-npm-1.3.1-b6fde74828-89bc68080c.zip
create mode 100644 .yarn/cache/lines-and-columns-npm-1.2.4-d6c7cc5799-3da6ee62d4.zip
create mode 100644 .yarn/cache/locate-path-npm-7.2.0-0e1169e19b-139e8a7fe1.zip
create mode 100644 .yarn/cache/lodash.camelcase-npm-4.3.0-bf268e3bf0-fcba15d21a.zip
create mode 100644 .yarn/cache/lodash.isplainobject-npm-4.0.6-d73937742f-afd70b5c45.zip
create mode 100644 .yarn/cache/lodash.kebabcase-npm-4.1.1-89ffca7e1f-da5d8f41db.zip
create mode 100644 .yarn/cache/lodash.merge-npm-4.6.2-77cb4416bf-402fa16a1e.zip
create mode 100644 .yarn/cache/lodash.mergewith-npm-4.6.2-7d2d4201ec-4adbed65ff.zip
create mode 100644 .yarn/cache/lodash.snakecase-npm-4.1.1-b12cdbecb4-f0b3f2497e.zip
create mode 100644 .yarn/cache/lodash.startcase-npm-4.4.0-637aa8cc15-bd82aa87a4.zip
create mode 100644 .yarn/cache/lodash.uniq-npm-4.5.0-7c270dca85-262d400bb0.zip
create mode 100644 .yarn/cache/lodash.upperfirst-npm-4.3.1-e3b7c364ba-435625da4b.zip
create mode 100644 .yarn/cache/meow-npm-12.1.1-bd7858d088-a125ca99a3.zip
create mode 100644 .yarn/cache/minimist-npm-1.2.8-d7af7b1dce-19d3fcdca0.zip
create mode 100644 .yarn/cache/p-limit-npm-4.0.0-5dccf29b67-a56af34a77.zip
create mode 100644 .yarn/cache/p-locate-npm-6.0.0-b6cfb720dc-d72fa2f41a.zip
create mode 100644 .yarn/cache/parent-module-npm-1.0.1-1fae11b095-c63d6e8000.zip
create mode 100644 .yarn/cache/parse-json-npm-5.2.0-00a63b1199-77947f2253.zip
create mode 100644 .yarn/cache/path-exists-npm-5.0.0-0bf403c56c-b170f3060b.zip
create mode 100644 .yarn/cache/picocolors-npm-1.1.1-4fede47cf1-e2e3e8170a.zip
create mode 100644 .yarn/cache/require-directory-npm-2.1.1-8608aee50b-83aa76a7bc.zip
create mode 100644 .yarn/cache/require-from-string-npm-2.0.2-8557e0db12-aaa267e0c5.zip
create mode 100644 .yarn/cache/resolve-from-npm-4.0.0-f758ec21bf-8408eec31a.zip
create mode 100644 .yarn/cache/resolve-from-npm-5.0.0-15c9db4d33-b21cb7f1fb.zip
create mode 100644 .yarn/cache/semver-npm-7.6.3-57e82c14d5-88f33e148b.zip
create mode 100644 .yarn/cache/split2-npm-4.2.0-16aa3883ba-b292beb8ce.zip
create mode 100644 .yarn/cache/string-width-npm-4.2.3-2c27177bae-1e525e92e5.zip
create mode 100644 .yarn/cache/strip-ansi-npm-6.0.1-caddc7cb40-1ae5f212a1.zip
create mode 100644 .yarn/cache/supports-color-npm-5.5.0-183ac537bc-6ae5ff319b.zip
create mode 100644 .yarn/cache/text-extensions-npm-2.4.0-d2843791b9-6790e7ee72.zip
create mode 100644 .yarn/cache/through-npm-2.3.8-df5f72a16e-4b09f37740.zip
create mode 100644 .yarn/cache/tinyexec-npm-0.3.1-13938c6dae-11e7a7c5d8.zip
create mode 100644 .yarn/cache/undici-types-npm-6.19.8-9f12285b7a-078afa5990.zip
create mode 100644 .yarn/cache/unicorn-magic-npm-0.1.0-12d4f6ff8b-e4ed0de05b.zip
create mode 100644 .yarn/cache/wrap-ansi-npm-7.0.0-ad6e1a0554-d15fc12c11.zip
create mode 100644 .yarn/cache/y18n-npm-5.0.8-5f3a0a7e62-4df2842c36.zip
create mode 100644 .yarn/cache/yargs-npm-17.7.2-80b62638e1-ccd7e723e6.zip
create mode 100644 .yarn/cache/yargs-parser-npm-21.1.1-8fdc003314-f84b5e4816.zip
create mode 100644 .yarn/cache/yocto-queue-npm-1.1.1-6bddf81a40-cb287fe5e6.zip
create mode 100644 commitlint.config.js
developer@a7f267b3db37:/workspaces/palettar$ |
Expected Behavior
In the yarn v1 and yarn v2 (with
nodeLinker: node_modules
), commitlint work perfectlyCurrent Behavior
It doesn't work at all. I've tried these command in git-hook (husky):
npx --no-install commitlint --edit "$1"
yarn --no-install commitlint --edit "$1"
yarn run --no-install commitlint --edit "$1"
Here is the pictures of this problem:

Affected packages
Steps to Reproduce (for bugs)
Link for my repo (bypass git hook)
Context
Your Environment
Mac OS X 10.11.6 El Captain
commitlint --version
yarn run commitlint --version
git --version
node --version
The text was updated successfully, but these errors were encountered: