conventional-changelog / commitlint

📓 Lint commit messages
https://commitlint.js.org
MIT License
16.72k stars 901 forks source link

Update commitlint to lerna v7 (now v8) #3637

Open escapedcat opened 1 year ago

escapedcat commented 1 year ago

Expected Behavior

Current Behavior

Installing prettier v3 is breaking the current lerna (v6) setup in a way that yarn publishdoesn't work anymore. Updating to lerna v7 (which works with prettier v3) leads to some failing tests:

@commitlint\/config-lerna-scopes tests

 FAIL  @commitlint/config-lerna-scopes/index.test.js
  ✓ exports rules key (1 ms)
  ✓ rules hold object
  ✓ rules contain scope-enum
  ✓ scope-enum is function
  ✓ scope-enum does not throw for missing context (21 ms)
  ✓ scope-enum has expected severity (1 ms)
  ✓ scope-enum has expected modifier (1 ms)
  ✕ returns empty value for empty lerna repository (43 ms)
  ✕ returns expected value for basic lerna repository (34 ms)
  ✕ returns expected value for lerna repository containing modules (33 ms)
  ✕ returns expected value for scoped lerna repository (32 ms)
  ✓ returns expected value for yarn workspaces (2 ms)
  ✕ returns expected value for yarn workspaces has nested packages (36 ms)

  ● returns empty value for empty lerna repository

    Could not resolve dependency lerna

      41 |             const sourcePath = (0, resolve_pkg_1.default)(dependency);
      42 |             if (!sourcePath) {
    > 43 |                 throw new Error(`Could not resolve dependency ${dependency}`);
         |                       ^
      44 |             }
      45 |             const sourceModulesPath = findParentPath(sourcePath, 'node_modules');
      46 |             if (!sourceModulesPath) {

      at @packages/test/lib/npm.js:43:23
          at Array.map (<anonymous>)
      at map (@packages/test/lib/npm.js:40:32)
      at Object.bootstrap (@packages/test/lib/npm.js:59:5)
      at Object.<anonymous> (@commitlint/config-lerna-scopes/index.test.js:50:14)

  ● returns expected value for basic lerna repository

    Could not resolve dependency lerna

      41 |             const sourcePath = (0, resolve_pkg_1.default)(dependency);
      42 |             if (!sourcePath) {
    > 43 |                 throw new Error(`Could not resolve dependency ${dependency}`);
         |                       ^
      44 |             }
      45 |             const sourceModulesPath = findParentPath(sourcePath, 'node_modules');
      46 |             if (!sourceModulesPath) {

      at @packages/test/lib/npm.js:43:23
          at Array.map (<anonymous>)
      at map (@packages/test/lib/npm.js:40:32)
      at Object.bootstrap (@packages/test/lib/npm.js:59:5)
      at Object.<anonymous> (@commitlint/config-lerna-scopes/index.test.js:57:14)

  ● returns expected value for lerna repository containing modules

    Could not resolve dependency lerna

      41 |             const sourcePath = (0, resolve_pkg_1.default)(dependency);
      42 |             if (!sourcePath) {
    > 43 |                 throw new Error(`Could not resolve dependency ${dependency}`);
         |                       ^
      44 |             }
      45 |             const sourceModulesPath = findParentPath(sourcePath, 'node_modules');
      46 |             if (!sourceModulesPath) {

      at @packages/test/lib/npm.js:43:23
          at Array.map (<anonymous>)
      at map (@packages/test/lib/npm.js:40:32)
      at Object.bootstrap (@packages/test/lib/npm.js:59:5)
      at Object.<anonymous> (@commitlint/config-lerna-scopes/index.test.js:65:14)

  ● returns expected value for scoped lerna repository

    Could not resolve dependency lerna

      41 |             const sourcePath = (0, resolve_pkg_1.default)(dependency);
      42 |             if (!sourcePath) {
    > 43 |                 throw new Error(`Could not resolve dependency ${dependency}`);
         |                       ^
      44 |             }
      45 |             const sourceModulesPath = findParentPath(sourcePath, 'node_modules');
      46 |             if (!sourceModulesPath) {

      at @packages/test/lib/npm.js:43:23
          at Array.map (<anonymous>)
      at map (@packages/test/lib/npm.js:40:32)
      at Object.bootstrap (@packages/test/lib/npm.js:59:5)
      at Object.<anonymous> (@commitlint/config-lerna-scopes/index.test.js:73:14)

  ● returns expected value for yarn workspaces has nested packages

    Could not resolve dependency lerna

      41 |             const sourcePath = (0, resolve_pkg_1.default)(dependency);
      42 |             if (!sourcePath) {
    > 43 |                 throw new Error(`Could not resolve dependency ${dependency}`);
         |                       ^
      44 |             }
      45 |             const sourceModulesPath = findParentPath(sourcePath, 'node_modules');
      46 |             if (!sourceModulesPath) {

      at @packages/test/lib/npm.js:43:23
          at Array.map (<anonymous>)
      at map (@packages/test/lib/npm.js:40:32)
      at Object.bootstrap (@packages/test/lib/npm.js:59:5)
      at Object.<anonymous> (@commitlint/config-lerna-scopes/index.test.js:88:14)

Test Suites: 1 failed, 1 total
Tests:       5 failed, 8 passed, 13 total

Context

Created a branch here: #3636

commitlint --version

17.6.7

git --version

v2.41.0

node --version

v18.16.0

alex-arriaga commented 8 months ago

Hi

Hope you are having a nice day! Wondering if there are any plans to support Lerna v7. Thank you.

escapedcat commented 8 months ago

The plan currently is only this issue. Someone needs to look into the failing tests. Happy for any help.

JounQin commented 7 months ago

I'll work on this in the next schedule with prettier v3 together.

oscarmarina commented 5 months ago

Hi @JounQin Could you make progress on the task?. Thank you.