Skip to content

Update commitlint to lerna v7 (now v8) #3637

Closed
@escapedcat

Description

@escapedcat

Expected Behavior

  • test are passing or have been updated to the new version
  • commitlint can publish using lerna v7 (with installed prettier v3 dependency)

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions