implemented babel-eslint parsing for dynamic import for standard

This commit is contained in:
Kylart 2017-07-27 10:05:02 +02:00
parent 5b54ff6534
commit 6bb2bcd46f
3 changed files with 8 additions and 17 deletions

View File

@ -8,7 +8,7 @@
"env": { "env": {
"test": { "test": {
"presets": ["env", "stage-2"], "presets": ["env", "stage-2"],
"plugins": [ "istanbul" ] "plugins": ["istanbul", "syntax-dynamic-import"]
} }
} }
} }

View File

@ -59,8 +59,10 @@
"devDependencies": { "devDependencies": {
"autoprefixer": "^7.1.1", "autoprefixer": "^7.1.1",
"ava": "^0.19.1", "ava": "^0.19.1",
"babel-eslint": "^7.2.3",
"babel-loader": "^7.0.0", "babel-loader": "^7.0.0",
"babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0", "babel-plugin-transform-runtime": "^6.22.0",
"babel-polyfill": "^6.23.0", "babel-polyfill": "^6.23.0",
"babel-preset-env": "^1.3.2", "babel-preset-env": "^1.3.2",
@ -73,7 +75,7 @@
"cross-env": "^5.0.0", "cross-env": "^5.0.0",
"css-loader": "^0.28.4", "css-loader": "^0.28.4",
"electron": "^1.7.5", "electron": "^1.7.5",
"electron-builder": "^17.1.1", "electron-builder": "^17.10.0",
"env2": "^2.2.0", "env2": "^2.2.0",
"es6-promise": "^4.1.0", "es6-promise": "^4.1.0",
"eslint-plugin-vue": "^2.0.1", "eslint-plugin-vue": "^2.0.1",
@ -125,9 +127,9 @@
} }
}, },
"standard": { "standard": {
"parser": "babel-eslint",
"ignore": [ "ignore": [
"test/front.test.js", "test/front.test.js",
"router/index.js",
"public" "public"
] ]
}, },

View File

@ -17,10 +17,10 @@ function route (path, view) {
Vue.use(Router) Vue.use(Router)
export function createRouter () { export function createRouter () {
const router = new Router({ return new Router({
base: __dirname, base: __dirname,
mode: 'history', mode: 'history',
scrollBehavior: () => ({ y: 0 }), scrollBehavior: () => ({y: 0}),
routes: [ routes: [
route('/', 'index'), route('/', 'index'),
route('/downloader', 'downloader'), route('/downloader', 'downloader'),
@ -29,18 +29,7 @@ export function createRouter () {
route('/localPage', 'localPage'), route('/localPage', 'localPage'),
route('/watchList', 'watchList'), route('/watchList', 'watchList'),
// Global redirect for 404 // Global redirect for 404
{ path: '*', redirect: '/' } // TODO: make a custom 404 page {path: '*', redirect: '/'} // TODO: make a custom 404 page
] ]
}) })
// Send a pageview to Google Analytics
router.beforeEach((to, from, next) => {
if (typeof ga !== 'undefined') {
ga('set', 'page', to.path)
ga('send', 'pageview')
}
next()
})
return router
} }