Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Don't treat mts/cts files as config files by using same check as dt-tools #488

Merged
merged 4 commits into from
Feb 26, 2024

Conversation

jakebailey
Copy link
Member

Noticed on DefinitelyTyped/DefinitelyTyped#68772 that cts/mts files are being considered config files. That's not right.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds 1000 lines to the package-json; I can copy the glob out instead if that feels better. I doubt it will change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly better after refactoring dt-tools, but still pulling in stuff. Maybe that's okay.

@jakebailey jakebailey changed the title Use @definitelytyped/util isDeclarationPath to determine declaration-ness Don't treat mts/cts files as config files by using same check as dt-tools Feb 26, 2024
package-lock.json Outdated Show resolved Hide resolved
@@ -9,7 +9,7 @@
"responseComments": [
{
"tag": "welcome",
"status": "@andrewbranch Thank you for submitting this PR!\n\n***This is a live comment which I will keep updated.***\n\n## 3 packages in this PR\n\n* `ansicolors` — [on npm](https://www.npmjs.com/package/ansicolors), [on unpkg](https://unpkg.com/browse/ansicolors@latest/)\n* `cardinal` (*new!*) — [on npm](https://www.npmjs.com/package/cardinal), [on unpkg](https://unpkg.com/browse/cardinal@latest/)\n - 1 added owner: ✎@andrewbranch\n - Config files to check:\n - [`cardinal/tslint.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/67090/files/bb7d42f514b9f9cfca6b9a84dc99fac76ac35643#diff-9f471f9ba6ffa73024ae9aeb049dd98078364c565db83ee831e0498cbb678d67): edited\n* `marked-terminal` — [on npm](https://www.npmjs.com/package/marked-terminal), [on unpkg](https://unpkg.com/browse/marked-terminal@latest/)\n - Config files to check:\n - [`marked-terminal/index.d.cts`](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/67090/files/bb7d42f514b9f9cfca6b9a84dc99fac76ac35643#diff-5e4cfea677a3d26cff8f1c90abf32caa2f3c310beee12f6f84364821c728aef6): edited\n - [`marked-terminal/marked-terminal-tests.cts`](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/67090/files/bb7d42f514b9f9cfca6b9a84dc99fac76ac35643#diff-c57707862a9de137333983d3c0ee294d8a046f4f23a7e2557f7c4f4c77529dd7): edited\n\n## Code Reviews\n\nThis PR adds a new definition, so it needs to be reviewed by a DT maintainer before it can be merged.\n\nYou can test the changes of this PR [in the Playground](https://www.typescriptlang.org/play/?dtPR=67090&install-plugin=playground-dt-review).\n\n## Status\n\n * ✅ No merge conflicts\n * ❌ Continuous integration tests have failed\n * 🕐 Only a DT maintainer can approve changes when there are new packages added\n\nOnce every item on this list is checked, I'll ask you for permission to merge and publish the changes.\n\n----------------------\n... diagnostics scrubbed ..."
"status": "@andrewbranch Thank you for submitting this PR!\n\n***This is a live comment which I will keep updated.***\n\n## 3 packages in this PR\n\n* `ansicolors` — [on npm](https://www.npmjs.com/package/ansicolors), [on unpkg](https://unpkg.com/browse/ansicolors@latest/)\n* `cardinal` (*new!*) — [on npm](https://www.npmjs.com/package/cardinal), [on unpkg](https://unpkg.com/browse/cardinal@latest/)\n - 1 added owner: ✎@andrewbranch\n - Config files to check:\n - [`cardinal/tslint.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/67090/files/bb7d42f514b9f9cfca6b9a84dc99fac76ac35643#diff-9f471f9ba6ffa73024ae9aeb049dd98078364c565db83ee831e0498cbb678d67): edited\n* `marked-terminal` — [on npm](https://www.npmjs.com/package/marked-terminal), [on unpkg](https://unpkg.com/browse/marked-terminal@latest/)\n - Config files to check:\n - [`marked-terminal/marked-terminal-tests.cts`](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/67090/files/bb7d42f514b9f9cfca6b9a84dc99fac76ac35643#diff-c57707862a9de137333983d3c0ee294d8a046f4f23a7e2557f7c4f4c77529dd7): edited\n\n## Code Reviews\n\nThis PR adds a new definition, so it needs to be reviewed by a DT maintainer before it can be merged.\n\nYou can test the changes of this PR [in the Playground](https://www.typescriptlang.org/play/?dtPR=67090&install-plugin=playground-dt-review).\n\n## Status\n\n * ✅ No merge conflicts\n * ❌ Continuous integration tests have failed\n * 🕐 Only a DT maintainer can approve changes when there are new packages added\n\nOnce every item on this list is checked, I'll ask you for permission to merge and publish the changes.\n\n----------------------\n... diagnostics scrubbed ..."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we need to account for non-declaration test files too:

  • Config files to check:\n - [marked-terminal/marked-terminal-tests.cts]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, yes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's even more weird edge cases here... may do a little refactoring to fix them.

@jakebailey jakebailey merged commit ce22c57 into DefinitelyTyped:master Feb 26, 2024
2 checks passed
@jakebailey jakebailey deleted the declaration-check branch February 26, 2024 23:45
}

if (isDeclarationPath(path)) return [pkg, { path, kind: "definition" }];
if (/\.[cm]?tsx?$/.test(path)) return [pkg, { path, kind: "test" }];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any concern that this allows mtsx ? Seems benign but I have to ask

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it does, but something else will error. But, I'll fix the regex.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

3 participants