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

Proposal for Stringent Type Checking #3728

Open
y-hsgw opened this issue Apr 8, 2024 · 3 comments
Open

Proposal for Stringent Type Checking #3728

y-hsgw opened this issue Apr 8, 2024 · 3 comments

Comments

@y-hsgw
Copy link
Contributor

y-hsgw commented Apr 8, 2024

Would it be feasible to enhance the strictness of type checking?

I suggest modifying the code from:

module.exports = {
  //...
};

to:

/** @type { import("eslint").Rule.RuleModule } */
const config = {
  //...
};

module.exports = config;

This change aims to improve type checking by specifying the type explicitly using JSDoc annotations.

I have checked existing PRs and issues but couldn't find a similar proposal being addressed. If this is already in progress, we apologize for the redundancy.

@ljharb
Copy link
Member

ljharb commented Apr 8, 2024

I'm not sure what you mean - are you talking about how the plugin code is authored?

It would be great to typescript-jsdoc annotate the entire plugin. The first form, however, can also be annotated and is superior to the second form.

@y-hsgw
Copy link
Contributor Author

y-hsgw commented Apr 8, 2024

are you talking about how the plugin code is authored?

Yes, I am referring to how the plugin code is authored.

The former doesn't seem to provide type checking, so I proposed the latter.

スクリーンショット 2024-04-08 23 23 15

Similar issue: microsoft/TypeScript#47107

@ljharb
Copy link
Member

ljharb commented Apr 8, 2024

oof, that's terrible.

i'd want one commit that adds all the annotations, and another that refactors from module.exports = { … } to const config = { … }; module.exports = config;, so i can easily revert that commit in the future when TS fixes themselves.

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

No branches or pull requests

2 participants