Skip to content

Conversation

joelantonyjoy
Copy link
Collaborator

Migrated files under scripts folder.

@joelantonyjoy joelantonyjoy linked an issue Sep 16, 2025 that may be closed by this pull request
@joelantonyjoy
Copy link
Collaborator Author

@microsoft-github-policy-service agree company="Microsoft"

@joelantonyjoy
Copy link
Collaborator Author

@microsoft-github-policy-service agree

@joelantonyjoy joelantonyjoy self-assigned this Sep 16, 2025
@@ -45,14 +53,15 @@ function transformer(file, api, options) {
// Manually sort the export statements alphabetically
const sortedExports = updatedExportStatements
.nodes()
.map(node => {

.map((node: any) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's avoid 'any' and use the types. import { TSESTree } from "@typescript-eslint/utils"; that package should have the right types.


let changesMade = 0;

// Step 1: Add rule to the `rules` object (without parentheses)
root.find(j.Property, { key: { name: "rules" } })
.at(0)
.forEach(path => {
.forEach((path: any) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any in this file too

Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you test this script with the repo create command? I think you need to update the package.json script to run ts-node instead of node since node doesn't natively work with TypeScript (at least with the versions we're using).

ex. npm run create -- rule-name

}
})
.demandCommand(1, "You must provide the rule name.").argv; // Make the rule name (positional)
.demandCommand(1, "You must provide the rule name.").argv as any; // Type assertion for yargs
Copy link
Collaborator

Choose a reason for hiding this comment

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

Per Aubrey's other comments, any usage should be avoided.

See the yargs docs for how to avoid this casting. Since there's no async processes occurring, you can replace argv with parseSync(). https://github.com/yargs/yargs/blob/HEAD/docs/typescript.md#typescript-usage-examples

@joelantonyjoy joelantonyjoy force-pushed the users/joelantonyjoy/bug137 branch from 6cc7f31 to 01930e9 Compare September 18, 2025 07:35
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.

chore: convert existing javascript files to typescript
3 participants