From 676c8f7fe0d681f9399874c2ae499ab2d0b23ac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Thu, 31 Oct 2019 15:51:31 +0100 Subject: [PATCH] autoformat && eslint change --- .babelrc | 22 ++- .eslintrc.js | 54 +++--- .postcssrc.js | 6 +- config/dev.env.js | 10 +- config/index.js | 30 ++-- config/prod.env.js | 6 +- package-lock.json | 88 +++++++++ package.json | 1 + src/App.vue | 78 ++++---- src/components/Canvas.vue | 160 ++++++++--------- src/components/Player.vue | 354 ++++++++++++++++++------------------- src/components/Sidebar.vue | 233 ++++++++++++------------ src/helpers/image.js | 12 +- src/main.js | 16 +- 14 files changed, 591 insertions(+), 479 deletions(-) diff --git a/.babelrc b/.babelrc index 3a280ba..2310f6d 100644 --- a/.babelrc +++ b/.babelrc @@ -1,12 +1,22 @@ { "presets": [ - ["env", { - "modules": false, - "targets": { - "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] + [ + "env", + { + "modules": false, + "targets": { + "browsers": [ + "> 1%", + "last 2 versions", + "not ie <= 8" + ] + } } - }], + ], "stage-2" ], - "plugins": ["transform-vue-jsx", "transform-runtime"] + "plugins": [ + "transform-vue-jsx", + "transform-runtime" + ] } diff --git a/.eslintrc.js b/.eslintrc.js index 2e2e211..2b8ea73 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,25 +1,35 @@ -// https://eslint.org/docs/user-guide/configuring - module.exports = { - root: true, - parser: 'babel-eslint', - parserOptions: { - sourceType: 'module' + "env": { + "browser": true, + "es6": true, }, - env: { - browser: true, - }, - // https://github.com/standard/standard/blob/master/docs/RULES-en.md - extends: 'standard', - // required to lint *.vue files - plugins: [ - 'html' + "extends": [ + "eslint:recommended", + "plugin:vue/essential", ], - // add your custom rules here - rules: { - // allow async-await - 'generator-star-spacing': 'off', - // allow debugger during development - 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' - } -} + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly", + }, + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module", + }, + "plugins": [ + "vue", + ], + "rules": { + "linebreak-style": [ + "error", + "unix", + ], + "quotes": [ + "error", + "double", + ], + "semi": [ + "error", + "always", + ], + }, +}; diff --git a/.postcssrc.js b/.postcssrc.js index eee3e92..2862e3d 100644 --- a/.postcssrc.js +++ b/.postcssrc.js @@ -5,6 +5,6 @@ module.exports = { "postcss-import": {}, "postcss-url": {}, // to edit target browsers: use "browserslist" field in package.json - "autoprefixer": {} - } -} + "autoprefixer": {}, + }, +}; diff --git a/config/dev.env.js b/config/dev.env.js index 1e22973..f0b75db 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -1,7 +1,7 @@ -'use strict' -const merge = require('webpack-merge') -const prodEnv = require('./prod.env') +"use strict"; +const merge = require("webpack-merge"); +const prodEnv = require("./prod.env"); module.exports = merge(prodEnv, { - NODE_ENV: '"development"' -}) + NODE_ENV: "\"development\"", +}); diff --git a/config/index.js b/config/index.js index 2ab4bc1..0649eac 100644 --- a/config/index.js +++ b/config/index.js @@ -1,19 +1,19 @@ -'use strict' +"use strict"; // Template version: 1.2.8 // see http://vuejs-templates.github.io/webpack for documentation. -const path = require('path') +const path = require("path"); module.exports = { dev: { // Paths - assetsSubDirectory: 'static', - assetsPublicPath: '/', + assetsSubDirectory: "static", + assetsPublicPath: "/", proxyTable: {}, // Various Dev Server settings - host: 'localhost', // can be overwritten by process.env.HOST + host: "localhost", // can be overwritten by process.env.HOST port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined autoOpenBrowser: false, errorOverlay: true, @@ -33,7 +33,7 @@ module.exports = { */ // https://webpack.js.org/configuration/devtool/#development - devtool: 'cheap-module-eval-source-map', + devtool: "cheap-module-eval-source-map", // If you have problems debugging vue-files in devtools, // set this to false - it *may* help @@ -45,12 +45,12 @@ module.exports = { build: { // Template for index.html - index: path.resolve(__dirname, '../dist/index.html'), + index: path.resolve(__dirname, "../dist/index.html"), // Paths - assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', - assetsPublicPath: '/tools/slitscan', + assetsRoot: path.resolve(__dirname, "../dist"), + assetsSubDirectory: "static", + assetsPublicPath: "/tools/slitscan", /** * Source Maps @@ -58,19 +58,19 @@ module.exports = { productionSourceMap: true, // https://webpack.js.org/configuration/devtool/#production - devtool: '#source-map', + devtool: "#source-map", // Gzip off by default as many popular static hosts such as // Surge or Netlify already gzip all static assets for you. // Before setting to `true`, make sure to: // npm install --save-dev compression-webpack-plugin productionGzip: false, - productionGzipExtensions: ['js', 'css'], + productionGzipExtensions: ["js", "css"], // Run the build command with an extra argument to // View the bundle analyzer report after build finishes: // `npm run build --report` // Set to `true` or `false` to always turn it on or off - bundleAnalyzerReport: process.env.npm_config_report - } -} + bundleAnalyzerReport: process.env.npm_config_report, + }, +}; diff --git a/config/prod.env.js b/config/prod.env.js index a6f9976..2cda586 100644 --- a/config/prod.env.js +++ b/config/prod.env.js @@ -1,4 +1,4 @@ -'use strict' +"use strict"; module.exports = { - NODE_ENV: '"production"' -} + NODE_ENV: "\"production\"", +}; diff --git a/package-lock.json b/package-lock.json index f0c71b9..6afb3ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3612,6 +3612,31 @@ "integrity": "sha1-NNDJFbRe3G8BA5PH7vOCOwhWXPI=", "dev": true }, + "eslint-plugin-vue": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-5.2.3.tgz", + "integrity": "sha512-mGwMqbbJf0+VvpGR5Lllq0PMxvTdrZ/ZPjmhkacrCHbubJeJOt+T6E3HUzAifa2Mxi7RSdJfC9HFpOeSYVMMIw==", + "dev": true, + "requires": { + "vue-eslint-parser": "^5.0.0" + } + }, + "eslint-scope": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", + "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "eslint-visitor-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", + "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", + "dev": true + }, "espree": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.2.tgz", @@ -11427,6 +11452,69 @@ "resolved": "https://registry.npmjs.org/vue/-/vue-2.5.13.tgz", "integrity": "sha512-3D+lY7HTkKbtswDM4BBHgqyq+qo8IAEE8lz8va1dz3LLmttjgo0FxairO4r1iN2OBqk8o1FyL4hvzzTFEdQSEw==" }, + "vue-eslint-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-5.0.0.tgz", + "integrity": "sha512-JlHVZwBBTNVvzmifwjpZYn0oPWH2SgWv5dojlZBsrhablDu95VFD+hriB1rQGwbD+bms6g+rAFhQHk6+NyiS6g==", + "dev": true, + "requires": { + "debug": "^4.1.0", + "eslint-scope": "^4.0.0", + "eslint-visitor-keys": "^1.0.0", + "espree": "^4.1.0", + "esquery": "^1.0.1", + "lodash": "^4.17.11" + }, + "dependencies": { + "acorn": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz", + "integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==", + "dev": true + }, + "acorn-jsx": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz", + "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==", + "dev": true + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "espree": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-4.1.0.tgz", + "integrity": "sha512-I5BycZW6FCVIub93TeVY1s7vjhP9CY6cXCznIRfiig7nRviKZYdRnj/sHEWC6A7WE9RDWOFq9+7OsWSYz8qv2w==", + "dev": true, + "requires": { + "acorn": "^6.0.2", + "acorn-jsx": "^5.0.0", + "eslint-visitor-keys": "^1.0.0" + } + }, + "esquery": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", + "dev": true, + "requires": { + "estraverse": "^4.0.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, "vue-hot-reload-api": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.2.4.tgz", diff --git a/package.json b/package.json index 28bd0ab..3ad6af5 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "eslint-plugin-node": "^5.2.0", "eslint-plugin-promise": "^3.4.0", "eslint-plugin-standard": "^3.0.1", + "eslint-plugin-vue": "^5.2.3", "extract-text-webpack-plugin": "^3.0.0", "file-loader": "^1.1.4", "friendly-errors-webpack-plugin": "^1.6.1", diff --git a/src/App.vue b/src/App.vue index 7bc3241..f0b9de6 100644 --- a/src/App.vue +++ b/src/App.vue @@ -10,53 +10,53 @@ diff --git a/src/components/Canvas.vue b/src/components/Canvas.vue index b545f34..f73a09a 100644 --- a/src/components/Canvas.vue +++ b/src/components/Canvas.vue @@ -5,94 +5,94 @@ diff --git a/src/components/Player.vue b/src/components/Player.vue index 4a8c009..f36c516 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -37,197 +37,197 @@ diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index 72ca4b4..ca5839e 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -49,137 +49,140 @@ diff --git a/src/helpers/image.js b/src/helpers/image.js index 8718f1f..144f863 100644 --- a/src/helpers/image.js +++ b/src/helpers/image.js @@ -1,16 +1,16 @@ export function getDimsFit (wOriginal, hOriginal, wContain, hContain) { - let origRatio = wOriginal / hOriginal - let containRatio = wContain / hContain + let origRatio = wOriginal / hOriginal; + let containRatio = wContain / hContain; if (origRatio > containRatio) { return { width: wContain, - height: wContain / origRatio - } + height: wContain / origRatio, + }; } else { return { width: origRatio * hContain, - height: hContain - } + height: hContain, + }; } } diff --git a/src/main.js b/src/main.js index f00ab8a..959709c 100644 --- a/src/main.js +++ b/src/main.js @@ -1,15 +1,15 @@ // The Vue build version to load with the `import` command // (runtime-only or standalone) has been set in webpack.base.conf with an alias. -import Vue from 'vue' -import App from './App' +import Vue from "vue"; +import App from "./App"; -Vue.config.productionTip = false +Vue.config.productionTip = false; -Vue.prototype.$bus = new Vue({}) +Vue.prototype.$bus = new Vue({}); /* eslint-disable no-new */ new Vue({ - el: '#app', - template: '', - components: { App } -}) + el: "#app", + template: "", + components: {App}, +});