Enable more ESLint rules

This commit is contained in:
Pig Fang 2018-08-16 14:50:11 +08:00
parent c3f8044743
commit 298dfc1064
3 changed files with 19 additions and 3 deletions

View File

@ -38,10 +38,26 @@ rules:
prefer-const: warn
no-var: error
eqeqeq: error
block-spacing: error
brace-style:
- error
- 1tbs
- allowSingleLine: true
comma-spacing: error
indent:
- error
- 4
- SwitchCase: 1
key-spacing:
- error
- mode: minimum
keyword-spacing: error
space-before-blocks: error
space-infix-ops: error
no-unused-expressions:
- error
- allowShortCircuit: true
allowTernary: true
vue/html-closing-bracket-newline:
- error
- singleline: never

View File

@ -21,7 +21,7 @@ export function trans(key, parameters = {}) {
for (const i in parameters) {
if (parameters[i] !== undefined) {
temp = temp.replace(':'+i, parameters[i]);
temp = temp.replace(':' + i, parameters[i]);
}
}

View File

@ -18,9 +18,9 @@ export function debounce(func, delay) {
* @return {string}
*/
export function queryString(key, defaultValue) {
const result = location.search.match(new RegExp('[?&]'+key+'=([^&]+)', 'i'));
const result = location.search.match(new RegExp('[?&]' + key + '=([^&]+)', 'i'));
if (result === null || result.length < 1){
if (result === null || result.length < 1) {
return defaultValue;
} else {
return result[1];