-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Enforce @ts-expect-error via eslint #19198
Enforce @ts-expect-error via eslint #19198
Conversation
…-734-add-eslint-rule-to-enforce-ts-expect
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-nocheck |
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.
looks like ts-nocheck
is actually valid here because of the decorators, so I've allowed it.
@@ -134,7 +133,7 @@ const starter: StarterFunction = async function* starterGeneratorFn({ | |||
router.use(webpackHotMiddleware(compiler as any)); | |||
|
|||
const stats = await new Promise<Stats>((ready, stop) => { | |||
compilation.waitUntilValid(ready as any); | |||
compilation?.waitUntilValid(ready as any); |
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.
This changes the behavior a little since the original would throw if compilation
was undefined while this fails silently. But since compilation
is being defined above I think that's okay.
@@ -1,7 +1,8 @@ | |||
{ | |||
"extends": "../../tsconfig.json", | |||
"compilerOptions": { | |||
"strict": true | |||
"strict": true, | |||
"skipLibCheck": true |
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.
case-sensitive-paths-webpack-plugin
has transitive types issues with webpack5 which we want to ignore because we can't do anything about it. Reading the issues in the repo makes it seem like there might actually be some issues with it and webpack5.
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.
Nice cleanup!
…nt-rule-to-enforce-ts-expect
The Vite sandbox failures here are not related to this PR, FWIW. |
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 first PR @JReinhold 💯
What I did
This PR continues work from #19122 and #19168 and changes the ESLint rule
@typescript-eslint/ban-ts-comment
fromwarn
toerror
to reduce the number of@ts-ignore
s in the future.To achieve this, a few TypeScript errors had to be fixed all over the code base. Some where missing types that got added or ignored while other places I fixed the actual errors that TypeScript reported.
How to test
./bootstrap.sh --prep
successfully../bootstrap.sh --build
successfully.cd code && yarn lint:js
successfully.