Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
tingyuan committed Oct 28, 2024
1 parent 5d8cb5c commit e84981f
Show file tree
Hide file tree
Showing 10 changed files with 3,210 additions and 74 deletions.
8 changes: 4 additions & 4 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
import vueTsEslintConfig from '@vue/eslint-config-typescript'
import simpleImportSort from 'eslint-plugin-simple-import-sort'
// import sonarjs from 'eslint-plugin-sonarjs'
import sonarjs from 'eslint-plugin-sonarjs'
import pluginVue from 'eslint-plugin-vue'
// sonarjs.configs.recommended.plugins = { sonarjs }
import tseslint from 'typescript-eslint'

export default tseslint.config(
Expand Down Expand Up @@ -37,7 +36,7 @@ export default tseslint.config(
'@typescript-eslint/no-require-imports': 'off'
}
},
// sonarjs.configs.recommended,
sonarjs.configs.recommended,
...pluginVue.configs['flat/recommended'],
...vueTsEslintConfig(),
skipFormatting,
Expand All @@ -59,7 +58,8 @@ export default tseslint.config(
shouldMatchCase: true
}
],
'vue/component-definition-name-casing': ['error', 'PascalCase']
'vue/component-definition-name-casing': ['error', 'PascalCase'],
'sonarjs/no-vue-bypass-sanitization': 'warn'
}
}
)
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"knip": "npx -y knip@latest -c scripts/knip.ts"
},
"dependencies": {
"@vueuse/core": "^11.0.3",
"github-markdown-css": "^5.6.1",
"@vueuse/core": "^11.1.0",
"github-markdown-css": "^5.7.0",
"iconify-icon": "^2.1.0",
"vue": "^3.5.0",
"vue-router": "^4.4.0"
Expand All @@ -32,8 +32,8 @@
"@happy-dom/global-registrator": "^15.7.3",
"@iconify/vue": "^4.1.2",
"@rushstack/eslint-patch": "^1.10.2",
"@shikijs/markdown-it": "^1.9.1",
"@total-typescript/ts-reset": "^0.5.1",
"@shikijs/markdown-it": "^1.22.1",
"@total-typescript/ts-reset": "^0.6.1",
"@tsconfig/node20": "^20.1.4",
"@types/html-minifier-terser": "^7.0.2",
"@types/markdown-it-container": "^2.0.9",
Expand All @@ -48,7 +48,7 @@
"daisyui": "^4.12.10",
"eslint": "^9.13.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sonarjs": "^0.25.1",
"eslint-plugin-sonarjs": "^2.0.4",
"eslint-plugin-vue": "^9.29.0",
"globals": "^15.11.0",
"html-minifier-terser": "^7.2.0",
Expand Down
3,238 changes: 3,185 additions & 53 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/js/tampermonkey-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
let [current, finished] = [0, 0]
const total = tasks.length
const doTask = () => {
// eslint-disable-next-line sonarjs/no-nested-functions
tasks[current++]?.().finally(() => {
if (++finished === total) {
resolve()
Expand Down
1 change: 1 addition & 0 deletions scripts/build-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default (): Plugin => {
hour12: false,
timeZone: 'Asia/Shanghai'
}).format(new Date())
// eslint-disable-next-line sonarjs/no-os-command-from-path
const gitHash = cp.execSync('git rev-parse HEAD').toString('utf8').trim().slice(0, 8)
return {
name: 'inject-build-info-plugin',
Expand Down
3 changes: 2 additions & 1 deletion scripts/prerender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export default (options?: {
if (Array.isArray(routesToPrerender)) {
routesToPrerender = routesToPrerender.reduce(
(a, b) => {
a[b] = b === '/' ? defaultPage : (b[0] === '/' ? b.slice(1) : b) + '.html'
const page = (b[0] === '/' ? b.slice(1) : b) + '.html'
a[b] = b === '/' ? defaultPage : page
return a
},
{} as Record<string, string>
Expand Down
2 changes: 1 addition & 1 deletion src/blogs/LeetcodeFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</label>
</div>
</div>
<!-- eslint-disable-next-line vue/no-v-html -->
<!-- eslint-disable-next-line vue/no-v-html sonarjs/no-vue-bypass-sanitization -->
<div data-leetcode-problems-filter v-html="css"></div>
</template>

Expand Down
19 changes: 10 additions & 9 deletions src/collection/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ for (const cate of lists) {
.map((v) => {
// eslint-disable-next-line prefer-const
let [title, url] = v.split(': ').map((v) => v.trim())
let description = ''
if (title.includes('(')) {
const [, title2, description2] = title.match(/(.+)\((.+)\)/) || []
if (title2 && description2) {
;[title, description] = [title2, description2]
}
}
// let description = ''
// console.log(title)
// if (title.includes('(')) {
// const [, title2, description2] = title.match(/(.+)\((.+)\)/) || []
// if (title2 && description2) {
// ;[title, description] = [title2, description2]
// }
// }
return {
title,
url,
description
url
// description
}
})
}
Expand Down
1 change: 0 additions & 1 deletion src/components/CollectionSites.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
class="float-right"
:href="`https://github.com/lovetingyuan/lovetingyuan.github.io/edit/main/src/collection/${cate}.txt`"
>
<!-- <icon-material-symbols-add class="align-sub" /> -->
<IconifyIcon icon="material-symbols:add" class="align-sub text-lg"></IconifyIcon>
</a>
</summary>
Expand Down
1 change: 1 addition & 0 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const useDocument = (url: string, html: string) => {
document.write(html.replace(DocType, ''))
return (rendered: string) => {
const container = document.querySelector('#app')
// eslint-disable-next-line sonarjs/pseudo-random
const id = Math.random().toString()
if (container) {
container.innerHTML = id
Expand Down

0 comments on commit e84981f

Please sign in to comment.