Refine code

This commit is contained in:
CzBiX
2020-04-01 12:57:42 +08:00
parent 2507e126c4
commit 6a518c31c5
4 changed files with 16 additions and 3 deletions

View File

@@ -1,3 +1,5 @@
const isProdEnv = process.env.NODE_ENV === 'production';
module.exports = {
root: true,
env: {
@@ -11,8 +13,8 @@ module.exports = {
'@vue/typescript/recommended',
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-console': isProdEnv ? 'error' : 'warn',
'no-debugger': isProdEnv ? 'error' : 'warn',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',

View File

@@ -15,6 +15,7 @@
"axios": "^0.19.2",
"core-js": "^3.6.4",
"dayjs": "^1.8.23",
"debug": "^4.1.1",
"lodash": "^4.17.15",
"node-polyglot": "^2.4.0",
"roboto-fontface": "*",
@@ -26,6 +27,7 @@
"vuex": "^3.1.3"
},
"devDependencies": {
"@types/debug": "^4.1.5",
"@types/jest": "^24.9.1",
"@types/lodash": "^4.14.149",
"@typescript-eslint/eslint-plugin": "^2.25.0",

View File

@@ -1,3 +1,7 @@
import debug from 'debug';
const log = debug('app:protocolHandler');
function registerProtocolHandler() {
if (!('registerProtocolHandler' in navigator)) {
return;
@@ -6,7 +10,7 @@ function registerProtocolHandler() {
try {
navigator.registerProtocolHandler('magnet', location.origin + '#url=%s', document.title);
} catch (e) {
console.log('Register protocol handler failed.', e);
log('Register protocol handler failed.', e);
}
}

View File

@@ -1205,6 +1205,11 @@
resolved "https://registry.npm.taobao.org/@types/color-name/download/@types/color-name-1.1.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fcolor-name%2Fdownload%2F%40types%2Fcolor-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
integrity sha1-HBJhu+qhCoBVu8XYq4S3sq/IRqA=
"@types/debug@^4.1.5":
version "4.1.5"
resolved "https://registry.npm.taobao.org/@types/debug/download/@types/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd"
integrity sha1-sU76iFK3do2JiQZhPCP2iHE+As0=
"@types/eslint-visitor-keys@^1.0.0":
version "1.0.0"
resolved "https://registry.npm.taobao.org/@types/eslint-visitor-keys/download/@types/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d"