Update lint rules

This commit is contained in:
CzBiX
2020-11-26 15:45:37 +08:00
parent 0264fc180e
commit 42b1493931
19 changed files with 56 additions and 54 deletions

View File

@@ -16,12 +16,14 @@ module.exports = {
'no-console': isProdEnv ? 'error' : 'warn',
'no-debugger': isProdEnv ? 'error' : 'warn',
"comma-dangle": ["error", "always-multiline"],
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'vue/singleline-html-element-content-newline': ['warn', {
ignores: ['pre', 'textarea', 'span', 'v-icon'],
}]
}],
},
parserOptions: {
parser: '@typescript-eslint/parser',

View File

@@ -311,7 +311,7 @@ class Api {
{
pattern: pattern || '',
category: categoryName || 'all',
plugins: pluginName || 'all'
plugins: pluginName || 'all',
});
return this.axios.post('/search/start', body).then(Api.handleResponse);
}
@@ -329,7 +329,7 @@ class Api {
public enablePlugin(plugin: SearchPlugin, enable: boolean) {
const body = new URLSearchParams({
names: plugin.name,
enable: JSON.stringify(enable)
enable: JSON.stringify(enable),
});
return this.axios.post('/search/enablePlugin', body).then(Api.handleResponse);

View File

@@ -117,7 +117,7 @@ let appWrapEl: HTMLElement;
'setPasteUrl',
'updateNeedAuth',
]),
}
},
})
export default class App extends Vue {
drawer = true

View File

@@ -228,7 +228,7 @@ const defaultParams = {
...mapState({
pasteUrl: 'pasteUrl',
prefs: 'preferences',
state: 'addForm'
state: 'addForm',
}),
...mapGetters({
allCategories: 'allCategories',
@@ -239,7 +239,7 @@ const defaultParams = {
'closeAddForm',
'openAddForm',
]),
}
},
})
export default class AddForm extends Vue {
valid = false

View File

@@ -170,12 +170,12 @@ export default class Drawer extends Vue {
const searchMenuItem = {
icon: 'mdi-card-search-outline',
title: tr('search'),
click: () => this.updateOptions('showSearch', true)
click: () => this.updateOptions('showSearch', true),
};
if (this.phoneLayout) {
this.endItems = this.endItems.concat([
searchMenuItem
searchMenuItem,
]);
return;

View File

@@ -29,14 +29,14 @@ import { mapActions, mapState } from "vuex";
@Component({
computed: {
...mapState({
searchEngineState: "searchEngine"
})
searchEngineState: "searchEngine",
}),
},
methods: {
...mapActions({
togglePluginAvailabilityAction: "togglePluginAvailability"
})
}
togglePluginAvailabilityAction: "togglePluginAvailability",
}),
},
})
export default class PluginsManager extends Vue {
searchEngineState!: SearchEnginePage;

View File

@@ -78,20 +78,20 @@ interface GridConfig {
@Component({
components: {
SearchDialogForm,
PluginManager
PluginManager,
},
computed: {
...mapGetters({
allCategories: "allCategories",
preferences: "preferences"
})
preferences: "preferences",
}),
},
methods: {
...mapMutations(["openAddForm", "setPasteUrl", "addFormDownloadItem", "openPluginManager"]),
...mapActions({
loadSearchPlugins: 'fetchSearchPlugins'
})
}
loadSearchPlugins: 'fetchSearchPlugins',
}),
},
})
export default class SearchDialog extends HasTask {
private _searchId = 0;
@@ -108,7 +108,7 @@ export default class SearchDialog extends HasTask {
fileUrl: "",
nbLeechers: 0,
nbSeeders: 0,
siteUrl: ""
siteUrl: "",
},
headers: [
{ text: tr("name"), value: "fileName" },
@@ -116,8 +116,8 @@ export default class SearchDialog extends HasTask {
{ text: tr("seeds"), value: "nbSeeders" },
{ text: tr("peers"), value: "nbLeechers" },
{ text: tr("search_engine"), value: "siteUrl" },
{ text: tr("action", 2), value: "actions", sortable: false }
]
{ text: tr("action", 2), value: "actions", sortable: false },
],
};
loading = false;
@@ -136,8 +136,8 @@ export default class SearchDialog extends HasTask {
this.addFormDownloadItem({
downloadItem: {
title: item.fileName,
url: item.fileUrl
}
url: item.fileUrl,
},
});
this.openAddForm();
}
@@ -171,7 +171,7 @@ export default class SearchDialog extends HasTask {
const result = await api.startSearch(
searchForm.pattern,
searchForm.plugins,
searchForm.category
searchForm.category,
);
return result;

View File

@@ -122,7 +122,7 @@ const ALL_KEY = "all";
const ALL_CATEGORY: Category = {
key: ALL_KEY,
name: tr("all")
name: tr("all"),
};
interface Category {
@@ -140,8 +140,8 @@ export interface SearchForm {
@Component({
computed: {
...mapGetters({
searchPlugins: "allSearchPlugins"
})
searchPlugins: "allSearchPlugins",
}),
},
})
export default class SearchDialogForm extends Vue {
@@ -159,7 +159,7 @@ export default class SearchDialogForm extends Vue {
valid: false,
category: ALL_KEY,
pattern: "",
plugins: []
plugins: [],
};
get hasSelectAllPlugins() {
@@ -174,7 +174,7 @@ export default class SearchDialogForm extends Vue {
const result: Category[] = [ALL_CATEGORY, { divider: true } as any];
const categories = intersection(
...this.searchForm.plugins.map(p => p.supportedCategories)
...this.searchForm.plugins.map(p => p.supportedCategories),
).map(c => ({ key: c, name: c }));
result.push(...categories);
@@ -206,7 +206,7 @@ export default class SearchDialogForm extends Vue {
: this.searchForm.plugins.map(p => p.name).join("|");
const searchForm = Object.assign({}, this.searchForm, {
plugins
plugins,
});
return searchForm;

View File

@@ -160,7 +160,7 @@ export default class DrawerFooter extends Vue {
text: tr('auto'),
value: 'auto',
},
...locales
...locales,
]
}

View File

@@ -109,7 +109,7 @@ export default {
dialog: {
trigger_exit_qb: {
title: 'Exit qBittorrent',
text: 'Are you sure you want to exit qBittorrent?'
text: 'Are you sure you want to exit qBittorrent?',
},
add_torrents: {
placeholder: 'Upload torrents by drop them here,\nor click attachment button at right to select.',
@@ -167,5 +167,5 @@ export default {
active: 'Active',
inactive: 'Inactive',
errored: 'Errored',
}
},
}

View File

@@ -14,7 +14,7 @@ export const translations = {
export type LocaleKey = keyof typeof translations | null;
const polyglot = new Polyglot({
phrases: translations.en
phrases: translations.en,
});
function matchLocale() {

View File

@@ -109,7 +109,7 @@ export default {
dialog: {
trigger_exit_qb: {
title: 'Выйти из qBittorrent',
text: 'Выйти из qBittorrent?'
text: 'Выйти из qBittorrent?',
},
add_torrents: {
placeholder: 'Начните скачивать торренты, переместив их сюда,\nили нажмите кнопку вложения справа, чтобы выбрать.',
@@ -167,5 +167,5 @@ export default {
active: 'Активный',
inactive: 'Не активный',
errored: 'Ошибочный',
}
},
}

View File

@@ -106,7 +106,7 @@ export default {
dialog: {
trigger_exit_qb: {
title: '退出 qBittorrent',
text: '您确定要退出qBittorrent吗'
text: '您确定要退出qBittorrent吗',
},
add_torrents: {
placeholder: '将种子拖到这里上传,\n或者点击右边的附件图标来选择。',
@@ -164,5 +164,5 @@ export default {
active: '活动',
inactive: '空闲',
errored: '错误',
}
},
}

View File

@@ -7,7 +7,7 @@ if (process.env.NODE_ENV === 'production') {
ready () {
console.log(
'App is being served from cache by a service worker.\n' +
'For more details, visit https://goo.gl/AFskqB'
'For more details, visit https://goo.gl/AFskqB',
)
},
registered () {
@@ -27,6 +27,6 @@ if (process.env.NODE_ENV === 'production') {
},
error (error) {
console.error('Error during service worker registration:', error)
}
},
})
}

View File

@@ -5,13 +5,13 @@ export const addFormStore: Module<AddFormState, any> = {
state() {
return {
isOpen: false,
downloadItem: null
downloadItem: null,
};
},
getters: {
isOpen(state) {
return state.isOpen;
}
},
},
mutations: {
openAddForm(state) {
@@ -24,6 +24,6 @@ export const addFormStore: Module<AddFormState, any> = {
addFormDownloadItem(state, payload) {
const { downloadItem } = payload;
state.downloadItem = downloadItem;
}
},
},
};

View File

@@ -26,5 +26,5 @@ export const dialogStore: Module<DialogState, any> = {
commit('showDialog', options);
})
},
}
},
};

View File

@@ -21,7 +21,7 @@ const store = new Vuex.Store<RootState>({
dialog: dialogStore,
snackBar: snackBarStore,
addForm: addFormStore,
searchEngine: searchEngineStore
searchEngine: searchEngineStore,
},
state: {
rid: 0,

View File

@@ -6,7 +6,7 @@ import api from "@/Api";
export default {
state: {
searchPlugins: [],
isPluginManagerOpen: false
isPluginManagerOpen: false,
},
mutations: {
setSearchPlugins(state, plugins: SearchPlugin[] | undefined | null) {
@@ -17,12 +17,12 @@ export default {
},
closePluginManager(state) {
state.isPluginManagerOpen = false;
}
},
},
getters: {
allSearchPlugins(state): SearchPlugin[] | undefined | null {
return state.searchPlugins;
}
},
},
actions: {
fetchSearchPlugins({ dispatch }) {
@@ -60,6 +60,6 @@ export default {
},
enablePluginRequestSuccess({ dispatch }) {
dispatch('fetchSearchPlugins'); // refresh the plugins
}
}
},
},
} as Module<SearchEnginePage, any>;

View File

@@ -17,7 +17,7 @@ module.exports = {
},
workboxOptions: {
importWorkboxFrom: 'local',
}
},
},
devServer: {
@@ -34,10 +34,10 @@ module.exports = {
let arg = args[0]
arg = {
...arg,
'process.env.GIT_TAG': JSON.stringify(process.env.GIT_TAG)
'process.env.GIT_TAG': JSON.stringify(process.env.GIT_TAG),
}
return [arg]
})
}
},
};