-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
chore: setup typescript-eslint #90
Conversation
@snitin315 there are some conflicts now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great timing! I'd been hoping to get to the typescript-eslint
task soon. Reviewing a PR is even better. 😄
Most of my comments here are on existing code, so it's understandable if they're out of scope for this PR. I'd expect them to be. So for anything that can't be done here I'm requesting updating the comment to reference a filed TODO to refactor the types.
The one blocker is I'm requesting changes on is using the recommended teslint.config
with extends
to simplify the eslint.config.js
block.
Exciting!
d534a1c
to
541d614
Compare
@JoshuaKGoldberg I've addressed your comments. PTAL |
eslint.config.js
Outdated
@@ -53,4 +54,10 @@ export default [ | |||
}, | |||
}, | |||
}, | |||
|
|||
// Typescript |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Typo]
// Typescript | |
// TypeScript |
package.json
Outdated
@@ -33,6 +33,8 @@ | |||
"got": "^14.4.1", | |||
"lint-staged": "^15.2.0", | |||
"prettier": "^3.1.1", | |||
"typescript": "^5.5.3", | |||
"typescript-eslint": "^8.0.0-alpha.45", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've released 8 as stable since last review! 🚀
"typescript-eslint": "^8.0.0-alpha.45", | |
"typescript-eslint": "^8.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated 🚀
packages/object-schema/src/types.ts
Outdated
validate: BuiltInValidationStrategy | ((value: any) => void); | ||
|
||
/** | ||
* The schema for the object value of this property. | ||
*/ | ||
// eslint-disable-next-line no-use-before-define -- Ignore for recursive type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Bug] As a general ideology, if a core ESLint rule is acting poorly on TypeScript syntax, it's likely there's a typescript-eslint rule corresponding to it. @typescript-eslint/no-use-before-define
is what you'd want to use in this case.
It's not enabled in any of typescript-eslint's recommended configs because it mostly acts as a stylistic rule when you already have TypeScript type checking enabled. My recommendation would be to turn off no-use-before-define
and leave it at that. But if you really want to have a lint rule, you'll want to go with https://typescript-eslint.io/rules/no-use-before-define/#how-to-use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've disabled the no-use-before-define
rule.
For this PR, let's focus on getting typescript-eslint enabled and working without modifying too much code. We can address my naive approaches to typing in follow-up PRs. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
Prerequisites checklist
What is the purpose of this pull request?
Enable linting for typescript files.
What changes did you make? (Give an overview)
no-use-before-define
rule.@typescript-eslint/no-explicit-any
for some generic types.Related Issues
Fix #69
Is there anything you'd like reviewers to focus on?
Currently
8.0.0-alpha.45
supports ESLint v9, we will need to update it later once a stable version is released.