Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/prettier eslint #397

Merged
merged 5 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Comment on lines +46 to +47
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to dev dependencies

"express": "^4.17.1",
"express-fileupload": "^1.2.0",
"express-http-proxy": "^1.6.2",
Expand Down Expand Up @@ -92,7 +94,8 @@
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
"eslint:recommended",
"plugin:prettier/recommended"
],
"parserOptions": {
"parser": "babel-eslint"
Expand Down
1 change: 0 additions & 1 deletion src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint said path is never used, not sure if background.js uses it.


class Background {
constructor() {
Expand Down
1 change: 1 addition & 0 deletions src/electron/touchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
Expand Down
7 changes: 7 additions & 0 deletions src/locale/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export default {
albums: "Albums",
artists: "Artists",
mvs: "MVs",
newPlayList: "New Playlist",
userProfileMenu: {
settings: "Settings",
logout: "Logout",
},
},
explore: {
explore: "Explore",
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions src/locale/lang/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ export default {
albums: "专辑",
artists: "艺人",
mvs: "MV",
newPlayList: "新建歌单",
userProfileMenu: {
settings: "设置",
logout: "退出登录",
},
},
explore: {
explore: "发现",
Expand Down Expand Up @@ -130,6 +135,8 @@ export default {
automaticallyCacheSongs: "自动缓存歌曲",
clearSongsCache: "清除歌曲缓存",
cacheCount: "已缓存 {song} 首 ({size})",
showLyricsTranslation: "显示歌词翻译",
minimizeToTray: "最小化到托盘",
showGitHubIcon: "显示 GitHub 图标",
showUnavailableSongInGreyStyle: "显示不可播放的歌曲为灰色",
showPlaylistsByAppleMusic: "首页显示来自 Apple Music 的歌单",
Expand Down
7 changes: 4 additions & 3 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
16 changes: 9 additions & 7 deletions src/views/library.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions src/views/settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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">
Expand Down
24 changes: 24 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"

[email protected]:
version "2.1.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5"
Expand Down