HM-41. Доработан RouteService для работы с query (#13)
This commit is contained in:
125
.eslintrc.json
125
.eslintrc.json
@ -15,47 +15,49 @@
|
|||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-console": "warn",
|
"no-console": "warn",
|
||||||
"semi": "error",
|
"semi": "warn",
|
||||||
"quotes": ["error", "single"],
|
"quotes": ["warn", "single"],
|
||||||
"array-callback-return": [
|
"array-callback-return": [
|
||||||
"error",
|
"warn",
|
||||||
{
|
{
|
||||||
"allowImplicit": true,
|
"allowImplicit": true,
|
||||||
"checkForEach": true
|
"checkForEach": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"no-trailing-spaces": "warn",
|
||||||
|
"no-unused-vars": "warn",
|
||||||
"default-case": "warn",
|
"default-case": "warn",
|
||||||
"default-param-last": "error",
|
"default-param-last": "warn",
|
||||||
"no-alert": "warn",
|
"no-alert": "warn",
|
||||||
"no-constructor-return": "error",
|
"no-constructor-return": "warn",
|
||||||
"no-else-return": "error",
|
"no-else-return": "warn",
|
||||||
"no-empty-function": "error",
|
"no-empty-function": "warn",
|
||||||
"no-multi-spaces": "error",
|
"no-multi-spaces": "warn",
|
||||||
"no-multi-str": "error",
|
"no-multi-str": "warn",
|
||||||
"no-new": "error",
|
"no-new": "warn",
|
||||||
"no-param-reassign": "error",
|
"no-param-reassign": "warn",
|
||||||
"no-sequences": "error",
|
"no-sequences": "warn",
|
||||||
"no-useless-concat": "error",
|
"no-useless-concat": "warn",
|
||||||
"prefer-promise-reject-errors": "error",
|
"prefer-promise-reject-errors": "warn",
|
||||||
"require-await": "error",
|
"require-await": "warn",
|
||||||
"wrap-iife": ["error", "inside"],
|
"wrap-iife": ["warn", "inside"],
|
||||||
"yoda": "error",
|
"yoda": "warn",
|
||||||
"no-shadow": "error",
|
"no-shadow": "warn",
|
||||||
"no-use-before-define": "error",
|
"no-use-before-define": "warn",
|
||||||
"array-bracket-spacing": ["error", "never"],
|
"array-bracket-spacing": ["warn", "never"],
|
||||||
"block-spacing": ["error", "never"],
|
"block-spacing": ["warn", "never"],
|
||||||
"brace-style": ["error", "1tbs", {"allowSingleLine": true}],
|
"brace-style": ["warn", "1tbs", {"allowSingleLine": true}],
|
||||||
"capitalized-comments": ["error"],
|
"capitalized-comments": ["warn"],
|
||||||
"comma-dangle": ["error", "only-multiline"],
|
"comma-dangle": ["warn", "only-multiline"],
|
||||||
"comma-spacing": ["error", {"before": false, "after": true}],
|
"comma-spacing": ["warn", {"before": false, "after": true}],
|
||||||
"computed-property-spacing": ["error", "never"],
|
"computed-property-spacing": ["warn", "never"],
|
||||||
"eol-last": ["error", "always"],
|
"eol-last": ["warn", "always"],
|
||||||
"func-call-spacing": ["error", "never"],
|
"func-call-spacing": ["warn", "never"],
|
||||||
"func-style": ["error", "expression"],
|
"func-style": ["warn", "expression"],
|
||||||
"indent": ["error", 4],
|
"indent": ["warn", 4],
|
||||||
"keyword-spacing": ["error", {"before": true}],
|
"keyword-spacing": ["warn", {"before": true}],
|
||||||
"line-comment-position": ["error", {"position": "above"}],
|
"line-comment-position": ["warn", {"position": "above"}],
|
||||||
"lines-between-class-members": ["error", "always"],
|
"lines-between-class-members": ["warn", "always"],
|
||||||
"max-len": [
|
"max-len": [
|
||||||
"warn",
|
"warn",
|
||||||
{
|
{
|
||||||
@ -67,34 +69,33 @@
|
|||||||
"ignoreRegExpLiterals": true
|
"ignoreRegExpLiterals": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"multiline-comment-style": ["error", "starred-block"],
|
"multiline-comment-style": ["warn", "starred-block"],
|
||||||
"new-cap": "error",
|
"new-cap": "warn",
|
||||||
"new-parens": "error",
|
"new-parens": "warn",
|
||||||
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 1 }],
|
"newline-per-chained-call": ["warn", { "ignoreChainWithDepth": 1 }],
|
||||||
"no-bitwise": "error",
|
"no-bitwise": "warn",
|
||||||
"no-inline-comments": "error",
|
"no-inline-comments": "warn",
|
||||||
"no-lonely-if": "error",
|
"no-lonely-if": "warn",
|
||||||
"no-multi-assign": "error",
|
"no-multi-assign": "warn",
|
||||||
"no-multiple-empty-lines": ["error", { "max": 1}],
|
"no-multiple-empty-lines": ["warn", { "max": 1}],
|
||||||
"no-nested-ternary": "error",
|
"no-nested-ternary": "warn",
|
||||||
"no-plusplus": "error",
|
"no-plusplus": "warn",
|
||||||
"no-trailing-spaces": "error",
|
"object-curly-spacing": ["warn", "never"],
|
||||||
"object-curly-spacing": ["error", "never"],
|
"object-property-newline": ["warn", { "allowAllPropertiesOnSameLine": true }],
|
||||||
"object-property-newline": ["error", { "allowAllPropertiesOnSameLine": true }],
|
"key-spacing": ["warn", { "beforeColon": false, "afterColon": true }],
|
||||||
"key-spacing": ["error", { "beforeColon": false, "afterColon": true }],
|
"space-before-blocks": "warn",
|
||||||
"space-before-blocks": "error",
|
"space-before-function-paren": ["warn", "always"],
|
||||||
"space-before-function-paren": ["error", "always"],
|
"space-in-parens": ["warn", "never"],
|
||||||
"space-in-parens": ["error", "never"],
|
"space-infix-ops": "warn",
|
||||||
"space-infix-ops": "error",
|
"arrow-parens": ["warn", "always"],
|
||||||
"arrow-parens": ["error", "always"],
|
"arrow-spacing": "warn",
|
||||||
"arrow-spacing": "error",
|
"no-duplicate-imports": "warn",
|
||||||
"no-duplicate-imports": "error",
|
"no-useless-computed-key": "warn",
|
||||||
"no-useless-computed-key": "error",
|
"no-useless-constructor": "warn",
|
||||||
"no-useless-constructor": "error",
|
"no-var": "warn",
|
||||||
"no-var": "error",
|
"prefer-const": "warn",
|
||||||
"prefer-const": "error",
|
"prefer-rest-params": "warn",
|
||||||
"prefer-rest-params": "error",
|
"prefer-template": "warn",
|
||||||
"prefer-template": "error",
|
"template-curly-spacing": "warn"
|
||||||
"template-curly-spacing": "error"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +0,0 @@
|
|||||||
// ! TODO: Удалить, необходим для примера работы с компонентами
|
|
||||||
|
|
||||||
import Component from '../component';
|
|
||||||
|
|
||||||
class TestButton extends Component {
|
|
||||||
constructor () {
|
|
||||||
super('#test-button', document.body);
|
|
||||||
|
|
||||||
this.addEventListener(this.mainNode, 'click', (evt) => {
|
|
||||||
this.next('click', evt);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default TestButton;
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
import TestButton from './TestButton';
|
|
||||||
|
|
||||||
export default TestButton;
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import EmitService from './EmitService';
|
import EmitService from './EmitService';
|
||||||
import {parse} from 'querystring';
|
import {parse, stringify} from 'querystring';
|
||||||
|
|
||||||
const ROUTE_CHANGE = 'routeChange';
|
const ROUTE_CHANGE = 'routeChange';
|
||||||
|
|
||||||
@ -26,8 +26,10 @@ class RouteService extends EmitService {
|
|||||||
this.generateNext();
|
this.generateNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
goTo = (url) => {
|
goTo = (url, query) => {
|
||||||
this.history.pushState({}, '', url);
|
const stringQuery = stringify(query);
|
||||||
|
const urlWithQuery = url + (stringQuery ? `?${stringQuery}` : '');
|
||||||
|
this.history.pushState({}, '', urlWithQuery);
|
||||||
this.generateNext();
|
this.generateNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user