mirror of
https://github.com/go-gitea/gitea
synced 2025-11-13 17:58:15 +00:00
Fix a number of strictNullChecks-related issues (#35795)
In preparation to work on enabling https://www.typescriptlang.org/tsconfig/#strictNullChecks, I fixed all the issues outside of `web_src` that came up when the option was enabled. There was also one lint issue in web_src that apparently only came up with the option enabled, so I fixed that as well. `isTruthy` is introduced because Typescript has a bug regarding `filter(Boolean)` which they are seemingly unwilling to fix. --------- Signed-off-by: silverwind <me@silverwind.io>
This commit is contained in:
@@ -30,7 +30,7 @@ const isProduction = env.NODE_ENV !== 'development';
|
||||
// false - all disabled
|
||||
let sourceMaps;
|
||||
if ('ENABLE_SOURCEMAP' in env) {
|
||||
sourceMaps = ['true', 'false'].includes(env.ENABLE_SOURCEMAP) ? env.ENABLE_SOURCEMAP : 'reduced';
|
||||
sourceMaps = ['true', 'false'].includes(env.ENABLE_SOURCEMAP || '') ? env.ENABLE_SOURCEMAP : 'reduced';
|
||||
} else {
|
||||
sourceMaps = isProduction ? 'reduced' : 'true';
|
||||
}
|
||||
@@ -95,7 +95,7 @@ export default {
|
||||
path: fileURLToPath(new URL('public/assets', import.meta.url)),
|
||||
filename: () => 'js/[name].js',
|
||||
chunkFilename: ({chunk}) => {
|
||||
const language = (/monaco.*languages?_.+?_(.+?)_/.exec(String(chunk.id)) || [])[1];
|
||||
const language = (/monaco.*languages?_.+?_(.+?)_/.exec(String(chunk?.id)) || [])[1];
|
||||
return `js/${language ? `monaco-language-${language.toLowerCase()}` : `[name]`}.[contenthash:8].js`;
|
||||
},
|
||||
},
|
||||
@@ -270,7 +270,7 @@ export default {
|
||||
excludeAssets: [
|
||||
/^js\/monaco-language-.+\.js$/,
|
||||
!isProduction && /^licenses.txt$/,
|
||||
].filter(Boolean),
|
||||
].filter(Boolean as unknown as <T>(x: T | boolean) => x is T),
|
||||
groupAssetsByChunk: false,
|
||||
groupAssetsByEmitStatus: false,
|
||||
groupAssetsByInfo: false,
|
||||
|
||||
Reference in New Issue
Block a user