Skip to content
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

Heavy typescript dependency since v13 #3218

Closed
medikoo opened this issue Jun 2, 2022 · 5 comments
Closed

Heavy typescript dependency since v13 #3218

medikoo opened this issue Jun 2, 2022 · 5 comments

Comments

@medikoo
Copy link

medikoo commented Jun 2, 2022

I've just upgraded @commitlint/cli from v12 to v17, and found out that the package started to require typescript and related modules, why exactly it's the case for a such simple thing as commit message linter?

Note, that those extra packages are quite heavy and now total size of @commitlint/cli doesn't seem to be really justified

@escapedcat
Copy link
Member

Out of the blue it could be related to adding https://github.com/Codex-/cosmiconfig-typescript-loader so people can use TS for their configs. Happy for any suggestions how to improve this.

@medikoo
Copy link
Author

medikoo commented Jun 3, 2022

In such case users should be responsible for ensuring TS in their own capacity.

e.g. it's exactly what we're doing in Serverless Framework, we allow users to write configuration in TS, but that doesn't make a TS tooling a mandatory dependency of the package (that'll bump our package size through the roof). Users on their own need to ensure then that ts-node is available and we crash with a meaningful error if it isn't.

@escapedcat
Copy link
Member

Closing this in favour of #3221

jrolfs added a commit to hoverinc/hover-javascript that referenced this issue Feb 27, 2023
…onfiguration

**@commitlint/cli** added support for TypeScript-based configurations via `ts-node`, and that has caused a good deal of grief:

conventional-changelog/commitlint#3420
conventional-changelog/commitlint#3351
conventional-changelog/commitlint#3218
conventional-changelog/commitlint#3256

hoverinc/web-react#1792

Both because it's a heavy-ass dependency and because it requires configuration to
work properly. It seems like project-local configuration can affect it's invocation
of ts-node, which happens even JavaScript configuration files now?... lame.

Anyways, this ensures we avoid any type-checking that happens in it's ts-node
invocation until we get a better solution upstream (or contribute one). Ideally,
installing ts-node would be opt-in etc.
@jedwards1211
Copy link

jedwards1211 commented Nov 4, 2024

@escapedcat this is still an issue; @commitlint/load depends on cosmiconfig-typescript-loader, which marks typescript as a non-optional peer dependency.

I don't use commitlint anymore so I'm not personally asking for anyone to fix this, just wanted to let you know

$ pnpm i --no-optional commitlint
Packages: +100
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /Users/andy/Library/pnpm/store/v3
  Virtual store is at:             node_modules/.pnpm
Progress: resolved 100, reused 100, downloaded 0, added 100, done

dependencies:
+ commitlint 19.5.0
+ cosmiconfig 9.0.0

optionalDependencies: skipped

Done in 7.2s
$ pnpm why typescript
Legend: production dependency, optional only, dev only

[email protected] /Users/andy/gh/blah

dependencies:
commitlint 19.5.0
└─┬ @commitlint/cli 19.5.0
  └─┬ @commitlint/load 19.5.0
    ├─┬ cosmiconfig 9.0.0
    │ └── typescript 5.6.3 peer
    └─┬ cosmiconfig-typescript-loader 5.1.0
      ├─┬ cosmiconfig 9.0.0 peer
      │ └── typescript 5.6.3 peer
      └── typescript 5.6.3 peer
cosmiconfig 9.0.0
└── typescript 5.6.3 peer

@jedwards1211
Copy link

jedwards1211 commented Nov 4, 2024

Even without typescript, commitlint weighs 11MB right now, almost as much as eslint (12MB). ~10MB seems pretty economical for linting JS, but seems excessive for linting commit messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants