Skip to content

Commit

Permalink
eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
gedoor committed Jul 25, 2023
1 parent 021e6bf commit 1eb6f96
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 38 deletions.
5 changes: 3 additions & 2 deletions modules/web/.eslintrc-auto-import.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"watch": true,
"watchEffect": true,
"watchPostEffect": true,
"watchSyncEffect": true
"watchSyncEffect": true,
"toValue": true
}
}
}
6 changes: 3 additions & 3 deletions modules/web/scripts/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from "node:fs";

const LEGADO_ASSETS_WEB_VUE_DIR = new URL(
"../../../app/src/main/assets/web/vue",
import.meta.url
import.meta.url,
);
const VUE_DIST_DIR = new URL("../dist", import.meta.url);

Expand Down Expand Up @@ -33,8 +33,8 @@ fs.rm(
throw error;
}
console.log("> cp success");
}
},
);
});
}
},
);
10 changes: 5 additions & 5 deletions modules/web/src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const saveBookProgressWithBeacon = (bookProgress) => {
// 常规请求可能会被取消 使用Fetch keep-alive 或者 navigator.sendBeacon
navigator.sendBeacon(
`${import.meta.env.VITE_API || location.origin}/saveBookProgress`,
JSON.stringify(bookProgress)
JSON.stringify(bookProgress),
);
};

Expand All @@ -41,19 +41,19 @@ const getChapterList = (/** @type {string} */ bookUrl) =>

const getBookContent = (
/** @type {string} */ bookUrl,
/** @type {number} */ chapterIndex
/** @type {number} */ chapterIndex,
) =>
ajax.get(
"/getBookContent?url=" +
encodeURIComponent(bookUrl) +
"&index=" +
chapterIndex
chapterIndex,
);

const search = (
/** @type {string} */ searchKey,
/** @type {(data: string) => void} */ onReceive,
/** @type {() => void} */ onFinish
/** @type {() => void} */ onFinish,
) => {
// webSocket
const url = `ws://${hostname}:${Number(port) + 1}/searchBook`;
Expand Down Expand Up @@ -97,7 +97,7 @@ const debug = (
/** @type {string} */ sourceUrl,
/** @type {string} */ searchKey,
/** @type {(data: string) => void} */ onReceive,
/** @type {() => void} */ onFinish
/** @type {() => void} */ onFinish,
) => {
// webSocket
const url = `ws://${hostname}:${Number(port) + 1}/${
Expand Down
1 change: 1 addition & 0 deletions modules/web/src/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ declare global {
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
Expand Down
2 changes: 1 addition & 1 deletion modules/web/src/components/BookItems.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const getCover = (coverUrl) => {
};
const subJustify = computed(() =>
props.isSearch ? "space-between" : "flex-start"
props.isSearch ? "space-between" : "flex-start",
);
</script>
Expand Down
14 changes: 9 additions & 5 deletions modules/web/src/components/ChapterContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const paragraphRef = ref();
const scrollToReadedLength = (length) => {
if (length === 0) return;
let paragraphIndex = chapterPos.value.findIndex(
(wordCount) => wordCount >= length
(wordCount) => wordCount >= length,
);
if (paragraphIndex === -1) return;
nextTick(() => {
Expand All @@ -81,14 +81,14 @@ onMounted(() => {
emit(
"readedLengthChange",
props.chapterIndex,
parseInt(target.dataset.chapterpos)
parseInt(target.dataset.chapterpos),
);
}
}
},
{
rootMargin: `0px 0px -${window.innerHeight - 24}px 0px`,
}
},
);
intersectionObserver.observe(titleRef.value);
paragraphRef.value.forEach((element) => {
Expand All @@ -105,8 +105,12 @@ onUnmounted(() => {
<style lang="scss" scoped>
.title {
margin-bottom: 57px;
font: 24px / 32px PingFangSC-Regular, HelveticaNeue-Light,
"Helvetica Neue Light", "Microsoft YaHei", sans-serif;
font:
24px / 32px PingFangSC-Regular,
HelveticaNeue-Light,
"Helvetica Neue Light",
"Microsoft YaHei",
sans-serif;
}
p {
Expand Down
8 changes: 6 additions & 2 deletions modules/web/src/components/PopCatalog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ onUpdated(() => {
//width: 50%;
height: 40px;
cursor: pointer;
font: 16px / 40px PingFangSC-Regular, HelveticaNeue-Light,
"Helvetica Neue Light", "Microsoft YaHei", sans-serif;
font:
16px / 40px PingFangSC-Regular,
HelveticaNeue-Light,
"Helvetica Neue Light",
"Microsoft YaHei",
sans-serif;
}
}
Expand Down
13 changes: 10 additions & 3 deletions modules/web/src/components/ReadSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,10 @@ const uploadConfig = (config) => {
list-style: none outside none;
i {
font: 12px / 16px PingFangSC-Regular, "-apple-system", Simsun;
font:
12px / 16px PingFangSC-Regular,
"-apple-system",
Simsun;
display: inline-block;
min-width: 48px;
margin-right: 16px;
Expand Down Expand Up @@ -410,8 +413,12 @@ const uploadConfig = (config) => {
text-align: center;
vertical-align: middle;
display: inline-block;
font: 14px / 34px PingFangSC-Regular, HelveticaNeue-Light,
"Helvetica Neue Light", "Microsoft YaHei", sans-serif;
font:
14px / 34px PingFangSC-Regular,
HelveticaNeue-Light,
"Helvetica Neue Light",
"Microsoft YaHei",
sans-serif;
}
.font-item-input {
width: 168px;
Expand Down
4 changes: 2 additions & 2 deletions modules/web/src/components/SourceDebug.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ watch(
() => store.isDebuging,
() => {
if (store.isDebuging) startDebug();
}
},
);
const appendDebugMsg = (msg) => {
Expand All @@ -46,7 +46,7 @@ const startDebug = async () => {
store.currentSourceUrl,
searchKey.value || store.searchKey,
appendDebugMsg,
store.debugFinish
store.debugFinish,
);
};
Expand Down
6 changes: 3 additions & 3 deletions modules/web/src/components/ToolBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ const buttons = ref(
{ name: "↶撤销操作", hotKeys: [], action: undo },
{ name: "↷重做操作", hotKeys: [], action: redo },
{ name: "⇏调试源", hotKeys: [], action: debug },
{ name: "✓保存源", hotKeys: [], action: saveSource }
)
{ name: "✓保存源", hotKeys: [], action: saveSource },
),
);
const hotkeysDialogVisible = ref(true);
Expand Down Expand Up @@ -250,7 +250,7 @@ watch(
buttons.value[recordKeyDownIndex.value].hotKeys = pressedKeys;
});
},
{ immediate: true }
{ immediate: true },
);
const recordKeyDown = (index) => {
Expand Down
18 changes: 11 additions & 7 deletions modules/web/src/views/BookChapter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ const checkPageWidth = (readWidth) => {
};
watch(
() => store.config.readWidth,
(width) => checkPageWidth(width)
(width) => checkPageWidth(width),
);
// 顶部底部跳转
const top = ref();
Expand Down Expand Up @@ -285,8 +285,8 @@ const getContent = (index, reloadChapter = true, chapterPos = 0) => {
chapterData.value.push({ index, content, title });
store.setShowContent(true);
throw err;
}
)
},
),
);
};
Expand Down Expand Up @@ -498,8 +498,8 @@ onMounted(() => {
(err) => {
ElMessage({ message: "获取书籍目录失败", type: "error" });
throw err;
}
)
},
),
);
});
Expand Down Expand Up @@ -624,7 +624,9 @@ onUnmounted(() => {
.day {
:deep(.popup) {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
box-shadow:
0 2px 4px rgba(0, 0, 0, 0.12),
0 0 6px rgba(0, 0, 0, 0.04);
}
:deep(.tool-icon) {
Expand All @@ -645,7 +647,9 @@ onUnmounted(() => {
.night {
:deep(.popup) {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.48), 0 0 6px rgba(0, 0, 0, 0.16);
box-shadow:
0 2px 4px rgba(0, 0, 0, 0.48),
0 0 6px rgba(0, 0, 0, 0.16);
}
:deep(.tool-icon) {
Expand Down
10 changes: 5 additions & 5 deletions modules/web/src/views/BookShelf.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
readingRecent.name,
readingRecent.author,
readingRecent.chapterIndex,
readingRecent.chapterPos
readingRecent.chapterPos,
)
"
:class="{ 'no-point': readingRecent.url == '' }"
Expand Down Expand Up @@ -100,7 +100,7 @@ const readingRecent = ref({
const shelfWrapper = ref(null);
const { showLoading, closeLoading, loadingWrapper } = useLoading(
shelfWrapper,
"正在获取书籍信息"
"正在获取书籍信息",
);
const books = ref([]);
Expand Down Expand Up @@ -144,7 +144,7 @@ const searchBook = () => {
if (books.value.length == 0) {
ElMessage.info("搜索结果为空");
}
}
},
);
};
Expand Down Expand Up @@ -195,7 +195,7 @@ onMounted(() => {
store
.saveBookProgress()
//确保各种网络情况下同步请求先完成
.finally(fetchBookShelfData)
.finally(fetchBookShelfData),
);
});
const fetchBookShelfData = () => {
Expand All @@ -209,7 +209,7 @@ const fetchBookShelfData = () => {
var x = a["durChapterTime"] || 0;
var y = b["durChapterTime"] || 0;
return y - x;
})
}),
);
} else {
ElMessage.error(response.data.errorMsg);
Expand Down

0 comments on commit 1eb6f96

Please sign in to comment.