-
-
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
Changes from all commits
cce44e0
02687f1
f13ff0d
965fc5a
46f6374
acf22f5
65850de
127544b
71e0c3f
810198c
600f71f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
declare module 'global'; | ||
declare module 'preval.macro'; | ||
declare module '@storybook/semver'; | ||
IanVS marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ import { checkWebpackVersion } from '@storybook/core-webpack'; | |
|
||
export * from './types'; | ||
|
||
let compilation: ReturnType<typeof webpackDevMiddleware>; | ||
let compilation: ReturnType<typeof webpackDevMiddleware> | undefined; | ||
let reject: (reason?: any) => void; | ||
|
||
type WebpackBuilder = Builder<Configuration, Stats>; | ||
|
@@ -72,7 +72,6 @@ export const bail: WebpackBuilder['bail'] = async () => { | |
} | ||
// we wait for the compiler to finish it's work, so it's command-line output doesn't interfere | ||
return new Promise((res, rej) => { | ||
// @ts-ignore (FIXME: should be expect-error but fails build --prep) | ||
if (process && compilation) { | ||
try { | ||
compilation.close(() => res()); | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. This changes the behavior a little since the original would throw if |
||
reject = stop; | ||
}); | ||
yield; | ||
|
@@ -219,10 +218,10 @@ const builder: BuilderFunction = async function* builderGeneratorFn({ startTime, | |
|
||
logger.trace({ message: '=> Preview built', time: process.hrtime(startTime) }); | ||
if (stats && stats.hasWarnings()) { | ||
// @ts-ignore (FIXME should be @ts-expect-error but fails build --prep) | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- we know it has warnings because of hasWarnings() | ||
stats | ||
.toJson({ warnings: true } as StatsOptions) | ||
.warnings.forEach((e) => logger.warn(e.message)); | ||
.warnings!.forEach((e) => logger.warn(e.message)); | ||
} | ||
|
||
// https://webpack.js.org/api/node/#run | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}, | ||
"include": ["src/**/*", "typings.d.ts"], | ||
"exclude": ["src/**.test.ts"] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
declare module 'pnp-webpack-plugin'; | ||
declare module '@storybook/semver'; | ||
declare module 'lazy-universal-dotenv'; |
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.