diff --git a/.eslintrc.js b/.eslintrc.js index 90e0afb..7e3f37c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,55 +1,57 @@ const config = require("./config") module.exports = { + parser: "babel-eslint", parserOptions: { sourceType: "module" }, extends: "google", // required to lint *.vue files plugins: [ "html" ], settings: { "import/resolver": { "webpack": { "config": "build/webpack.base.conf.js" } } }, // add your custom rules here rules: { + "strict": 0, // don"t allow semicolons "semi": ["error", "never"], // don"t require comma in the last line of an object/dictionary declaration "comma-dangle": ["error", "never"], // ignore max-len for comments "max-len": [ "error", { "code": 100, "ignoreComments": true, "ignoreTrailingComments": true, "ignoreUrls": true, "ignoreStrings": true } ], // force space after and before curly braces in object/dict declarations "object-curly-spacing": ["error", "always"], // allow debugger; instruction during development "no-debugger": config.isProduction ? 2 : 0, // force "===" in comparisons when ambiguous "eqeqeq": ["error", "smart"], // force double quotes "quotes": ["error", "double"], "indent": ["error", "tab"], "no-tabs": 0, "require-jsdoc": 0, "new-cap": ["error", { "capIsNew": false }] } } diff --git a/src/router/index.js b/src/router/index.js index 02908ff..22a154f 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,66 +1,66 @@ import Router from "vue-router" // We are also using Webpack code splitting here so that each route's associated // component code is loaded on-demand only when the route is visited. // When do you use on-demand load? When the view is not one of the important one. When a route is important? You decide let routes = [] import Home from "views/Home" import Department from "views/Department" import Course from "views/Course" import Chapter from "views/Chapter" import Courses from "views/Courses" import Page from "views/Page" -const EditPage = () => System.import("views/EditPage") +const EditPage = () => import("views/EditPage") routes = routes.concat([ { path: "/", component: Home, name: "Home" }, { path: "/d/:departmentName", component: Department, name: "Department" }, { path: "/c", component: Courses, name: "Courses" }, { path: "/c/:courseName", component: Course, name: "Course" }, { path: "/c/:courseName/:chapterName", component: Chapter, name: "Chapter" }, { path: "/p/:pageTitle(.+)/edit", component: EditPage, name: "EditPage" }, { path: "/p/:pageTitle(.+)", component: Page, name: "Page" } ]) if (process.env.NODE_ENV !== "production") { - const Showcase = () => System.import("views/dev/Showcase") // load dynamically when needed - const Login = () => System.import("views/dev/Login") + const Showcase = () => import("views/dev/Showcase") // load dynamically when needed + const Login = () => import("views/dev/Login") routes.push({ path: "/showcase", component: Showcase }) routes.push({ path: "/login", component: Login }) } -const UIDemo = () => System.import("views/dev/UIDemo") -const UIDemoComponentsList = () => System.import("views/dev/ui/ComponentsList") -const UIDemoButton = () => System.import("views/dev/ui/Button") -const UIDemoDialog = () => System.import("views/dev/ui/Dialog") -const UIDemoAsync = () => System.import("views/dev/ui/Async") -const UIDemoInput = () => System.import("views/dev/ui/Input") -const UIDemoField = () => System.import("views/dev/ui/Field") +const UIDemo = () => import("views/dev/UIDemo") +const UIDemoComponentsList = () => import("views/dev/ui/ComponentsList") +const UIDemoButton = () => import("views/dev/ui/Button") +const UIDemoDialog = () => import("views/dev/ui/Dialog") +const UIDemoAsync = () => import("views/dev/ui/Async") +const UIDemoInput = () => import("views/dev/ui/Input") +const UIDemoField = () => import("views/dev/ui/Field") routes.push({ path: "/uidemo", component: UIDemo, children: [ { path: "", component: UIDemoComponentsList }, { path: "button", component: UIDemoButton }, { path: "dialog", component: UIDemoDialog }, { path: "async", component: UIDemoAsync }, { path: "input", component: UIDemoInput }, { path: "field", component: UIDemoField } ] }) -const NotFound = () => System.import("views/NotFound") +const NotFound = () => import("views/NotFound") routes.push({ path: "/404", component: NotFound, name: "NotFound" }) // push as last element because the wildcard match will catch all the unknown urls routes.push({ path: "*", component: NotFound }) export function createRouter() { return new Router({ mode: "history", scrollBehavior: () => ({ y: 0 }), routes }) }