refactor: fix a lot of errors in type-aware linting (#7477)

This commit is contained in:
Joshua Chen 2022-05-24 15:40:26 +08:00 committed by GitHub
parent 222bf3c091
commit bf1513a3e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
120 changed files with 407 additions and 364 deletions

View file

@ -89,7 +89,7 @@ export default function pluginPWA(
new webpack.EnvironmentPlugin({
PWA_DEBUG: debug,
PWA_SERVICE_WORKER_URL: path.posix.resolve(
`${config.output?.publicPath || '/'}`,
`${(config.output?.publicPath as string) || '/'}`,
'sw.js',
),
PWA_OFFLINE_MODE_ACTIVATION_STRATEGIES:
@ -102,7 +102,7 @@ export default function pluginPWA(
injectHtmlTags() {
const headTags: HtmlTags = [];
if (isProd && pwaHead) {
if (isProd) {
pwaHead.forEach(({tagName, ...attributes}) => {
(['href', 'content'] as const).forEach((attribute) => {
const attributeValue = attributes[attribute];
@ -160,7 +160,7 @@ export default function pluginPWA(
plugins: [
new webpack.EnvironmentPlugin({
// Fallback value required with Webpack 5
PWA_SW_CUSTOM: swCustom || '',
PWA_SW_CUSTOM: swCustom ?? '',
}),
new LogPlugin({
name: 'Service Worker',
@ -189,7 +189,7 @@ export default function pluginPWA(
'**/*.{png,jpg,jpeg,gif,svg,ico}',
'**/*.{woff,woff2,eot,ttf,otf}',
// @ts-expect-error: internal API?
...(injectManifest.globPatterns ?? []),
...((injectManifest.globPatterns as string[] | undefined) ?? []),
],
// Those attributes are not overrideable
swDest,