Skip to content

fix: SyntaxError after upgrading from 18.4.4 → 18.5.0 #3865

Closed
@terrymun

Description

@terrymun

Expected Behavior

Saving a commit message should work without any issue.

Current Behavior

Attempting to save a commit message will result in the following error being thrown:

/<REPO_ROOT>/node_modules/@commitlint/config-nx-scopes/index.js:1
import {RuleConfigSeverity} from '@commitlint/types';
^^^^^^

SyntaxError: Cannot use import statement outside a module

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

No response

Steps to Reproduce

Set up commitlint for nx:

const {
  utils: { getProjects },
} = require('@commitlint/config-nx-scopes');

module.exports = {
  extends: ['@commitlint/config-conventional', '@commitlint/config-nx-scopes'],
  rules: {
    'scope-enum': async (ctx) => [
      2,
      'always',
      [
        ...(await getProjects(ctx)),
        // Insert custom scopes below:
        'root',
        'release',
      ],
    ],
  },
};

  1. Upgrade from 18.4.4 to 18.5.0
  2. Run yarn commitment --edit and notice that the commitlint CLI throws the aforementioned error

Context

No response

commitlint --version

@commitlint/cli@18.5.0

git --version

v2.41.0

node --version

v18.18.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions