Skip to content

Commit

Permalink
🐞 fix(eslint): fix eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bingling-sama committed Jul 27, 2024
1 parent fa6bda4 commit b7771d0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
5 changes: 2 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo "running docs:tsc"
pnpm run docs:tsc
echo "running docs:eslint --fix"
pnpm run docs:eslint --fix
echo "running docs:format"
pnpm run docs:format
# echo "running docs:zhlint"
# pnpm run docs:zhlint
13 changes: 8 additions & 5 deletions .vitepress/theme/components/Analyzer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
loadMCLA,
MCLA_GH_DB_PREFIX,
} from "@/analyzers/mcla"
import type { ITarFileInfo } from "@gera2ld/tarjs"
// 类型&接口定义
interface SolutionOkSuccess {
Expand Down Expand Up @@ -343,24 +344,25 @@ async function readFiles(file: MemFile, filename?: string): Promise<MemFile[]> {
console.error(`Couldn't decompress file with ext ${ext}:`, error)
throw new AnalysisError("UnzipErr", error)
}
return readFiles(new MemFile(data, file.path), filebase)
case "tar": {
let files
try {
files = await new TarReader().readFile(data)
files = await TarReader.load(data)
} catch (error) {
console.error("Couldn't read the tar file:", error)
throw new AnalysisError("UnzipErr", error)
}
let res: MemFile[] = []
await Promise.all(
files
files.fileInfos
.filter(
(f) =>
(f: ITarFileInfo) =>
!f.name.startsWith("._") &&
!f.name.toLowerCase().startsWith("paxheader/"),
)
.map((f) =>
.map((f: ITarFileInfo) =>
readFiles(
new MemFile(
new Uint8Array(data.buffer, f.headerOffset + 512, f.size),
Expand Down Expand Up @@ -1163,7 +1165,8 @@ onUnmounted(() => {
<div>
<b>解决方案: </b>
<a target="_blank" :href="sol.res.link_to">
打开文档 <OpenTabIcon />
打开文档
<OpenTabIcon />
</a>
</div>
</details>
Expand Down
33 changes: 24 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,43 @@
"exclude": [
".vitepress/workers",
"node_modules",
"./node_modules",
"./node_modules/*",
"./.vitepress/analyzers/mcla.api.ts",
"./node_modules/@types/node/index.d.ts",
],
"compilerOptions": {
"baseUrl": ".",
"outDir": "out",
"jsx": "preserve",
"module": "ESNext",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"strict": true,
"strictNullChecks": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
// TODO: change this to true after https://github.com/T-miracle/vitepress-plugin-image-viewer/issues/4 is fixed
"noUnusedLocals": false,
"noUnusedParameters": true,
"noEmit": true,
"removeComments": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"verbatimModuleSyntax": true,
"skipLibCheck": true,
"ignoreDeprecations": "5.0",
"lib": [
"es2020",
"dom",
"DOM",
"ESNext"
],
"ignoreDeprecations": "5.0",
"baseUrl": ".",
"paths": {
"@/*": [
"./.vitepress/*"
],
},
"skipLibCheck": true,
"types": [
"vite-plugin-pwa/pwa-assets",
],
"verbatimModuleSyntax": false,
"outDir": "out",
},
"references": [
{
Expand Down

0 comments on commit b7771d0

Please sign in to comment.