mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-22 05:42:07 +08:00
chore: Feature/prettier eslint (#397)
* feat: add translations * refactor: use trinocular operators instead if * style: add prettier to eslint, fix lint errors * chore: add .gitattr
This commit is contained in:
parent
a25c874b7d
commit
52d7a2af26
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
* text eol=lf
|
|
@ -43,6 +43,8 @@
|
|||
"electron-log": "^4.3.0",
|
||||
"electron-store": "^6.0.1",
|
||||
"electron-updater": "^4.3.5",
|
||||
"eslint-config-prettier": "^8.1.0",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"express": "^4.17.1",
|
||||
"express-fileupload": "^1.2.0",
|
||||
"express-http-proxy": "^1.6.2",
|
||||
|
@ -92,7 +94,8 @@
|
|||
},
|
||||
"extends": [
|
||||
"plugin:vue/essential",
|
||||
"eslint:recommended"
|
||||
"eslint:recommended",
|
||||
"plugin:prettier/recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"parser": "babel-eslint"
|
||||
|
|
|
@ -12,7 +12,6 @@ import installExtension, { VUEJS_DEVTOOLS } from "electron-devtools-installer";
|
|||
import express from "express";
|
||||
import expressProxy from "express-http-proxy";
|
||||
import Store from "electron-store";
|
||||
import path from "path";
|
||||
|
||||
class Background {
|
||||
constructor() {
|
||||
|
|
|
@ -10,6 +10,7 @@ export function createTouchBar(window) {
|
|||
// Icon Resource: https://devimages-cdn.apple.com/design/resources/
|
||||
function getNativeIcon(name) {
|
||||
return nativeImage.createFromPath(
|
||||
// eslint-disable-next-line no-undef
|
||||
path.join(__static, "img/touchbar/", name)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,11 @@ export default {
|
|||
albums: "Albums",
|
||||
artists: "Artists",
|
||||
mvs: "MVs",
|
||||
newPlayList: "New Playlist",
|
||||
userProfileMenu: {
|
||||
settings: "Settings",
|
||||
logout: "Logout",
|
||||
},
|
||||
},
|
||||
explore: {
|
||||
explore: "Explore",
|
||||
|
@ -129,6 +134,8 @@ export default {
|
|||
automaticallyCacheSongs: "Automatically cache songs",
|
||||
clearSongsCache: "Clear Songs Cache",
|
||||
cacheCount: "Cached {song} songs ({size})",
|
||||
showLyricsTranslation: "Show lyrics translation",
|
||||
minimizeToTray: "Minimize to tray",
|
||||
showGitHubIcon: "Show GitHub icon",
|
||||
showUnavailableSongInGreyStyle: "Show unavailable song in grey style",
|
||||
showPlaylistsByAppleMusic: "Show playlists by Apple Music",
|
||||
|
|
|
@ -24,6 +24,11 @@ export default {
|
|||
albums: "专辑",
|
||||
artists: "艺人",
|
||||
mvs: "MV",
|
||||
newPlayList: "新建歌单",
|
||||
userProfileMenu: {
|
||||
settings: "设置",
|
||||
logout: "退出登录",
|
||||
},
|
||||
},
|
||||
explore: {
|
||||
explore: "发现",
|
||||
|
@ -130,6 +135,8 @@ export default {
|
|||
automaticallyCacheSongs: "自动缓存歌曲",
|
||||
clearSongsCache: "清除歌曲缓存",
|
||||
cacheCount: "已缓存 {song} 首 ({size})",
|
||||
showLyricsTranslation: "显示歌词翻译",
|
||||
minimizeToTray: "最小化到托盘",
|
||||
showGitHubIcon: "显示 GitHub 图标",
|
||||
showUnavailableSongInGreyStyle: "显示不可播放的歌曲为灰色",
|
||||
showPlaylistsByAppleMusic: "首页显示来自 Apple Music 的歌单",
|
||||
|
|
|
@ -26,9 +26,10 @@ const options = {
|
|||
const store = new Vuex.Store(options);
|
||||
|
||||
if ([undefined, null].includes(store.state.settings.lang)) {
|
||||
let lang = "en";
|
||||
if (navigator.language.slice(0, 2) === "zh") lang = "zh-CN";
|
||||
store.state.settings.lang = lang;
|
||||
const defaultLang = "en";
|
||||
// when more languages are available, use Map instead of prefer logic
|
||||
const preferChinese = navigator.language.slice(0, 2) === "zh";
|
||||
store.state.settings.lang = preferChinese ? "zh-CN" : defaultLang;
|
||||
localStorage.setItem("settings", JSON.stringify(store.state.settings));
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
icon="plus"
|
||||
v-show="currentTab === 'playlists'"
|
||||
@click="openAddPlaylistModal"
|
||||
><svg-icon icon-class="plus" />新建歌单</button
|
||||
><svg-icon icon-class="plus" />{{ $t("library.newPlayList") }}</button
|
||||
>
|
||||
</div>
|
||||
|
||||
|
@ -114,12 +114,14 @@
|
|||
</div>
|
||||
|
||||
<ContextMenu ref="userProfileMenu">
|
||||
<div class="item" @click="settings"
|
||||
><svg-icon icon-class="settings" />设置</div
|
||||
>
|
||||
<div class="item" @click="logout"
|
||||
><svg-icon icon-class="logout" />退出登录</div
|
||||
>
|
||||
<div class="item" @click="settings">
|
||||
<svg-icon icon-class="settings" />
|
||||
{{ $t("library.userProfileMenu.settings") }}
|
||||
</div>
|
||||
<div class="item" @click="logout">
|
||||
<svg-icon icon-class="logout" />
|
||||
{{ $t("library.userProfileMenu.logout") }}
|
||||
</div>
|
||||
</ContextMenu>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
</div>
|
||||
<div class="item">
|
||||
<div class="left">
|
||||
<div class="title">显示歌词翻译</div>
|
||||
<div class="title">{{ $t("settings.showLyricsTranslation") }}</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="toggle">
|
||||
|
@ -144,7 +144,7 @@
|
|||
</div>
|
||||
<div class="item" v-if="isElectron && !isMac">
|
||||
<div class="left">
|
||||
<div class="title">最小化到托盘</div>
|
||||
<div class="title">{{ $t("settings.minimizeToTray") }}</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="toggle">
|
||||
|
|
24
yarn.lock
24
yarn.lock
|
@ -4813,6 +4813,11 @@ escodegen@^1.8.1:
|
|||
optionalDependencies:
|
||||
source-map "~0.6.1"
|
||||
|
||||
eslint-config-prettier@^8.1.0:
|
||||
version "8.1.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.1.0.tgz#4ef1eaf97afe5176e6a75ddfb57c335121abc5a6"
|
||||
integrity sha512-oKMhGv3ihGbCIimCAjqkdzx2Q+jthoqnXSP+d86M9tptwugycmTFdVR4IpLgq2c4SHifbwO90z2fQ8/Aio73yw==
|
||||
|
||||
eslint-loader@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-loader/-/eslint-loader-2.2.1.tgz#28b9c12da54057af0845e2a6112701a2f6bf8337"
|
||||
|
@ -4824,6 +4829,13 @@ eslint-loader@^2.2.1:
|
|||
object-hash "^1.1.4"
|
||||
rimraf "^2.6.1"
|
||||
|
||||
eslint-plugin-prettier@^3.3.1:
|
||||
version "3.3.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.1.tgz#7079cfa2497078905011e6f82e8dd8453d1371b7"
|
||||
integrity sha512-Rq3jkcFY8RYeQLgk2cCwuc0P7SEFwDravPhsJZOQ5N4YI4DSg50NyqJ/9gdZHzQlHf8MvafSesbNJCcP/FF6pQ==
|
||||
dependencies:
|
||||
prettier-linter-helpers "^1.0.0"
|
||||
|
||||
eslint-plugin-vue@^6.2.2:
|
||||
version "6.2.2"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-6.2.2.tgz#27fecd9a3a24789b0f111ecdd540a9e56198e0fe"
|
||||
|
@ -5203,6 +5215,11 @@ fast-deep-equal@^3.1.1:
|
|||
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
|
||||
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
|
||||
|
||||
fast-diff@^1.1.2:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
|
||||
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==
|
||||
|
||||
fast-glob@^2.2.6:
|
||||
version "2.2.7"
|
||||
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d"
|
||||
|
@ -9166,6 +9183,13 @@ prepend-http@^2.0.0:
|
|||
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
|
||||
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=
|
||||
|
||||
prettier-linter-helpers@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
|
||||
integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==
|
||||
dependencies:
|
||||
fast-diff "^1.1.2"
|
||||
|
||||
prettier@2.1.2:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5"
|
||||
|
|
Loading…
Reference in New Issue
Block a user