Add eslint plugin, add script in package.json

This commit is contained in:
Tomasz Rymkiewicz 2022-01-01 15:42:20 +01:00 committed by FireMasterK
parent 5977e2c51a
commit 3349cd69c9
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD
5 changed files with 28 additions and 9 deletions

View file

@ -5,7 +5,8 @@
"scripts": {
"serve": "vite",
"build": "vite build",
"preview": "vite preview"
"preview": "vite preview",
"lint": "eslint --fix --color --ignore-path .gitignore ."
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.36",
@ -31,10 +32,12 @@
"@vue/compiler-sfc": "3.2.26",
"babel-eslint": "^10.1.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^7.20.0",
"prettier": "^2.5.1",
"vite": "^2.7.9",
"vite-plugin-eslint": "^1.3.0",
"vite-plugin-pwa": "^0.11.12",
"vite-plugin-windicss": "^1.6.1"
},

View file

@ -57,8 +57,8 @@ import("./registerServiceWorker");
const mixin = {
methods: {
timeFormat: function(duration) {
var pad = function(num, size) {
timeFormat: function (duration) {
var pad = function (num, size) {
return ("000" + num).slice(size * -1);
};
@ -95,7 +95,7 @@ const mixin = {
num = parseInt(num);
return num.toLocaleString("en-US");
},
fetchJson: function(url, params, options) {
fetchJson: function (url, params, options) {
if (params) {
url = new URL(url);
for (var param in params) url.searchParams.set(param, params[param]);
@ -152,7 +152,7 @@ const mixin = {
return this.getPreferenceString("authToken" + this.hashCode(this.apiUrl()));
},
hashCode(s) {
return s.split("").reduce(function(a, b) {
return s.split("").reduce(function (a, b) {
a = (a << 5) - a + b.charCodeAt(0);
return a & a;
}, 0);
@ -173,7 +173,7 @@ const mixin = {
var store = tx.objectStore("watch_history");
videos.map(async video => {
var request = store.get(video.url.substr(-11));
request.onsuccess = function(event) {
request.onsuccess = function (event) {
if (event.target.result) {
video.watched = true;
}

View file

@ -70,7 +70,7 @@ const routes = [
const router = createRouter({
history: createWebHistory(),
routes,
scrollBehavior: function(_to, _from, savedPosition) {
scrollBehavior: function (_to, _from, savedPosition) {
return savedPosition ? savedPosition : window.scrollTo(0, 0);
},
});

View file

@ -4,6 +4,7 @@ import WindiCSS from "vite-plugin-windicss";
import vueI18n from "@intlify/vite-plugin-vue-i18n";
import { VitePWA } from "vite-plugin-pwa";
import path from "path";
import eslintPlugin from "vite-plugin-eslint";
// https://vitejs.dev/config/
export default defineConfig({
@ -41,6 +42,7 @@ export default defineConfig({
],
},
}),
eslintPlugin(),
],
resolve: {
alias: {

View file

@ -1771,6 +1771,11 @@ escape-string-regexp@^4.0.0:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
eslint-config-prettier@^8.3.0:
version "8.3.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz#f7471b20b6fe8a9a9254cc684454202886a2dd7a"
integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==
eslint-plugin-prettier@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.0.0.tgz#8b99d1e4b8b24a762472b4567992023619cb98e0"
@ -1813,7 +1818,7 @@ eslint-visitor-keys@^2.0.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303"
integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==
eslint@^7.32.0:
eslint@^7.26.0, eslint@^7.32.0:
version "7.32.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d"
integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==
@ -2774,7 +2779,7 @@ rollup-plugin-terser@^7.0.0:
serialize-javascript "^4.0.0"
terser "^5.0.0"
rollup@^2.43.1, rollup@^2.59.0, rollup@^2.60.2:
rollup@^2.43.1, rollup@^2.47.0, rollup@^2.59.0, rollup@^2.60.2:
version "2.63.0"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.63.0.tgz#fe2f7fec2133f3fab9e022b9ac245628d817c6bb"
integrity sha512-nps0idjmD+NXl6OREfyYXMn/dar3WGcyKn+KBzPdaLecub3x/LrId0wUcthcr8oZUAcZAR8NKcfGGFlNgGL1kQ==
@ -3148,6 +3153,15 @@ v8-compile-cache@^2.0.3:
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee"
integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==
vite-plugin-eslint@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/vite-plugin-eslint/-/vite-plugin-eslint-1.3.0.tgz#cbc3f1542ca5e90d592ccfb6b4957e9b63f99a0e"
integrity sha512-ng6liBWegj6bovfJVGsXXL2XeQR3xnqe4UsnwTE8rbsYTnAaiLfaZK3rruGAyiwCBPbBc2IEED6T7sus5NJfEw==
dependencies:
"@rollup/pluginutils" "^4.1.0"
eslint "^7.26.0"
rollup "^2.47.0"
vite-plugin-pwa@^0.11.12:
version "0.11.12"
resolved "https://registry.yarnpkg.com/vite-plugin-pwa/-/vite-plugin-pwa-0.11.12.tgz#02b4cfccd7ad098cfb291415c62c3b7281b7c538"