Skip to content

Conversation

hkleungai
Copy link
Contributor

@hkleungai hkleungai commented Jan 17, 2025

A much more formal script setup for #1130. See if the code makes sense to DT-tools maintainer first, then I will proceed to incorporating them into github actions.

This PR involve some refactoring on existing dtslint code. Few things you may want to take notes on.

feat(dtslint): apply mangleScopedPackage() for package name

mangleScopedPackage() from @definitelytyped/utils is used for package name. This shall faciliate code reuse.

refactor: extract functions into util folder with minor fix

Some assertions in packages/dtslint/src/index.ts is moved to packages/dtslint/src/util.ts, with small modifications.

In findDTRootAndPackageNameFrom(), the assertions are reordered, to make the code more readable.

In assertPathIsInDefinitelyTyped(), the condition is modified. Hence if a non-existing type lib is used to run test in DT, e.g. pnpm run abc, then the error is this assertion will be properly thrown. Note that it will replace the current behaviour of throwing Error: ENOENT: no such file or directory, scandir '/<root-dir>/DefinitelyTyped/types/abc' in non-existing type lib test.

feat: add scripts to check pkg in attw / expectedVersionFailures

Two relatively simple scripts are added, aiming to check (failed) package in attw.json and expectedVersionFailures.txt in future github action development.

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

Successfully merging this pull request may close these issues.

2 participants