question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support commitlint.config.ts with TypeScript

See original GitHub issue

Expected Behavior

Commitlint should be able to parse the config file written in TypeScript

Current Behavior

Commitlint asks me to add a config file

> git ls-files --stage -- C:\Users\.....(reducted)......\commitlint.config.ts
⧗   input: Add commitlint and husky
✖   Please add rules to your `commitlint.config.js`
    - Getting started guide: https://git.io/fhHij
    - Example config: https://git.io/fhHip [empty-rules]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

husky - commit-msg hook exited with code 1 (error)

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Steps to Reproduce (for bugs)

  1. Install
  2. Add commitlint.config.ts
  3. Perform an unconventional commit
  4. See Git log
commitlint.config.ts
export default { extends: ['@commitlint/config-conventional'] };

Context

Well, I want my repo to have only TS files rather than combining with JS files- including config files on my repository and I need Commitlint would also respect this choice.

Your Environment

Executable Version
commitlint --version 12.1.4
git --version 2.31.1.windows.1
node --version v14.16.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
polkovnikov-phcommented, Jul 6, 2021

Somehow documentation already mentions using TypeScript for configuration, yet it’s unclear how to use it.

2reactions
polkovnikov-phcommented, Jul 30, 2021

when commitlint.config.js does not exist

@songhn233 If someone accidentally used tsc on all *.ts files, including commitlint.config.ts, now changes to commitlint.config.ts would be magically ignored.

Common resolution strategy is

  • run .ts config if exists, error if no ts-node around;
  • run .js config if exists;
  • use default config.
Read more comments on GitHub >

github_iconTop Results From Across the Web

@commitlint/config-conventional - npm
Shareable commitlint config enforcing conventional commits. Use with @commitlint/cli and @commitlint/prompt-cli. Getting started. npm install -- ...
Read more >
Support commitlint.config.ts with TypeScript - Bountysource
Support commitlint.config.ts with TypeScript · Expected Behavior · Current Behavior · Affected packages · Steps to Reproduce (for bugs) · Context.
Read more >
commitlint - Lint commit messages
By supporting npm-installed configurations it makes sharing of commit conventions easy. Getting started. Install. npm install -g @commitlint/cli @commitlint/ ...
Read more >
@commitlint/config-validator | Yarn - Package Manager
17.1.0 (2022-08-27). Bug Fixes. update dependency cosmiconfig-typescript-loader to v3 (#3253 (4e87d14); update dependency cosmiconfig-typescript-loader ...
Read more >
Ts-node NPM - npm.io
TypeScript execution and REPL for node.js, with source map and native ESM support. ... ts-node supports --project and --showConfig similar to the tsc...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found